- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Tom, thanks for your input! I made a quick script that runs the algorithm with your modifications as well as a screenshot of the output (See below). I believe it has the same issue as the one I described in my post. Once you get to the inner loop (j loop), in the code below, the PatternElement object has no information about the holes. Sure the outer loop (i loop) has the hole variable, but it isn't specific to the jth PatternElement. That is why it outputs all of the PatternElements twice, because there are two ParentFeatures. And I realized while making this script that the PatternElement object doesn't seem to know that there are two holes in each element. Which is why the PatternElement count is three and not six.
In the end I need the following information: There are 6 hole features in this pattern. Three of them are .25 in. diameter and their center points are x,y,z.... The other three are .75 in. diameter and their center points are x,y,z....
Sorry if this doesn't make sense. It is hard to explain.
Sample Code:
Sub Main() Dim part As Inventor.PartDocument = ThisDoc.Document Dim output As String = "" For Each pattern As RectangularPatternFeature In part.ComponentDefinition.Features.RectangularPatternFeatures If Not pattern.Suppressed Then output += "Found Pattern: " & pattern.Name & vbNewLine For i = 1 To pattern.ParentFeatures.Count output += "Parent Feature " & i & " of " & pattern.ParentFeatures.Count & ": " & pattern.ParentFeatures.Item(i).Name & vbNewLine If TypeOf pattern.ParentFeatures.Item(i) Is HoleFeature Then Dim hole As HoleFeature = pattern.ParentFeatures.Item(i) For j = 1 To pattern.PatternElements.Count If Not pattern.PatternElements.Item(j).Suppressed Then output += "Pattern Element " & j & " of " & pattern.PatternElements.Count & vbnewline End If Next j End If Next i End If Next pattern MessageBox.Show(output) End Sub
Output from sample code above: