Python Dynamo - symbol is not active

Hi,

I’m learning python and encounter this error, the python script notify me an error that “symbol is not active”. Can you guys take a look and tell me how I can fix this?

Much thanks.

1 Like

@khangtran ,

i did it this way!


import sys
import clr

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

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

point_ = UnwrapElement(IN[0]).ToXyz()
symbol = UnwrapElement(IN[1])
level = UnwrapElement(IN[2])

#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

fam = doc.Create.NewFamilyInstance(point_, symbol, level, StructuralType.Column)

TransactionManager.Instance.TransactionTaskDone()

OUT = "Done!"

or as point array…

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

points = UnwrapElement(IN[0])
symbol = UnwrapElement(IN[1])
level = UnwrapElement(IN[2])

location = []
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

for i in points:
	location.append(i.ToXyz())
	
for j in location:
	fam = doc.Create.NewFamilyInstance(j, symbol, level, StructuralType.Column)

TransactionManager.Instance.TransactionTaskDone()

OUT = "Done!"

KR
Andreas

2 Likes

Hi @khangtran ,

Try looking into this property: ApiDocs.co

2 Likes