this script does not seem to work anymore, in the new Dynamo 2.16.1 in Revit 2023.
How do I convert it to Pyhton 3?
thank you
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
import System
doc = DocumentManager.Instance.CurrentDBDocument
result = Document.GetUnits(doc).GetFormatOptions(UnitType.UT_Length).DisplayUnits
#result = Document.DisplayUnitSystem.GetValue(doc)
OUT = result
In 2023 ForgeTypeId is now required:
This means that:
DisciplineTypeId replaces UnitGroup
SpecTypeId replaces ParameterType
GroupTypeId replaces BuiltInParameterGroup
ParameterTypeId replaces BuiltInParameter
You can always go long hand with just the direct ForgeTypeId for all of the above using the ForgeType string: ForgeTypeId(“autodesk.revit.parameter:viewDiscipline-1.0.0”)