Is it possible to Automate Revit's Acquire co-ordinates?


#1

I would like to automate the Revit’s Acquire co-ordinates function, but it seems there is not a node that will perform this task.

There doesn’t seem to be anything on the Dynamo forum, I have looked at Jeremy Tammik’s “The Building Coder” http://thebuildingcoder.typepad.com/blog/2015/08/internal-vs-base-point-and-link-to-host-coordinates.html and also came across Kevin Bell’s question https://forum.dynamobim.com/t/translating-coordinates-to-site-coordinates/11430 for some help, but I’m afraid I’m out of my league here deciphering what’s going on with Python or the ability of how to create it.

I cut and pasted the code from Jeremy’s page into a python script node with the faint hope it would work in Dynamo, but alas my hope ended there. The code on Kevin’s page returned the values for ;
angle = pos.Angle, ew = pos.EastWest, ns = pos.NorthSouth, e = pos.Elevation of the Project Base Point (PBP) for the current model, and not the linked file which is were I would like to acquire that information from.

Is there anyone out there who can offer some help to allow this process to be executed inside Dynamo ?

ACQUIRE_CO-ORDINATES


#2

It appears AquireCoordinates() was added as a method for Revit 2018 and above.

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

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

revitLink = UnwrapElement(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc)

doc.AcquireCoordinates(revitLink.Id)

TransactionManager.Instance.TransactionTaskDone()

OUT = revitLink

I haven’t tested this but give this a try; the input would be the RevitLinkInstance you want to acquire the coordinates of. Let me know if this works


Updating multiple Revit models shared coordinates
#3

Many thanks Amy, your response is appreciated, however I get an error in the python script when connected to various iterations of nodes called Document.Get All Linked Files, Document.Get Linked Model and Document.Get Linked Model Files from MyBIMtheque and Archi-Lab Grimshaw, see images

It seems some attributes are missing or I’m feeding the wrong information, and I’m not sure how to fix it.




#4

Hi @r.lietz

Which Revit version are you using?

As @awilliams also points out, this method was introduced in Revit 2018, and will not work for previous versions:


#5

Ah, yes well, that does throw a fly in the ointment, my Revit at this stage is only 2017. Thanks Martin for the clarification, I’ll follow up with IT.


#6

IT people said “NO” so I had to install a 2018 version on my home machine and run it again, unfortunately Dynamo again said “NO” so what next ?

Dynamo test file : AQUIRE_COORDS_00.dyn (53.9 KB)

Document.Get Linked Model Files comes from package MyBIMtheque


#7

Hi @r.lietz,

You can try to not have a list with List.GetItemAtIndex or try to feed a link instance ID.


#8

Vola !! or perhaps is that no “vola” in the ointment now. Sir Alban you are a gentleman and of course both Amy and Martin are gems, the answer is always in front of you, sometimes you just need a little help from friends.

ACQUIRE_COORDS.dyn (19.2 KB)

Document.Get Linked Model Files is from MyBIMtheque


#9

Hi @r.lietz,
You’re welcome.
I changed the solution on Amy’s post because I did nearly nothing.