man2007
Aerospace
- Nov 6, 2007
- 283
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.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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
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
man2007 said:In that view, I select an edge or point-Is it possible to get the name of its parent part.
Google said:.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