cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Group features using VB api

Highlighted
Regular Member

Group features using VB api

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

2 REPLIES 2

Re: Group features using VB api

In general, if anyone has a solution or example on using the CreateLocalGroup function it would be much apprechiated if that could be shared. 

Highlighted

Re: Group features using VB api

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.

Announcements