Move link instance to existing named location

Hello,
I’m looking for a node that can move a link instance to an existing named location. Imagine the link has 50 named locations and I want to populate all 50 with a dynamo at once.
I have the list of project locations:
image

I will make as many copies as needed from the link instance, but what node to use to set the location of each instance? I did not found any solution so far, maybe I’m overlooking something…

Hi,

I don’t believe it is supported…

Maybe someone else has a method :slight_smile:

Kind regards,

Mark

1 Like

It’s been four years since this discussion. Has the feature to move a link instance to an existing named location been added to Revit API? Any updates or new methods would be greatly appreciated!

Doesn’t look like it has been added:

Hi,

as workaround, it is possible to retrieve the shared coordinates of linked model sites and apply transformations.

Be careful with this method, however, as it’s not really recommended.

set site location

import clr
import sys
import System
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication

rvtLinkInstance = UnwrapElement(IN[0])
name_shared_site = IN[1]
lnkDoc = rvtLinkInstance.GetLinkDocument()
dict_data = {}

# get  all ProjectPosition
for projLocation in lnkDoc.ProjectLocations:
    projPosition =  projLocation.GetProjectPosition(XYZ.Zero)
    dict_data[projLocation.Name] =  projPosition
    
TransactionManager.Instance.EnsureInTransaction(doc)
# reset the transform
rvtLinkInstance.MoveOriginToHostOrigin(True)
doc.Regenerate()
# apply the new transform
axis = Line.CreateBound(XYZ.Zero, XYZ.BasisZ)
projPositionBatA = dict_data[name_shared_site]
DB.ElementTransformUtils.RotateElement(doc, rvtLinkInstance.Id, axis, projPositionBatA.Angle)
DB.ElementTransformUtils.MoveElement(doc, rvtLinkInstance.Id, XYZ(projPositionBatA.EastWest, projPositionBatA.NorthSouth, projPositionBatA.Elevation))
TransactionManager.Instance.TransactionTaskDone()

OUT = dict_data
3 Likes

Just curious- Why do you say this is not recommended? Is this just the same as selecting the link and using the “Move” command within Revit?

for example, for the BIM manager who wants to check the positions of instances, as the names of the sites do not appear in the properties, he has to check in another way that the instance is correctly positioned.

2 Likes