I didn’t get around to putting this in python and proving it could be run through the API due to lack of time on this project but if I do in my spare time I’ll post back on this thread. In the mean time, I think @jacob.small answered the question.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN
#unwrap all elements to use with API
elements = []
for i in IN[0]:
elements.append(UnwrapElement(i))
# "Start" the transaction
TransactionManager.Instance.EnsureInTransaction(doc)
#apply color override to elements in an input list
for i in elements:
o1 = i.GetFormattedText()
o2 = 0
o3 = o1.SetListType(o2,"ArabicNumbers")
# "End" the transaction
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable
OUT = o1,o3
@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")
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