Add List: Numbers to Text Note

@Ewan_Opie Your o2 needs to be a TextRange, which in the code below I retrieve from the text note’s FormattedText with the AsTextRange() method but you can construct your own with TextRange(int,int). The only other part you were missing is to get the ListType with System.Enum.Parse (below I left it as an input but you could as well get rid of IN[1] and just have a line that says listType = System.Enum.Parse(Autodesk.Revit.DB.ListType, "ArabicNumbers")

set%20textnote%20list

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

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

from System.Collections.Generic import *

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

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

dataEnteringNode = IN

textNotes = IN[0]
listType = System.Enum.Parse(Autodesk.Revit.DB.ListType, IN[1])

if not isinstance(textNotes, list):
	textNotes = [textNotes]


TransactionManager.Instance.EnsureInTransaction(doc)

for textNote in textNotes:

	textNote = UnwrapElement(textNote)
	formatText = textNote.GetFormattedText()
	textRange = formatText.AsTextRange()
	formatText.SetListType(textRange,listType)
	textNote.SetFormattedText(formatText)
	
TransactionManager.Instance.TransactionTaskDone()

OUT = textNotes
3 Likes