Publish Coordinates Transactions

whic version for 2019?

All versions of the Genius Loci package are compatible with Revit 2019.

Hi! I think there might be an issue with this node, or am I doing something wrong?


Hi,

Which version of Revit do you use ?
I will check this node.

Hi, thx for the quick answer! I am usind Revit 2021 and Dynamo 2.6… I am now looking at the python code, perhaps I need to have the coordinate system already created in the model, with the given name in order for the node to work? I think that is the problem, I am trying to create the coordinate system with the given name upon publishing coordinates (this is my usual workflow in Rvt)

Edit: My mistake, it works like a charm. You really need to have a site with the given name already created in the linked doc. So I would need to find a way to do that

Hi,

I edited the custom node to create the Project Location Name if it doesn’t already exist.

Try with this new version :

Replace the old node in C:\Users\%USERNAME%\AppData\Roaming\Dynamo\Dynamo Revit\2.6\packages\Genius Loci\dyf with the new one.

2 Likes

Wow, huge thanks for that! I just tried it, but I still think there might be an issue, I got a warning:

“Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 20, in
AttributeError: ‘NoneType’ object has no attribute ‘ProjectLocations’”

I think it gets the names of the coordinate systems in the wrong order:

Instances on the other hand are still with their location set to “Not Shared”

Hi @danail.momchilov,

I updated the node again to work in all cases.
You must have as many Project Location Names as there are linkinstances or a unique Project Location Name for all linkinstances.

Hi, @Alban_de_Chasteigner ! Thank you very much for trying to make this work, but unfortunattely there is still an issue - the node now creates the sites if they do not exist, but it changes instances’ locations. I tried it yesterday with the previous edit and all the links were moved to the wrong locations. I just tried your last update now and half of the links were immediately moved to wrong locations again, so I had to stop its run manually. You can see on the screenshot links already disappearing:

I have the same amount of instances and site names:

Edit: Perhaps two separate nodes would work better, the one for publishing coordinates like it was before and another one that only creates coordinate systems in linked files by their given name?

Hi Danail,

If I understand your workflow correctly, I don’t think it’s supported in Revit.
The Publish Coordinates node creates the sites if they do not exist and publish the current shared coordinates of the host model to the linked models.
Publish

If you have several sites in the host model, those that are not active are not taken into account.

1 Like

Hi, I only have one site in the host model:

But several different ones in the linked instances. Here’s my workflow:

The way your node worked previously was doing just that - publishing coordinates to an existing site within the link. The only thing missing was that you already needed to have these sites created in the linked file. So that’s what I was wondering how to automate :slight_smile:

Sorry to take so much of your time, I think I will just rollback to the initial version of your node and create the sites manually with the given names - it would take not more than an hour. Then publishing would work, I tried that already with a few instances only :slight_smile:

I now understand your workflow better.
I updated the custom node again. This time, I’m not creating a new project location, but duplicating the active project location from the linked model and setting a new name. The link should no longer move.
If you have time to experiment with this new behavior, that would be appreciated.

1 Like

Since I already created half of the sites back, would that be a problem? I mean if some of the sites exist, while others - not?

That shouldn’t be a problem.
The custom node first checks whether the Project Location name exists.

OK, let me give it a try :slight_smile:

There are still issues, unfortunattely :frowning: Locations are still not shared and I also see wrong site names in the links:

Edit: There are wrong locations also:

Hi, @Alban_de_Chasteigner

I used your code as a basis and simplified it a bit. I only used parts of it to create sites in linked instances and then used the previous version of your node to publish coordinates. I think there was a little issue with sorting and that was causing the problem, but I will check this further later on. Here’s the code:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

rvtLinkInstances = UnwrapElement(IN[0])
linkNames = UnwrapElement(IN[1])

i = 0

for rvtLinkInstance in rvtLinkInstances:
	linkDoc = rvtLinkInstance.GetLinkDocument()
	filepath = linkDoc.PathName
	linkType = doc.GetElement(rvtLinkInstance.GetTypeId())
	linkType.Unload(None)
	linkDoc2 = app.OpenDocumentFile( ModelPathUtils.ConvertUserVisiblePathToModelPath(filepath), OpenOptions())
	t = Transaction(linkDoc2, "Create Project Location")
	t.Start()
	linkLocationId = linkDoc2.ActiveProjectLocation.Duplicate(linkNames[i]).Id
	t.Commit()	
	linkDoc2.Close(True)
	linkType.Reload()
	i += 1

OUT = "whatever"

Of course, currently it would only work in case there is identical number of instances and site names and none of the sites is created already, but that’s easy to fix. What’s important is now we didn’t have to do these thousands of clicks :stuck_out_tongue:

Thx for your support, Cheers!

2 Likes

Hello @Alban_de_Chasteigner
I have a very similar task as Danail had in this conversation, there are a bunch of villas and I need to save their positions with a name. At the moment I’m running a test only with a simplistic revit file (4 walls).
I have placed 5 instances of the same link

I have used the Publish Coordinates node to save location. What happening is locations are created in the link, all 5 of them but their coordinates are the same, this case the same as the last item in the list.
2023-07-04 10_08_41-1 031 560 722 - AnyDesk

So if in the example I change the location of all 5 link they will be on top of each other:

Do you have any idea about this?

Hi,

Not sure about this but try to set the the longest lacing on the Publish Cordinates node.

Hi,
There was a typo in the python script.

linkLocationId = [linkLocation for linkLocation in linkLocations if linkLocation.Name == linkProjLocNams[p]][0].Id

last variable should be linkProjLocNames

This caused all the named position to have the same location.
Btw thank you for the script it has saved a lot of time for me I had to save 500 named positions. It was still running for a day as it opened the file 500 times. Not sure if you can save the positions by opening the file once.

2 Likes