Custom Revision Number Type

Hi, as since Revit 2022 has allowed custom Revision Number Type, with multiple prefixes etc, is there any dynamo node that allows us to access them, over the standard Alphanumeric or Numeric.

Above image shows I’ve created a “Tender” Numbering type but not visible on the Dynamo node. Are there any packages that may already pick this up recently?

Thank you!

Hi @MReza

Please see below. Hope it helps :slight_smile:

import clr

# Add RevitAPI and RevitServices references
clr.AddReference("RevitAPI")
clr.AddReference("RevitServices")

# Import Revit API classes
from Autodesk.Revit.DB import FilteredElementCollector, RevisionNumberingSequence

# Import Dynamo classes
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Get the current Revit document
doc = DocumentManager.Instance.CurrentDBDocument

# Create a FilteredElementCollector to get all revision numbering sequences
rev_seq_collector = FilteredElementCollector(doc).OfClass(RevisionNumberingSequence)

# Initialize an empty list to store the revision numbering sequence names
rev_seq_names = []

# Iterate over the revision numbering sequences and collect their names
for rev_seq in rev_seq_collector:
    rev_seq_names.append(rev_seq.Name)


# Output the revision numbering sequence names to the Dynamo workspace
OUT = rev_seq_names, rev_seq_collector

3 Likes

This might help also, I use many properties of revisions sequences in this dataset. I will have a video on my YT channel at a later date using it (mid-May) that generates a full document transmittal including cross matrix of revision codes, sheets and revisions.

Aside from collecting sheets and forming the set of strings to copy/past to a doctrans the whole thing is done in one Python block, see below:

# Made by Gavin Crump
# Free for use
# BIM Guru, www.bimguru.com.au

# Boilerplate text
import clr

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager 

clr.AddReference("RevitAPI")
import Autodesk 
from Autodesk.Revit.DB import *

# Current doc/app/ui
doc = DocumentManager.Instance.CurrentDBDocument

# Define list/unwrap list functions
def uwlist(input):
    result = input if isinstance(input, list) else [input]
    return UnwrapElement(result)

# Preparing input from dynamo to revit
sheets = uwlist(IN[0])

# Get revision sequences and revisions
revSeqs = FilteredElementCollector(doc).OfClass(RevisionNumberingSequence).ToElements()
revIds  = Revision.GetAllRevisionIds(doc)
revs    = [doc.GetElement(i) for i in revIds]

# Empty variable lists to store to
revSeqNames, revCharSeqs = [],[]

# Get sequence names and characters
for r in revs:
	# Get sequence
	rsId = r.RevisionNumberingSequenceId
	rs   = doc.GetElement(rsId)
	# Append the name and start a sequence
	revSeqNames.append(rs.Name)
	charSequence = []
	# Get sequence characters for numeric...
	if rs.NumberType == RevisionNumberType.Numeric:
		settings  = rs.GetNumericRevisionSettings()
		minDigits = settings.MinimumDigits
		prefix    = settings.Prefix
		suffix    = settings.Suffix
		for n in range(settings.StartNumber,99,1):
			char_str = str(n)
			pad_str  = char_str.rjust(minDigits,"0")
			char_seq = prefix + pad_str + suffix
			charSequence.append(char_seq)
	# ... or Alphanumeric
	else:
		settings = rs.GetAlphanumericRevisionSettings()
		prefix    = settings.Prefix
		suffix    = settings.Suffix
		for a in settings.GetSequence():
			char_seq = prefix + a + suffix
			charSequence.append(char_seq)
	# Append the character sequence
	revCharSeqs.append(charSequence)

# Get revision sequences per sheet
rowsOut = []
sep = "\t"

for s in sheets:
	trackRevs = []
	sheetRevs = s.GetAllRevisionIds()
	rowOut = ""
	rowOut += s.SheetNumber + sep + s.Name + sep
	# For each revision in the document
	for i in revIds:
		# Check if the sheet has it
		if i in sheetRevs:
			# Get the sequence Id name and get its name
			r    = doc.GetElement(i)
			rsId = r.RevisionNumberingSequenceId
			rs   = doc.GetElement(rsId)
			rsn  = rs.Name
			# Find the index of the sequence name
			i_sq = revSeqNames.index(rsn)
			# Find out how many times the sequence occured so far
			i_ch = trackRevs.count(rsn)
			# Get the sequence character, then track the sequence
			d = revCharSeqs[i_sq][i_ch] + sep
			trackRevs.append(rsn)
		else:
			d = "" + sep
		rowOut += d
	# Add the value to the end
	rowsOut.append(rowOut)


# Make the top header
header = "Number" + sep + "Name" + sep + sep.join([r.RevisionDate for r in revs]) + sep
rowsOut.insert(0,header)

# Preparing output to Dynamo
OUT = rowsOut

This generates data to paste into a doctrans like below:

@jonnyhaslett is on the money here, so give them the solution if it solves your problem though.

Thanks so much for the responses both @jonnyhaslett @GavinCrump!

1 Like

Hi, though the python (by @jonnyhaslett) works well in accessing the Numbering, I can’t seem to actually use the existing Revision Numbering scheme to create the revisions.

Would anyone be able to help set the Revision Numbering to Revisions?

To create, I’m using Revision.ByName… Screenshot below shows what ever I put on Dynamo, it seems to create a new one in Revit called Dynamo_Alphanumeric in revit instead of using one we prepared prior.

Thank you in advance…

Hi @MReza

I had the exact same problem

See this post for the solution.

https://forum.dynamobim.com/t/create-revision-by-name-revit-2023-bug-numbering-sequence-creates-new-type/85481?u=jonnyhaslett