Location of linked file

Hello, how do I find the location, (origin point) of a linked file in reference to the host model? I am trying to see if I can get the coordinates of the linked file like (0,0,0) or whatever. Thanks

1 Like

Hi @mix,

You can use the python script provided in this topic :

You just need to add an input after the line dataEnteringNode = IN
doc=IN[0]

Can I just set this number to 1 if I want it to be in feet? Or is there more to it than that? Sorry I dont know python yet :’(

To work in feets, it’s probably something like that :

import clr
import math
# import Document Manager
clr.AddReference("RevitServices")
import RevitServices 
from RevitServices.Persistence import DocumentManager
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 *

dataEnteringNode = IN
doc=IN[0]
outData = []
outProjBasePt = []
outProjSurvPt = []
outProjLoc = []

coll = FilteredElementCollector(doc)
basePt = coll.OfClass(BasePoint).ToElements()

projBasePt = None

for e in basePt:
	a = e.Category.Name
	if a == "Project Base Point":		
		pbpEW = e.LookupParameter("E/W")
		pbpNS = e.LookupParameter("N/S")
		pbpElev = e.LookupParameter("Elev")
		pbpAngle = e.LookupParameter("Angle to True North")
		outProjBasePt.append(round(pbpEW.AsDouble(),6))
		outProjBasePt.append(round(pbpNS.AsDouble(),6))
		outProjBasePt.append(round(pbpElev.AsDouble(),6))
		outProjBasePt.append(round(pbpAngle.AsDouble()*180/math.pi,6))
	elif a == "Survey Point":
		pspEW = e.LookupParameter("E/W")
		pspNS = e.LookupParameter("N/S")
		pspElev = e.LookupParameter("Elev")
		outProjSurvPt.append(round(pspEW.AsDouble(),6))
		outProjSurvPt.append(round(pspNS.AsDouble(),6))
		outProjSurvPt.append(round(pspElev.AsDouble(),6))

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

projPos = projLoc.get_ProjectPosition(origin)
if projPos == None:
	outProjLoc.append("No Project Position at origin point")
else:
	outProjLoc.append(round(projPos.EastWest,6))
	outProjLoc.append(round(projPos.NorthSouth,6))
	    	
OUT = [outProjLoc, outProjBasePt, outProjSurvPt]
2 Likes

Ok thanks! now what are each of these line items, and why are their four coordinates for a basepoint. shouldnt that only be 3 coordinates? XYZ? Also is the base point taken from how far it is from the survey point or what is it measured from?

The basepoint can have an angle with the true north, so it’s the 4th coordinate.

If you were in Autocad, the survey point will be the origin of the general UCS.
So yes, the base point is measured from the 0,0 of the survey point.

I copy pasted the python script you shared but it’s showing something this. also tried to switch between ironpython & Cpython3 but it’s same