iLogic - Determine hole pattern element's hole feature

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Problem: Given a hole pattern (rectangular, circular, or mirror) containing different sizes of holes, determine the corresponding hole feature for every element in the pattern.
Background:
I am trying to catalog all of the holes in a part by their size and center point coordinates, and of course I have to handle patterns. There is already a solution to count holes in patterns and determining the size of holes in a homogeneous pattern (only one hole feature in the pattern) is trivial. However, I cannot figure out how to determine the size of a hole in a pattern when it is made up of multiple different hole features (non-homogeneous).
Discussion:
The problem with the sample code below for non-homogeneous patterns is in the following snippet:
Dim hole as HoleFeature = mirror.ParentFeatures.Item(1)
The index on the Item method (1 in this case) is what selects the hole feature that was patterned. For a hole pattern with two different hole features this index can be 1 or 2. The sample code below works fine for a homogeneous pattern because the hole variable is always the same. However, for a non-homogeneous pattern, that variable must change or else the code thinks the pattern is homogeneous. What is the relationship between the Item method's index value and the current element? From the API there doesn't appear to be any code that relates the two.
Sample Code for Homogeneous Pattern:
For Each mirror As MirrorFeature In part.Definition.Features.MirrorFeatures If Not mirror.Suppressed Then If (TypeOf mirror.ParentFeatures.Item(1) Is HoleFeature) Then
Dim hole as HoleFeature = mirror.ParentFeatures.Item(1) For j = 1 to mirror.PatternElements.count dim element as FeaturePatternElement element = mirror.PatternElements.item(j) If Not element.Suppressed Then ' Get hole position
' Get hole size End If next j End If End If Next mirror