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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Group features using VB api

Joey
7-Bedrock

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
Joey
7-Bedrock
(To:Joey)

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

RPN
17-Peridot
17-Peridot
(To:Joey)

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


Top Tags