美文网首页狮猿社CATIA
CATIA VBA 获取当前激活节点

CATIA VBA 获取当前激活节点

作者: 锦囊喵 | 来源:发表于2020-03-26 17:33 被阅读0次

    原文链接

    Sub CATMain()
    
        Dim doc As PartDocument
        Set doc = GetBluePosionPartDoc()
        
        Dim msg As String
        If doc Is Nothing Then
            msg = "There is no blue position PartDocument."
        Else
            msg = "The blue position PartDocument is " & doc.Name & " ."
        End If
        
        MsgBox msg
    
    End Sub
    
    Private Function GetBluePosionPartDoc() As PartDocument
        
        Set GetBluePosionPartDoc = Nothing
        
        Dim sel As selection
        Set sel = CATIA.ActiveDocument.selection
        
        CATIA.HSOSynchronized = False
        
        With sel
            .Clear
            .Search "CATPrtSearch.Plane,in"
            
            If .Count2 < 1 Then GoTo fin
            
            Set GetBluePosionPartDoc = .Item2(1).Value.Parent.Parent
            .Clear
        End With
        
    fin:
        CATIA.HSOSynchronized = True
        
    End Function 
    

    相关文章

      网友评论

        本文标题:CATIA VBA 获取当前激活节点

        本文链接:https://www.haomeiwen.com/subject/svncuhtx.html