11-08-2020
11:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
11-08-2020
11:17 PM
If you want to include the plane from partfiles named "testfile.ipt" you could just traverse all LeafOccurrences in the assembly. I think this should be enough to get the result you want ![]()
Sub SetIncludeStatusFromAsm()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
Set oSheet = oDrawDoc.ActiveSheet
Dim oView As DrawingView
Set oView = oSheet.DrawingViews(1)
Dim oAsm As AssemblyDocument
Set oAsm = oView.ReferencedDocumentDescriptor.ReferencedDocument
Dim intWorkplane As Integer
intWorkplane = 1
Dim strFileName As String
strFileName = "testfile.ipt"
Dim oOcc As ComponentOccurrence
Dim oDoc As Document
For Each oOcc In oAsm.ComponentDefinition.Occurrences.AllLeafOccurrences
Set oDoc = oOcc.ReferencedDocumentDescriptor.ReferencedDocument
If Right(oDoc.FullFileName, Len(oDoc.FullFileName) - InStrRev(oDoc.FullFileName, "\")) = strFileName Then
Dim oWP As WorkPlane
Set oWP = oDoc.ComponentDefinition.WorkPlanes(intWorkplane)
Dim oWPprox As WorkPlaneProxy
Call oOcc.CreateGeometryProxy(oWP, oWPprox)
Call oView.SetIncludeStatus(oWPprox, True)
End If
Next
End Sub
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website