Features
All Creo Parametric solid models are made up of features. This section describes how to program on the feature level using the VB API.
Access to Features
Methods and Properties Introduced:
  • IpfcFeature.ListChildren()
  • IpfcFeature.ListParents()
  • IpfcFeature.GroupDirectHeader
  • IpfcFeatureGroup.GroupLeader
  • IpfcFeaturePattern.PatternLeader
  • IpfcFeaturePattern.ListMembers()
  • IpfcSolid.ListFailedFeatures()
  • IpfcSolid.ListFeaturesByType()
  • IpfcSolid.GetFeatureById()
  • IpfcBaseSession.QueryFeatureEdit()
  • The methods IpfcFeature.ListChildren() and IpfcFeature.ListParents() return a sequence of features that contain all the children or parents of the specified feature.
    The property IpfcFeature.GroupDirectHeader returns the direct header of the group.
    To get the first feature in the specified group access the property IpfcFeatureGroup.GroupLeader.
    The property IpfcFeaturePattern.PatternLeader and the method IpfcFeaturePattern.ListMembers() return features that make up the specified feature pattern. See the section Feature Groups and Patterns for more information on feature patterns.
    The method IpfcSolid.ListFailedFeatures() returns a sequence that contains all the features that failed regeneration.
    The method IpfcSolid.ListFeaturesByType() returns a sequence of features contained in the model. You can specify which type of feature to collect by passing in one of the EpfcFeatureType enumeration objects, or you can collect all features by passing void null as the type. If you list all features, the resulting sequence will include invisible features that Creo Parametric creates internally. Internal features are invisible features used internally for construction purposes. Use the method’s VisibleOnly argument to exclude them. If the argument VisibleOnly is True, the function lists the public features only. If the argument is False, the function lists both public and internal features.
    The method IpfcSolid.GetFeatureById() returns the feature object with the corresponding integer identifier.
    A feature can be edited with the Edit Definition command in Creo Parametric. The method IpfcBaseSession.QueryFeatureEdit( returns a list of all the features that are currently being edited by the Edit Definition command.
    Feature Information
    Properties Introduced:
  • IpfcFeature.FeatType
  • IpfcFeature.Status
  • IpfcFeature.IsVisible
  • IpfcFeature.IsReadonly
  • IpfcFeature.IsEmbedded
  • IpfcFeature.Number
  • IpfcFeature.FeatTypeName
  • IpfcFeature.FeatSubType
  • IpfcRoundFeat.IsAutoRoundMember
  • The enumeration classes EpfcFeatureType and EpfcFeatureStatus provide information for a specified feature. The following properties specify this information:
    •  IpfcFeature.FeatType—Returns the type of a feature.
    •  IpfcFeature.Status—Returns whether the feature is suppressed, active, or failed regeneration.
    The other properties that gather feature information include the following:
    •  IpfcFeature.IsVisible—Identifies whether the specified feature will be visible on the screen. The method distinguishes visible features from internal features. Internal features are invisible features used for construction purposes.
    •  IpfcFeature.IsReadonly—Identifies whether the specified feature can be modified.
    •  IpfcFeature.IsEmbedded—Specifies whether the specified feature is an embedded datum.
    •  IpfcFeature.Number—Returns the feature regeneration number. This method returns void null if the feature is suppressed.
    The property IpfcFeature.FeatTypeName returns a string representation of the feature type.
    The property IpfcFeature.FeatSubType returns a string representation of the feature subtype, for example, "Extrude" for a protrusion feature.
    The property IpfcRoundFeat.IsAutoRoundMember determines whether the specified round feature is a member of an Auto Round feature.
    Feature Operations
    Methods and Properties Introduced:
  • IpfcSolid.ExecuteFeatureOps()
  • IpfcFeature.CreateSuppressOp()
  • IpfcSuppressOperation.Clip
  • IpfcSuppressOperation.AllowGroupMembers
  • IpfcSuppressOperationAllowChildGroupMembers
  • IpfcFeature.CreateDeleteOp
  • IpfcDeleteOperation.Clip
  • IpfcDeleteOperation.AllowGroupMembers
  • IpfcDeleteOperation.AllowChildGroupMembers
  • IpfcDeleteOperation.KeepEmbeddedDatums
  • IpfcFeatureCreateResumeOp
  • IpfcResumeOperation.WithParents
  • IpfcFeature.CreateReorderBeforeOp
  • IpfcReorderBeforeOperation.BeforeFeat
  • IpfcFeature.CreateReorderAfterOp
  • IpfcReorderAfterOperation.AfterFeat
  • The method IpfcSolid.ExecuteFeatureOps() causes a sequence of feature operations to run in order. Feature operations include suppressing, resuming, reordering, and deleting features. The optional IpfcRegenInstructions argument specifies whether the user will be allowed to fix the model if a regeneration failure occurs.
    Note
    Regenerating models in resolve_mode is not supported. As a result, the method IpfcSolid.ExecuteFeatureOps() is not supported anymore.
    You can create an operation that will delete, suppress, reorder, or resume certain features using the methods in the classIpfcFeature. Each created operation must be passed as a member of the IpfcFeatureOperations object to the method IpfcSolid.ExecuteFeatureOps().
    Some of the operations have specific options that you can modify to control the behavior of the operation:
    •  Clip—Specifies whether to delete or suppress all features after the selected feature. By default, this option is false.
    Use the properties IpfcDeleteOperation.Clip and IpfcSuppressOperation.Clip to modify this option.
    •  AllowGroupMembers—If this option is set to true and if the feature to be deleted or suppressed is a member of a group, then the feature will be deleted or suppressed out of the group. If this option is set to false, then the entire group containing the feature is deleted or suppressed. By default, this option is false. It can be set to true only if the option Clip is set to true.
    Use the properties IpfcSuppressOperation.AllowGroupMembers and IpfcDeleteOperation.AllowGroupMembers to modify this option.
    •  AllowChildGroupMembers—If this option is set to true and if the children of the feature to be deleted or suppressed are members of a group, then the children of the feature will be individually deleted or suppressed out of the group. If this option is set to false, then the entire group containing the feature and its children is deleted or suppressed. By default, this option is false. It can be set to true only if the options Clip and AllowGroupMembers are set to true.
    Use the properties IpfcSuppressOperation.AllowChildGroupMembers and IpfcDeleteOperation.AllowChildGroupMembers to modify this option.
    •  KeepEmbeddedDatums—Specifies whether to retain the embedded datums stored in a feature while deleting the feature. By default, this option is false.
    Use the property IpfcDeleteOperation.KeepEmbeddedDatums to modify this option.
    •  WithParents—Specifies whether to resume the parents of the selected feature.
    Use the property IpfcResumeOperation.WithParents to modify this option.
    •  BeforeFeat—Specifies the feature before which you want to reorder the features.
    Use the property IpfcReorderBeforeOperation.BeforeFeat to modify this option.
    •  AfterFeat—Specifies the feature after which you want to reorder the features.
    Use the property IpfcReorderAfterOperation.AfterFeat to modify this option.
    Feature Groups and Patterns
    Patterns are treated as features in Creo Parametric. A feature type, FEATTYPE_PATTERN_HEAD, is used for the pattern header feature.
    Note
    The pattern header feature is not treated as a leader or a member of the pattern by the methods described in the following section.
    Methods and Properties Introduced:
  • IpfcFeature.Group
  • IpfcFeature.Pattern
  • IpfcFeature.GetPatternByType()
  • IpfcFeature.PatternStatus
  • IpfcFeature.GroupStatus
  • IpfcFeature.GroupPatternStatus
  • IpfcSolid.CreateLocalGroup
  • IpfcFeatureGroup.Pattern
  • IpfcFeatureGroup.GroupLeader()
  • IpfcFeaturePattern.PatternLeader
  • IpfcFeaturePattern.ListMembers()
  • IpfcFeaturePattern.Delete()
  • The property IpfcFeature.Group returns a handle to the local group that contains the specified feature.
    To get the first feature in the specified group call the property IpfcFeatureGroup.GroupLeader.
    The property IpfcFeaturePattern.PatternLeader and the method IpfcFeaturePattern.ListMembers() return features that make up the specified feature pattern.
    A pattern is composed of a pattern header feature and a number of member features. You can pattern only a single feature. To pattern several features, create a local group and pattern this group.
    You can also create a pattern of pattern. This creates a multiple level pattern. From Creo Parametric2.0 M170 onward, for a pattern of pattern, the method IpfcFeaturePattern.ListMembers() returns all the pattern header features created at the first level.
    For example, consider a model where a pattern of pattern has been created. The model tree is as shown below:
    Image
    The method IpfcFeaturePattern.ListMembers() returns the pattern header features with following IDs for a pattern of pattern:
    •  119
    •  177
    •  221
    •  265
    The properties IpfcFeature.Pattern and IpfcFeatureGroup.Pattern return the IpfcFeaturePattern object that contains the corresponding IpfcFeature or IpfcFeatureGroup. Use the method IpfcSolid.CreateLocalGroup() to take a sequence of features and create a local group with the specified name. To delete a IpfcFeaturePattern object, call the method IpfcFeaturePattern.Delete().
    The method IpfcFeature.GetPatternByType() returns the pattern of the feature and is specified using the enumerated data type EpfcPatternType. The valid values are:
    •  EpfcPATTERN_FEAT—Feature pattern.
    •  EpfcPATTERN_GROUP—Group pattern.
    The property IpfcFeature.PatternStatus returns the pattern status of the feature and is specified using the enumerated data type EpfcPatternStatus. The valid values are:
    •  EpfcGRP_PATTERN_NONE—Feature does not belong to any pattern.
    •  EpfcGRP_PATTERN_LEADER—Feature is leader of the pattern.
    •  EpfcGRP_PATTERN_MEMBER—Feature is member of the pattern.
    •  EpfcGRP_PATTERN_HEADER—Feature is header of the pattern.
    The property IpfcFeature.GroupStatus returns the group status of the feature and is specified using the enumerated data type EpfcGroupStatus. The valid values are:
    •  EpfcGROUP_NONE—Feature does not belong to any group.
    •  EpfcGROUP_MEMBER—Feature is member of the group.
    The property IpfcFeature.GroupPatternStatus returns the group pattern status of the feature and is specified using the enumerated data type EpfcGroupPatternStatus. The valid values are:
    •  EpfcGRP_PATTERN_NONE—Feature does not belong to any group pattern.
    •  EpfcGRP_PATTERN_LEADER—Feature is leader of the group pattern.
    •  EpfcGRP_PATTERN_MEMBER—Feature is member of the group pattern.
    •  EpfcGRP_PATTERN_HEADER—Feature is header of the group pattern.
    Notes On Feature Groups
    Feature groups have a group header feature, which shows up in the model information and feature list for the model. This feature will be inserted in the regeneration list to a position just before the first feature in the group.
    The results of the header feature are as follows:
    •  Models that contain groups will get one extra feature in the regeneration list, of type EpfcFEATTYPE_GROUP_HEAD. This affects the feature numbers of all subsequent features, including those in the group.
    •  Each group automatically contains the header feature in the list of features returned from IpfcFeatureGroup.ListMembers().
    •  Each group automatically gets the group head feature as the leader. This is returned from IpfcFeatureGroup.GroupLeader.
    •  Each group pattern contains a series of groups, and each group in the pattern will be similarly constructed.
    User Defined Features
    Groups in Creo Parametric represent sets of contiguous features that act as a single feature for specific operations. Individual features are affected by most operations while some operations apply to an entire group:
    •  Suppress
    •  Delete
    •  Layers
    •  Patterning
    User defined Features (UDFs) are groups of features that are stored in a file. When a UDF is placed in a new model the created features are automatically assigned to a group. A local group is a set of features that have been specifically assigned to a group to make modifications and patterning easier.
    Note
    All methods in this section can be used for UDFs and local groups.
    Read Access to Groups and User Defined Features
    Methods and Properties Introduced:
  • IpfcFeatureGroup.UDFName
  • IpfcFeatureGroup.UDFInstanceName
  • IpfcFeatureGroup.ListUDFDimensions()
  • IpfcUDFDimension.GetUDFDimensionName
  • User defined features (UDF’s) are groups of features that can be stored in a file and added to a new model. A local group is similar to a UDF except it is available only in the model in which is was created.
    The property IpfcFeatureGroup.UDFName provides the name of the group for the specified group instance. A particular group definition can be used more than once in a particular model.
    If the group is a family table instance, the property IpfcFeatureGroup.UDFInstanceName supplies the instance name.
    The method IpfcFeatureGroup.ListUDFDimensions() traverses the dimensions that belong to the UDF. These dimensions correspond to the dimensions specified as variables when the UDF was created. Dimensions of the original features that were not variables in the UDF are not included unless the UDF was placed using the Independent option.
    The property IpfcUDFDimension.GetUDFDimensionName provides access to the dimension name specified when the UDF was created, and not the name of the dimension in the current model. This name is required to place the UDF programmatically using the method IpfcSolid.CreateUDFGroup().
    Creating Features from UDFs
    Method Introduced:
  • IpfcSolid.CreateUDFGroup()
  • The method IpfcSolid.CreateUDFGroup() is used to create new features by retrieving and applying the contents of an existing UDF file. It is equivalent to the Creo Parametric command Feature, Create, User Defined.
    To understand the following explanation of this method, you must have a good knowledge and understanding of the use of UDF’s in Creo Parametric. PTC recommends that you read about UDF’s in the Creo Parametric help, and practice defining and using UDF’s in Creo Parametric before you attempt to use this method.
    When you create a UDF interactively, Creo Parametric prompts you for the information it needs to fix the properties of the resulting features. When you create a UDF from the VB API, you can provide some or all of this information programmatically by filling several compact data classes that are inputs to the method IpfcSolid.CreateUDFGroup.
    During the call to IpfcSolid.CreateUDFGroup(), Creo Parametric prompts you for the following:
    •  Information required by the UDF that was not provided in the input data structures.
    •  Correct information to replace erroneous information
    Such prompts are a useful way of diagnosing errors when you develop your application. This also means that, in addition to creating UDF’s programmatically to provide automatic synthesis of model geometry, you can also use pfcSolid.CreateUDFGroup() to create UDF’s semi-interactively. This can simplify the interactions needed to place a complex UDF making it easier for the user and less prone to error.
    Creating UDFs
    Creating a UDF requires the following information:
    •  Name—The name of the UDF you are creating and the instance name if applicable.
    •  Dependency—Specify if the UDF is independent of the UDF definition or is modified by the changers made to it.
    •  Scale—How to scale the UDF relative to the placement model.
    •  Variable Dimension—The new values of the variables dimensions and pattern parameters, those whose values can be modified each time the UDF is created.
    •  Dimension Display—Whether to show or blank non-variable dimensions created within the UDF group.
    •  References—The geometrical elements that the UDF needs in order to relate the features it contains to the existing models features. The elements correspond to the picks that Creo Parametric prompts you for when you create a UDF interactively using the prompts defined when the UDF was created. You cannot select an embedded datum as the UDF reference.
    •  Parts Intersection—When a UDF that is being created in an assembly contains features that modify the existing geometry you must define which parts are affected or intersected. You also need to know at what level in an assembly each intersection is going to be visible.
    •  Orientations—When a UDF contains a feature with a direction that is defined in respect to a datum plane Creo Parametric must know what direction the new feature will point to. When you create such a UDF interactively Creo Parametric prompt you for this information with a flip arrow.
    •  Quadrants—When a UDF contains a linearly placed feature that references two datum planes to define it’s location in the new model Creo Parametric prompts you to pick the location of the new feature. This is determined by which side of each datum plane the feature must lie. This selection is referred to as the quadrant because the are four possible combinations for each linearly place feature.
    To pass all the above values to Creo Parametric, the VB API uses a special class that prepares and sets all the options and passes them to Creo Parametric.
    Creating Interactively Defined UDFs
    Method Introduced:
  • CCpfcUDFPromptCreateInstructions.Create()
  • This static method is used to create an instructions object that can be used to prompt a user for the required values that will create a UDF interactively.
    Creating a Custom UDF
    Method Introduced:
  • CCpfcUDFCustomCreateInstructions.Create()
  • This method creates a IpfcUDFCustomCreateInstructions object with a specified name. To set the UDF creation parameters programmatically you must modify this object as described below. The members of this class relate closely to the prompts Creo Parametric gives you when you create a UDF interactively. PTC recommends that you experiment with creating the UDF interactively using Creo Parametric before you write the the VB API code to fill the structure.
    Setting the Family Table Instance Name
    Property Introduced:
  • IpfcUDFCustomCreateInstructions.InstanceName
  • If the UDF contains a family table, this field can be used to select the instance in the table. If the UDF does not contain a family table, or if the generic instance is to be selected, the do not set the string.
    Setting Dependency Type
    Property Introduced:
  • IpfcUDFCustomCreateInstructions.DependencyType
  • The EpfcUDFDependencyType object represents the dependency type of the UDF. The choices correspond to the choices available when you create a UDF interactively. This enumerated type takes the following values:
    •  EpfcUDFDEP_INDEPENDENT
    •  EpfcUDFDEP_DRIVEN
    Note
    EpfcUDFDEP_INDEPENDENT is the default value, if this option is not set.
    Setting Scale and Scale Type
    Properties Introduced:
  • IpfcUDFCustomCreateInstructions.ScaleType
  • IpfcUDFCustomCreateInstructions.Scale
  • The property IpfcUDFCustomCreateInstructions.ScaleType specifies the length units of the UDF in the form of the EpfcUDFScaleType object. This enumerated type takes the following values:
    •  EpfcUDFSCALE_SAME_SIZE
    •  EpfcUDFSCALE_SAME_DIMS
    •  EpfcUDFSCALE_CUSTOM
    •  EpfcUDFSCALE_nil
    Note
    The default value is EpfcUDFSCALE_SAME_SIZE if this option is not set.
    The property IpfcUDFCustomCreateInstructions.Scale specifies the scale factor. If the ScaleType is set to EpfcUDFSCALE_CUSTOM, the property IpfcUDFCustomCreateInstructions.Scale assigns the user defined scale factor. Otherwise, this attribute is ignored.
    Setting the Appearance of the Non UDF Dimensions
    Property Introduced:
  • IpfcUDFCustomCreateInstructions.DimDisplayType
  • The object EpfcUDFDimensionDisplayType sets the options in Creo Parametric for determining the appearance in the model of UDF dimensions and pattern parameters that were not variable in the UDF, and therefore cannot be modified in the model. This enumerated type takes the following values:
    •  EpfcUDFDISPLAY_NORMAL
    •  EpfcUDFDISPLAY_READ_ONLY
    •  EpfcUDFDISPLAY_BLANK
    Note
    The default value is EpfcUDFDISPLAY_NORMAL if this option is not set.
    Setting the Variable Dimensions and Parameters
    Methods and Properties Introduced:
  • IpfcUDFCustomCreateInstructions.VariantValues
  • CCpfcUDFVariantDimension.Create()
  • CCpfcUDFVariantPatternParam.Create()
  • IpfcUDFVariantValues class represents an array of variable dimensions and pattern parameters.
    CCpfcUDFVariantDimension.Create() is a static method creating a IpfcUDFVariantDimension. It accepts the following parameters:
    •  Name—The symbol that the dimension had when the UDF was originally defined not the prompt that the UDF uses when it is created interactively. To make this name easy to remember, before you define the UDF that you plan to create with the VB API, you should modify the symbols of all the dimensions that you want to select to be variable. If you get the name wrong, IpfcSolid.CreateUDFGroup() will not recognize the dimension and prompts the user for the value in the usual way does not modify the value.
    •  DimensionValue—The new value.
    If you do not remember the name, you can find it by creating the UDF interactively in a test model, then using the IpfcFeatureGroup.ListUDFDimensions and IpfcUDFDimension.GetUDFDimensionName to find out the name.
    CCpfcUDFVariantPatternParam.Create() is a static method which creates a IpfcUDFVariantPatternParam. It accepts the following parameters:
    •  name—The string name that the pattern parameter had when the UDF was originally defined
    •  patternparam—The new value.
    After the IpfcUDFVariantValues object has been compiled, use IpfcUDFCustomCreateInstructions.VariantValues to add the variable dimensions and parameters to the instructions.
    Setting the User Defined References
    Methods and Properties Introduced:
  • CCpfcUDFReference.Create()
  • IpfcUDFReference.IsExternal
  • IpfcUDFReference.ReferenceItem
  • IpfcUDFCustomCreateInstructions.References
  • The method CCpfcUDFReference.Create() is a static method creating a IpfcUDFReference object. It accepts the following parameters:
    •  PromptForReference—The prompt defined for this reference when the UDF was originally set up. It indicates which reference this structure is providing. If you get the prompt wrong, pfcSolid.CreateUDFGroup() will not recognize it and prompts the user for the reference in the usual way.
    •  ReferenceItem—Specifies the IpfcSelection object representing the referenced element. You can set Selection programmatically or prompt the user for a selection separately. You cannot set an embedded datum as the UDF reference.
    There are two types of reference:
      Internal—The referenced element belongs directly to the model that will contain the UDF. For an assembly, this means that the element belongs to the top level.
      External—The referenced element belongs to an assembly member other than the placement member.
    To set the reference type, use the property IpfcUDFReference.IsExternal.
    To set the item to be used for reference, use the property IpfcUDFReference.ReferenceItem.
    After the IpfcUDFReferences object has been set, use IpfcUDFCustomCreateInstructions.References to add the program-defined references.
    Setting the Assembly Intersections
    Methods and Properties Introduced:
  • CCpfcUDFAssemblyIntersection.Create()
  • IpfcUDFAssemblyIntersection.InstanceNames
  • IpfcUDFCustomCreateInstructions.Intersections
  • CCpfcUDFAssemblyIntersection.Create() is a static method creating a IpfcUDFReference object. It accepts the following parameters:
    •  ComponentPath—Is an intseq type object representing the component path of the part to be intersected.
    •  Visibility level—The number that corresponds to the visibility level of the intersected part in the assembly. If the number is equal to the length of the component path the feature is visible in the part that it intersects. If Visibility level is 0, the feature is visible at the level of the assembly containing the UDF.
    IpfcUDFAssemblyIntersection.InstanceNames sets an array of names for the new instances of parts created to represent the intersection geometry. This property accepts the following parameters:
    •  instance names—is a com.ptc.cipjava.stringseq type object representing the array of new instance names.
    After the IpfcUDFAssemblyIntersections object has been set, use IpfcUDFCustomCreateInstructions.Intersections to add the assembly intersections.
    Setting Orientations
    Properties Introduced:
  • IpfcUDFCustomCreateInstructions.Orientations
  • IpfcUDFOrientations class represents an array of orientations that provide the answers to Creo Parametric prompts that use a flip arrow. Each term is a EpfcUDFOrientation object that takes the following values:
    •  EpfcUDFORIENT_INTERACTIVE—Prompt for the orientation using a flip arrow.
    •  EpfcUDFORIENT_NO_FLIP—Accept the default flip orientation.
    •  EpfcUDFORIENT_FLIP—Invert the orientation from the default orientation.
    The order of orientations should correspond to the order in which Creo Parametric prompts for them when the UDF is created interactively. If you do not provide an orientation that Creo Parametric needs, it uses the default value NO_FLIP.
    After the IpfcUDFOrientations object has been set use IpfcUDFCustomCreateInstructions.Orientation to add the orientations.
    Setting Quadrants
    Property Introduced:
  • IpfcUDFCustomCreateInstructions.Quadrants
  • The property IpfcUDFCustomCreateInstructions.Quadrants sets an array of points, which provide the X, Y, and Z coordinates that correspond to the picks answering the Creo Parametric prompts for the feature positions. The order of quadrants should correspond to the order in which Creo Parametric prompts for them when the UDF is created interactively.
    Setting the External References
    Property Introduced:
  • IpfcUDFCustomCreateInstructions.ExtReferences
  • The property IpfcUDFCustomCreateInstructions.ExtReferences sets an external reference assembly to be used when placing the UDF. This will be required when placing the UDF in the component using references outside of that component. References could be to the top level assembly of another component.
    Example Code 1
    The sample code in the file pfcFeaturesExamples.vb located at <creo_vbapi_loadpoint>/vbapi_examples copies of a node UDF at a particular coordinate system location in a part. The node UDF is a spherical cut centered at the coordinate system whose diameter is driven by the 'diam' argument to the method..
    Example Code 2
    The sample code in the file pfcFeaturesExamples.vb located at <creo_vbapi_loadpoint>/vbapi_examples places copies of a hole UDF at a particular location in an assembly. The hole is embedded in a surface of one of the assembly's components, and placed a particular location away from two normal datum planes (the default value for the dimension is used for this example). The UDF creation requires a quadrant determining the location for the UDF (since it could be one of four areas) and intersection instructions for the assembly members (this example makes the hole visible down to the part level). The method returns the IpfcFeatureGroup object created.