link_base_pt = link_coll.OfClass(BasePoint).ToElements()
# print(link_base_pt)
link_Projbase_pt = link_base_pt[1]
linkProjBasePt = []
a = link_Projbase_pt.Category.Name
# print(a)
if a == 'Project Base Point':
lpbpEW = link_Projbase_pt.LookupParameter('E/W')
lpbpNS = link_Projbase_pt.LookupParameter('N/S')
lpbpElev = link_Projbase_pt.LookupParameter("Elev")
lpbpAngle = link_Projbase_pt.LookupParameter('Angle to True North')
linkProjBasePt.append(format_length(lpbpEW.AsDouble()))
linkProjBasePt.append(format_length(lpbpNS.AsDouble()))
linkProjBasePt.append(format_length(lpbpElev.AsDouble()))
linkProjBasePt.append(str(round(lpbpAngle.AsDouble() * 180/math.pi,6)))
linkProjBasePt_final = linkProjBasePt
# print(linkProjBasePt_final)
link_SurvPt = link_base_pt[0]
linkSurveyPt = []
b = link_SurvPt.Category.Name
# print(b)
if b == 'Survey Point':
lpbpEW = link_SurvPt.LookupParameter('E/W')
lpbpNS = link_SurvPt.LookupParameter('N/S')
lpbpElev = link_SurvPt.LookupParameter("Elev")
linkSurveyPt.append(format_length(lpbpEW.AsDouble()))
linkSurveyPt.append(format_length(lpbpNS.AsDouble()))
linkSurveyPt.append(format_length(lpbpElev.AsDouble()))
linkSurveyPt_final = linkSurveyPt
# print(linkSurveyPt_str) **
Hello
Can you explain better your problem, is there an error? Coordinates are incorrect?
I am not able to acquire the Project Base Point parameter values and Survey Point parameter values from Linked Revit Files in Revit 2020 using the same piece of python code I use in Revit 2019.
try with GetProjectPosition method
here an example
import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
#import net library
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
#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
allInstance = FilteredElementCollector(doc).OfClass(RevitLinkInstance).WhereElementIsNotElementType().ToElements()
out = []
for inst in allInstance:
d = inst.GetLinkDocument()
link_base_pt = FilteredElementCollector(d).OfClass(BasePoint).ToElements()
temp = [d.Title]
for pt in link_base_pt:
if pt.Category.Id == ElementId(BuiltInCategory.OST_ProjectBasePoint):
pos = d.ActiveProjectLocation.GetProjectPosition( XYZ.Zero )
lpbpEW = pos.EastWest
lpbpNS = pos.NorthSouth
lpbpElev = pos.Elevation
lpbpAngle = pos.Angle
else:
lpbpEW = pt.get_Parameter(BuiltInParameter.BASEPOINT_EASTWEST_PARAM).AsDouble()
lpbpNS = pt.get_Parameter(BuiltInParameter.BASEPOINT_NORTHSOUTH_PARAM).AsDouble()
lpbpElev = pt.get_Parameter(BuiltInParameter.BASEPOINT_ELEVATION_PARAM).AsDouble()
lpbpAngle = None
temp.append(pt.Category.Name)
temp.append([lpbpEW, lpbpNS, lpbpElev, lpbpAngle])
out.append(temp)
OUT = out
2 Likes