hi
i am a beginner programmer , i am trying to find some ideas for to import point data from excel to revit and replace them with specific family
thanks for helping
hi
i am a beginner programmer , i am trying to find some ideas for to import point data from excel to revit and replace them with specific family
thanks for helping
This will place family instance at point:
Is this what you mean?
This code is not written by myself, the credit goes tho whoever did write it:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
points = UnwrapElement(IN[0])
famtype = UnwrapElement(IN[1])
lvl = UnwrapElement(IN[2])
elementlist = list()
counter = 0
TransactionManager.Instance.EnsureInTransaction(doc)
# make sure familysymbol is active
if famtype.IsActive == False:
famtype.Activate()
doc.Regenerate()
for point in points:
newobj = doc.Create.NewFamilyInstance(point.ToXyz(),famtype,lvl)
elementlist.append(newobj.ToDSType(False))
TransactionManager.Instance.TransactionTaskDone()
OUT = elementlist