Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hello,
I'm trying to create a method that can group any number of UDFGroups in a part. What i have below can find the correct UDFGroups, but once the .Append(feature) is run it returns an error. Have i thought about this the wrong way?
featureType: a string that specifies the wanted UDFgroup name.
nrOf: an int that specifies how many of the instances that should be appended.
public static void CreateGroup(string featureType, int nrOf)
{
IpfcFeatures selectedFeatures = null;
IpfcFeatures features;
features = componentModel.ListFeaturesByType(true,EpfcFeatureType.EpfcFEATTYPE_GROUP_HEAD);
//For each point
for (int i = 0; i <= nrOf; i++)
{
//Search in features
foreach (IpfcFeature feature in features)
{
if (feature.Group.GroupName == $"{featureType}{i}".ToUpper())
{
selectedFeatures.Append(feature); //<--- Error here
break;
}
}
}
componentModel.CreateLocalGroup((CpfcFeatures)selectedFeatures, $"{CatiaTreeModel.pointSet}");
}
Thanks for the help!
Regards
In general, if anyone has a solution or example on using the CreateLocalGroup function it would be much apprechiated if that could be shared.
I don‘t know your model structure but the ids must be contiguous.
Input Arguments:
solid - The part or assembly.
feat_ids - The Array of feature identifiers to be grouped.
They must be a contiguous set of features.
n_feats - The number of features to be grouped.
local_gp_name - The name to be assigned to the created local group.