Calling ProFeatureCreate()
Function introduced:
The syntax of
ProFeatureCreate() is as follows:
ProError ProFeatureCreate (
ProSelection model, /* (In) The part on which the
feature is being
created. If the feature
is created in an
assembly, you must
specify the component
path. */
ProElement elemtree, /* (In) The element tree. */
ProFeatureCreateOptions options[], /* (In) An array of user
options. */
int num_opts, /* (In) The number of options
in the options array. */
ProFeature *p_feature, /* (Out) The feature handle. */
ProErrorlist *p_errors /* (Out) The list of errors. */
)
The first input argument to
ProFeatureCreate() identifies the solid that is to contain the new feature. This is expressed in the form of a
ProSelection object.
|
Note:
|
The ProSelection object input to ProFeatureCreate(), and all the ProSelection objects assigned to elements in the feature element tree, must all refer to the same root assembly.
|
The second input argument is the ProElement object that forms the root of the feature element tree.
The next two inputs are an array of creation options and the size of the array. The creation options specify what
ProFeatureCreate()should do if the element tree is incomplete, or if the geometry cannot be constructed. Each option is one of the following values of the enumerated type
ProFeatureCreateOptions:
• PRO_FEAT_CR_NO_OPTS—No options were chosen.
• PRO_FEAT_CR_DEFINE_MISS_ELEMS—Prompt the user to complete the feature if any elements are missing.
• PRO_FEAT_CR_INCOMPLETE_FEAT—Create the feature, even if some elements are missing. The feature will appear in the feature list and model tree, but will not be used in regeneration.
• PRO_FEAT_CR_FIX_MODEL_ON_FAIL—If the feature geometry cannot be constructed, prompt the user to fix the problem.
If no options are needed, you can set the array to
NULL, and the size to zero. If you do not specify any options,
ProFeatureCreate() fails and reports errors if the element tree is incomplete, or if the geometry cannot be constructed.
To check whether a feature is incomplete, use the function
ProFeatureIsIncomplete().
The next argument is an output that provides a ProFeature object that identifies the newly created feature.
The final argument is an output that reports errors found in the feature element tree. This is designed as an aid to application developers because it is reporting errors that occur only as a result of incorrect application code; it is not designed as a way of reporting errors to the user. The errors are written to a structure called ProErrorlist whose declaration, in ProItemerr.h, is as follows:
typedef struct
{
ProItemerror *error_list;
int error_number;
} ProErrorlist;
typedef struct
{
int err_item_id;
ProErritemType err_item_type;
ProError error;
} ProItemerror;
typedef enum ProErritemTypes
{
PRO_ERRITEM_NONE = -1,
PRO_ERRITEM_FEATELEM = 1
} ProErritemType;
The field
error_list is an array of all the errors in the feature element tree found by
ProFeatureCreate(). Each error has a value expressed in terms of the standard error type
ProError, and can refer to an element of a specified identifier, or be a more general error.
|
Note:
|
• There are many useful utilities located in the sample code under the loadpoint. Utilities such as ProUtilElementtreePrint() are particularly useful when building and debugging element trees.
|