Revit 2020 中的项目基点和测量点

问题描述 投票:0回答:1

我正在尝试阅读 Revit 2020 中的链接项目基点/测量点 我正在尝试从 Revit 2020 中的 BasePoint 类获取“E/W”、“N/S”、“Elev”、“真北角度”。同样可以从 Revit 2019 中获取。

** Revit 2019提取项目基点/测量点的示例代码

        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)   **
revit-api revitpythonshell pyrevit
1个回答
0
投票

这对我有用

# get revit link instance from selection
linkInstance = UnwrapElement(IN[0]) 

# get link document and project locations from linked document
linkDoc = linkInstance.GetLinkDocument()
locationLinkSet = linkDoc.ProjectLocations

modulus = 0.0174532925199433 #modulus to convert to degrees (π/180)
inchToMm = 25.4 #to convert to mm
footToMm = 12 * inchToMm  #to convert to mm

#looking for "Internal" Project Location
for projectLocation in locationLinkSet:
    if projectLocation.Name == "Internal":
        origin = Autodesk.Revit.DB.XYZ(0, 0, 0)

        #get the project position
        pp = projectLocation.GetProjectPosition(origin)
        angle = (pp.Angle / modulus)   #Angle from True North, convert to degrees  
        eastWest = pp.EastWest  * footToMm     #East to West offset
        northSouth = pp.NorthSouth * footToMm   #North to south offset
        elevation = pp.Elevation * footToMm    #Elevation above ground level
© www.soinside.com 2019 - 2024. All rights reserved.