Geometry from linked file, by shared coordinates, appears on the wrong place in Dynamo

So I have a file with geometry, linked by Shared Coordinates, while my rooms are in the host model:

However, after selecting all the rooms’ geometry and doors, windows, walls, etc from the geometry file, they appear to be on completely different places:

Any ideas why? :slight_smile: I am trying to calculate the areas of room finishes in the case with linked geometry and rooms in a host model. Everything seemed to work fine, until I tried with a project, where links are placed by shared coordinates.

The position of the elements is calculated from the origin.
Revit’s origin and Dynamo’s origin match, you only need to translate it in coordinates from your Shared Coordinate.
The are some nodes in the GeniusLoci package to get it back in position.

1 Like

Thx, I will give it a try

1 Like

I recently solved this problem by writing a short python script that gets the linked model’s totaltransform then converting that to a vector and translating the linked element’s location along this vector.

https://www.revitapidocs.com/2015/8c8aff2b-5ff9-e43a-3b5c-308cd0174f1f.htm

That’s cool, could you please share the script?

I tried different options and I still can’t get it to work, here is the geometry from the host model (blue) and the one from the geometry model (red). You can see the different transforms and none of them intersect:

From what I see, I can only get it to translate the geometry in Z direction, it does not detect X and Y difference in coordinates.

Sorry for the delay, here’s the python code which takes a document (linked instance) as input and outputs the linked document’s total transform as a point.

#Written by Scott Lebow
import clr

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

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

linkInst = UnwrapElement(IN[0])

totalTransform = linkInst.GetTotalTransform()
origin = XYZ(0, 0, 0)
offsetPoint = totalTransform.OfPoint(origin)

#Assign your output to the OUT variable.
OUT = offsetPoint.ToPoint()

From here you can create a Vector using this point (linkOffsetPoint).
DesignScript:
linkOffsetVector = Vector.ByTwoPoints(Point.ByCoordinates(0, 0, 0), linkOffsetPoint);

Or with nodes:
image

Then you can translate your point along this vector using Designscript:

newLocations = Point.Add(linkedElements.Location, linkOffsetVector);

Or the Point.Add node:

1 Like

Thx, Scott! That brought me as close as I could get so far:

However, there is still a weird rotation angle, while the BasePoint reports that angle to true north is set to 0…:

I am now trying to find out where that comes from :slight_smile:

Try BimorphNodes LinkElements they already include built-in logic to handle the transformation of linked elements and their geometry in the host document.

1 Like

I tried that initially. I finally got what I needed from GeniusLoci’s Get Project Locations node. For some reason, nothing else could read the True North correctly:

The node also reads the coordinates as it should - returns identical values with the one from Scott’s script. So I will just use that one.

I’m glad it finally works, but I will need to dig deeper and find out why so many nodes failed for this file. Could it be related to the new internal origin in 2021 somehow? Thx to everyone for the support

Its a problem with the Python script as it converts the transform to a translation and you need the former not the latter to position the geometry correctly. You could convert the transform to a Dynamo CS in Python using ToCoordinateSystem() or achieve your workflow with significant performance improvements using two BimorphNodes: