- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Actually, this is the solution I was looking for. It was provided by Xiaodong Liang at the ADN.
Sub hideCurveOfDerivePart()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
Dim oView1 As DrawingView
Set oView1 = oSheet.DrawingViews(1)
Dim oModelDoc As Document
Set oModelDoc = oView1.ReferencedDocumentDescriptor.ReferencedDocument
If oModelDoc.DocumentType = kAssemblyDocumentObject Then
Dim oEachOcc As ComponentOccurrence
For Each oEachOcc In oModelDoc.ComponentDefinition.Occurrences
'native part document (this part has derived part)
If oEachOcc.ReferencedDocumentDescriptor.ReferencedDocument.DocumentType = kPartDocumentObject Then
Dim oNativePartDoc As PartDocument
Set oNativePartDoc = oEachOcc.ReferencedDocumentDescriptor.ReferencedDocument
'check if the document has derived part
If oNativePartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Count > 0 Then
'hide the occurrence in the context of the drawing view.
Call oView1.SetVisibility(oEachOcc, False)
End If
End If
Next
End If
End Sub