Grabbing elements from a linked revit file

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

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

from Autodesk.Revit import DB
from Autodesk.Revit.DB.Structure import *

from Autodesk.Revit.UI import *

from System.Collections.Generic import List

import Revit

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

# 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


Look at the transformations from one model to another. Location in A isn’t the same place as Location in B
Note the diagram below with a file and a couple of links. The upper left is the local 0,0,0 and project basepoint. The lower right is the link’s project basepoint. The lower right circle is an element -73,73,100 in the linked file. The upper left circle at -73,73,100 in the host file is where the item would be if it used the same point in the host file.

The Transform of the link is ~902, -331, 0. This has to be applied to the item as it moves from one space to another. In this case there is no rotational or scale transform that are needed. But they could be different as well. (My sketched lines and dimensions are approximate.)

If both files share the same project basepoint - no transform should be needed ad what you have would work. *Tranform would be 0,0,0.