Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
There are many examples of creating rectangular patterns, but not many, if any, of interrogating existing patterns.
I have attached the files and a screenshot of a rectangular part inside an assembly. The part contains a rectangular pattern of holes and workplanes.
My question is how do I get hold of each proxy of the workplane in the pattern?
In other words I don't know what to put in the for loop at the end of this code fragment:
If _invApp.Documents.Count = 0 Then MsgBox("Need to open an the assembly document") Return End If If _invApp.ActiveDocument.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then MsgBox("Need to have an Assembly document active") Return End If Dim asmDoc As AssemblyDocument asmDoc = _invApp.ActiveDocument Dim asmDef As AssemblyComponentDefinition asmDef = asmDoc.ComponentDefinition Dim occurrences As ComponentOccurrences occurrences = asmDef.Occurrences Dim partOcc As ComponentOccurrence ' partOcc = occurrences.ItemByName("Block-with-hole-pattern") partOcc = occurrences.Item(1) Dim pippo As PartComponentDefinition pippo = partOcc.Definition Dim features As PartFeatures features = pippo.Features Dim RecFeatures As RectangularPatternFeatures RecFeatures = features.RectangularPatternFeatures Dim RecPattern As RectangularPatternFeature RecPattern = RecFeatures.Item(1) Dim Xparam As Parameter Xparam = RecPattern.XCount Debug.Print("This pattern has " & Xparam.Value & " x elements") Dim i As Integer, j As Integer For i = 1 To Xparam.Value Debug.Print(i & " ") ' How to get hold of the proxy for the workplane in the pattern source? Next i
The fragment assumes you've opened the assembly attached.
Solved! Go to Solution.