Changing Active Project Location / Project Base Point

Hello,
This might not be Dynamo related but I was hoping you guys could help as I am pretty lost in trying to understand. I used the python code from this post to check the project locations between a project and a linked instance inside the project and found that the doc.ActiveProjectLocation differed in 100,000 in the E/W direction, but the project base point was the same.

In Revit, the linked instance lined up perfectly fine but when using Dynamo to get coordinates of elements in the linked instance, everything was off by that 100,000 and translate wasn’t an option.
locationIssue

I cannot figure out how to line up the two projects. The base points match so I don’t know if I should move them. Any help would be greatly appreciated!

Hi @kennyb6,

Just a thought : why don’t you use the CoordinateSystem transform of the link to retrieve the correct location of the linked elements ?

1 Like

Thanks for the response.
I should have added more info as context. This is in reference to my previous thread.
I am trying to use @Konrad_K_Sobon’s Elements in Space node which calls the Revit API IsPointInSpace method from the Space class. I may be misunderstanding but I didn’t think that would help. If I got the correct location, how would I use it to affect the space location from a linked instance? I can’t change the type to a different class or create a new element or else I lose the ability to use that method.

So I am trying to use the ActiveProjectLocation API property to change the project location of the current project to equal the project location of the linked project. This is my python script:

import clr
import math
# import Document Manager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

linkDoc = IN[0]
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

outLProjLoc = []
outProjLoc = []
ft2mm = 304.8

TransactionManager.Instance.EnsureInTransaction(doc)

linkprojLoc = linkDoc.ActiveProjectLocation
doc.ActiveProjectLocation = linkprojLoc

TransactionManager.Instance.TransactionTaskDone()

projLoc = doc.ActiveProjectLocation
origin = XYZ(0.0,0.0,0.0)

linkprojPos = linkprojLoc.get_ProjectPosition(origin)
projPos = projLoc.get_ProjectPosition(origin)

#Current Project's Location
if projPos == None:
outProjLoc.append("No Project Position at origin point")
else:
outProjLoc.append(round(projPos.EastWest * ft2mm,6))
outProjLoc.append(round(projPos.NorthSouth * ft2mm,6))

#Linked Project's Location
if linkprojPos == None:
outLProjLoc.append("No Project Position at origin point")
else:
outLProjLoc.append(round(linkprojPos.EastWest * ft2mm,6))
outLProjLoc.append(round(linkprojPos.NorthSouth * ft2mm,6))

OUT = [outProjLoc, outLProjLoc]

But it doesn’t change the current project location. There are no errors when running so I don’t know the problem.


Sorry that I still don’t have a sample revit file for this as I am still not fully understanding what the active project location is. The main thing I am wondering is why

TransactionManager.Instance.EnsureInTransaction(doc)

linkprojLoc = linkDoc.ActiveProjectLocation
doc.ActiveProjectLocation = linkprojLoc

TransactionManager.Instance.TransactionTaskDone()

does nothing. ActiveProjectLocation does have a set method so it should be possible, right?