Hi there
Im trying to import elements from a linked revit file to my project by the family name, and i sucessed , but the problem is that the position where they are place is wrong
this is what looks like:
the place in the dynamo where the positions are grabbed is:
the “get location” code is:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
#from Autodesk.Revit.DB import Point,XYZ
from Autodesk.DesignScript.Geometry import Point
elems = IN[0]
transform = IN[1]
pos = list(map(lambda x:x.Location,elems))
pos = list(map(lambda x: XYZ(x.X,x.Y,x.Z),pos))
OUT = pos
the code of the python block that gets the elements from the Link Revit Instance is:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit import DB
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
# Preparing input from dynamo to revit
linkInst = UnwrapElement(IN[0])
family_names = UnwrapElement(IN[1])
linkDoc = linkInst.GetLinkDocument()
collector = DB.FilteredElementCollector(linkDoc)
elements = collector.OfClass(DB.FamilyInstance).ToElements()
filtered_instances = [instance for instance in elements if instance.Symbol.FamilyName in family_names]
# Output the collected elements
OUT = filtered_instances
Can anyone help me with this problem?
If someone has another way to accomplish this, please fell free to tell
Miguel Silvestre
Thanks