×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Catia Macro: Get Parent of drawing view object

Catia Macro: Get Parent of drawing view object

Catia Macro: Get Parent of drawing view object

(OP)
I have created a drawing view of an assembly. In that view, I select an edge or point-Is it possible to get the name of its parent part. Or is it possible to get the point's actual 3D coordinates.

RE: Catia Macro: Get Parent of drawing view object

Quick code using the view...

CODE -->

Sub Draw()
    

    
    Dim oDrawing As DrawingDocument
    Set oDrawing = CATIA.ActiveDocument
    
  
    Dim oSheets As DrawingSheets
    Set oSheets = oDrawing.Sheets
    


    Dim oSheet As DrawingSheet
    Set oSheet = oSheets.Item(1)
    
    Dim oView As DrawingView
    Set oView = oSheet.Views.Item(3)
    oView.Activate



  Set ProductName = oView.GenerativeBehavior.Document.Parent 
  MsgBox ProductName.Name
    End Sub 

______

Alex ,

RE: Catia Macro: Get Parent of drawing view object

if views are link with sub element of product:

CODE --> VBA

Sub Draw()
    
    Dim oDrawing As DrawingDocument
    Set oDrawing = CATIA.ActiveDocument
    
    Dim oSheets As DrawingSheets
    Set oSheets = oDrawing.Sheets
    
    Dim oSheet As DrawingSheet
    Set oSheet = oSheets.Item(1)
    
    Dim oView As DrawingView
    Dim genLinks As Collection
    
    
    For i = 1 To oSheet.Views.Count - 2  'not checking background and main view
    
        Set oView = oSheet.Views.Item(i + 2)
        
        Set genLinks = ViewGenerativeLinks(oView)
        
        If genLinks.Count = 0 Then
           
            MsgBox (oView.Name & ": Isolated view")
            
        Else
            For U = 1 To genLinks.Count
                MsgBox (oView.Name & " link " & U & ": " & genLinks.Item(U).Name)
            Next U
        End If
    
    Next i

End Sub


Function ViewGenerativeLinks(oDrawingView As DrawingView) As Collection

    Dim result As New Collection
    
    On Error Resume Next
    
    Set oLink = oDrawingView.GenerativeLinks.FirstLink
    
    If Err.Number = 0 Then
        result.Add oLink
    End If
    
    While Err.Number = 0
        Set oLink = oDrawingView.GenerativeLinks.NextLink
        If Err.Number = 0 Then
            result.Add oLink
        End If
        
    Wend
    
    If result Is Not Empty Then
        Set ViewGenerativeLinks = result
    Else: Set ViewGenerativeLinks = Empty
    End If
    
End Function 

Eric N.
indocti discant et ament meminisse periti

RE: Catia Macro: Get Parent of drawing view object

I've been searching fot this issue

Quote (man2007)

In that view, I select an edge or point-Is it possible to get the name of its parent part.


Quote (Google)


.Restriction Explanation
Generative geometry object (genItem) is not
exposed by automation API, that's why it is not
possible to select it.
.
.By-Pass
Generative Geometry is only accessible by CAA
C++ interface

Please correct me if i am wrong.

______

Alex ,

RE: Catia Macro: Get Parent of drawing view object

(OP)
Thanks AlexLozoya and itsmyjob for your replies.

Yes, I was looking for "genItem", so that I can get the parent of the "genItem", which I feel, is not available in VBA library.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources