-
Re: Get seed component name of given pattern instance component
Raghvendra Bhargava Mar 28, 2017 10:46 PM (in response to Jana Stahn)Hi Jana,
Select part1<3>, use IsPatternInstance Method (IComponent2). if This property will return True get the name of the component.
Thanks
-
Re: Get seed component name of given pattern instance component
Jana Stahn Mar 29, 2017 2:13 AM (in response to Raghvendra Bhargava)This does not help at all. This only gives me the name of the given component (in this case, "part1-3"). What I want is the name of the seed component (in this case, "part1-1").
-
-
Re: Get seed component name of given pattern instance component
Jana Stahn Apr 4, 2017 10:30 AM (in response to Jana Stahn)Let's call the given component "comp".
Let's call the assembly in which both the given and the sought component reside "assy".
1. Retrieve either the IAssemblyDoc of assy or the IComponent2 that represents assy. Let's call the retrieved object "assyObj".
2. Call assyObj.FeatureByName(comp.Name2). You get an IFeature "feat" as a result.
3. Call feat.GetParents(). You get an array of IFeatures "parentFeats". In the cases I had so far (linear component patterns), there were two parents: the pattern feature and the seed component feature.
5. Loop through parentFeats: For each IFeature "parent", check if it equals the name of comp except for all characters behind the last "-" (because these characters represent the instance number: "part1-3", "part1-1"). If yes, we have found the name of the seed component.