• | Element Trees: Datum Features |
• | Element Trees: Sketched Features |
• | Production Applications: Manufacturing |
• | ProElement |
• | ProElempath |
• | ProValue |
1. | Allocate the workspace structure. |
2. | Fill the workspace structure. |
3. | Pass the workspace structure to Creo Parametric to create the feature. Note
Creating sketched features requires a few more steps. For detailed information, see Element Trees: Sketched Features.
|
• | All options and attributes, such as the material side and depth type for an extrusion or slot, placement method for a hole, and so on. |
• | All references to existing geometry items, such as placement references, “up to” surfaces, sketching planes, and so on. |
• | References to Sketcher models used for sections in the feature. |
• | All dimension values. Note
Because Creo TOOLKIT is the same toolkit used to build Creo Parametric, improvements to Creo Parametric may require the definition of the element tree to be altered for some features. PTC will make every effort to maintain upward
compatibility. However, there may be cases where the old application will not run with the new version of Creo Parametric, unless you rewrite the application's code to conform to the new definition of the feature tree.
|
• | PRO_E_FEATURE_TYPE |
• | PRO_E_FEATURE_FORM |
• | PRO_E_EXT_DEPTH |
• | PRO_E_THICKNESS |
• | PRO_E_4AXIS_PLANE |
• | Single-valued |
• | Multivalued |
• | Compound |
• | Array |
• | Feature element tree |
• | Feature element table |
• | A description of its role in the feature |
• | The value type it has (that is, whether it is single value or compound; or an array of integer, double, or string) |
• | The range of values valid for it in this context |
Header File
|
Feature Type
|
---|---|
ProAnalysis.h
|
External Analysis
|
ProAsmcomp.h
|
Assembly component, mechanism connection
|
ProChamfer.h
|
Chamfer or corner chamfer
|
ProDataShareFeat.h
|
General merge (merge, cutout, inheritance), copy geom., publish geom., shrinkwrap
|
ProDraft.h
|
Draft
|
ProDtmAxis.h
|
Datum axis
|
ProDtmCrv.h
|
Datum curve
|
ProDtmCsys.h
|
Datum coordinate system
|
ProDtmPln.h
|
Datum plane
|
ProDtmPnt.h
|
Datum point
|
ProExtrude.h
|
Extruded protrusion, cut, surface, surface trim, thin, sheetmetal wall, or sheetmetal cut
|
ProFixture.h
|
Fixture (for Creo NC)
|
ProFlatSrf.h
|
Fill surface or sheetmetal flat wall
|
ProForeignCurve.h
|
Foreign datum curve
|
ProHole.h
|
Hole
|
ProMerge.h
|
Merge
|
ProMirror.h
|
Mirror (geometry only)
|
ProMove.h
|
Move and copy (geometry only)
|
ProMfgoper.h
|
Manufacturing operation
|
ProNcseq.h
|
Manufacturing Creo NC sequence
|
ProProcstep.h
|
Process step
|
ProReplace.h
|
Surface replacement feature
|
ProRevolve.h
|
Revolved protrusion, cut, surface, surface trim or thin
|
ProRib.h
|
Rib
|
ProRound.h
|
Round
|
ProShell.h
|
Shell
|
ProSmtFlangeWall.h
|
Sheetmetal flange wall
|
ProSmtFlatWall.h
|
Sheetmetal flat wall
|
ProSolidify.h
|
Solidify
|
ProStdSection.h
|
Standard section
|
ProSweep.h
|
Simple swept protrusion, cut
|
ProThicken.h
|
Thicken
|
ProTrim.h
|
Trim
|
ProWcell.h
|
Manufacturing workcell
|
• | Feature Element Values—Introduces the object ProValue, used to represent the value of a feature element. |
• | Feature Element Paths—Introduces the object ProElempath, used to describe the location of an element in an element tree. |
• | Feature Elements—Introduces the ProElement functions used to build and analyze an element tree. |
• | Feature Element Diagnostics—Introduces the ProElementDiagnostics functions used to obtain the diagnostics for a feature element. |
• | Calling ProFeatureCreate()—Describes the ProFeatureCreate() function in detail. |
• | Example of Complete Feature Creation—Shows how to use functions from the other sections to perform all the steps needed to create a feature. |
|
|
|
|
|
|
|
|
|
typedef struct pro_value_data
{
ProValueDataType type;
union
{
int i; /* integer */
double d; /* double */
void *p; /* pointer or reference */
char *s; /* string */
wchar_t *w; /* wchar_t */
ProSelection r; /* selection */
} v;
} ProValueData;
typedef enum pro_value_data_type
{
PRO_VALUE_TYPE_INT = 1,
PRO_VALUE_TYPE_DOUBLE,
PRO_VALUE_TYPE_POINTER,
PRO_VALUE_TYPE_STRING,
PRO_VALUE_TYPE_WSTRING,
PRO_VALUE_TYPE_SELECTION
} ProValueDataType;
• | vector—calculated ProVector direction vector. |
• | origin—calculated Pro3dPnt direction origin point. |
|
|
|
|
|
|
|
typedef struct path
{
ProElempathItemtype type;
union
{
int elem_id;
int elem_index;
} path_item;
} ProElempathItem;
typedef enum
{
PRO_ELEM_PATH_ITEM_TYPE_ID,
PRO_ELEM_PATH_ITEM_TYPE_INDEX
} ProElempathItemtype;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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. */
)
• | 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 Creo Parametric 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. |
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;
• | There are many useful utilities located in the Creo TOOLKIT sample code under the Creo TOOLKIT loadpoint. Utilities such as ProUtilElementtreePrint() are particularly useful when building and debugging element trees. |
• | From Pro/ENGINEER Wildfire 5.0 onward, the function ProFeatureCreate() has been deprecated. Instead, use the function ProFeatureWithoptionsCreate() with its input argument flags set to PRO_REGEN_NO_FLAGS for the equivalent behavior. ProFeatureWithoptionsCreate() has been described in detail in the Manipulating Features based on Regeneration Flags section in the Core: Features section. |
int ProDatumPlaneCreate (ProSelection offset_surface,
double offset_dist);
/*---------------------------------------------------------------*\
Create the root of the element tree.
\*---------------------------------------------------------------*/
ProElementAlloc (PRO_E_FEATURE_TREE, &elem_tree);
/*---------------------------------------------------------------*\
Allocate the feature type element.
\*---------------------------------------------------------------*/
ProElementAlloc (PRO_E_FEATURE_TYPE, &elem_ftype);
/*---------------------------------------------------------------*\
Set the value of the feature type element.
\*---------------------------------------------------------------*/
value_data.type = PRO_VALUE_TYPE_INT;
value_data.v.i = PRO_FEAT_DATUM;
ProValueAlloc (&value);
ProValueDataSet (value, &value_data);
ProElementValueSet (elem_ftype, value);
/*---------------------------------------------------------------*\
Add the feature type element as a child of the tree root.
\*---------------------------------------------------------------*/
ProElemtreeElementAdd (elem_tree, NULL, elem_ftype);
/*---------------------------------------------------------------*\
Add a PRO_E_DTMPLN_CONSTRAINTS element to the root of the
tree.
\*---------------------------------------------------------------*/
ProElementAlloc (PRO_E_DTMPLN_CONSTRAINTS, &elem_consts);
ProElemtreeElementAdd (elem_tree, NULL, elem_consts);
/*---------------------------------------------------------------*\
Add a PRO_E_DTMPLN_CONSTRAINT element to the constraints
element.
\*---------------------------------------------------------------*/
ProElementAlloc (PRO_E_DTMPLN_CONSTRAINT, &elem_offset);
ProElemtreeElementAdd (elem_consts, NULL, elem_offset);
/*---------------------------------------------------------------*\
Allocate the constraint type element.
\*---------------------------------------------------------------*/
ProElementAlloc (PRO_E_DTMPLN_CONSTR_TYPE,
&elem_const_type);
/*---------------------------------------------------------------*\
Set its value to be PRO_DTMPLN_OFFS.
\*---------------------------------------------------------------*/
value_data.type = PRO_VALUE_TYPE_INT;
value_data.v.i = PRO_DTMPLN_OFFS;
ProValueAlloc (&value);
ProValueDataSet (value, &value_data);
ProElementValueSet (elem_const_type, value);
/*---------------------------------------------------------------*\
Add it as a member of the constraint element.
\*---------------------------------------------------------------*/
ProElemtreeElementAdd (elem_offset, NULL, elem_const_type);
/*---------------------------------------------------------------*\
Allocate the offset reference element.
\*---------------------------------------------------------------*/
ProElementAlloc (PRO_E_DTMPLN_CONSTR_REF, &elem_offset_ref);
/*---------------------------------------------------------------*\
Set its value to be the ProSelection for the offset
reference surface.
\*---------------------------------------------------------------*/
value_data.type = PRO_VALUE_TYPE_SELECTION;
value_data.v.r = offset_surface;
ProValueAlloc (&value);
ProValueDataSet (value, &value_data);
ProElementValueSet (elem_offset_ref, value);
/*---------------------------------------------------------------*\
Add it to the constraint element.
\*---------------------------------------------------------------*/
ProElemtreeElementAdd (elem_offset, NULL, elem_offset_ref);
/*---------------------------------------------------------------*\
Allocate the offset distance element.
\*---------------------------------------------------------------*/
ProElementAlloc (PRO_E_DTMPLN_CONSTR_REF_OFFSET,
&elem_offset_dist);
/*---------------------------------------------------------------*\
Set its value to be the offset distance.
\*---------------------------------------------------------------*/
value_data.type = PRO_VALUE_TYPE_DOUBLE;
value_data.v.d = offset_dist;
ProValueAlloc (&value);
ProValueDataSet (value, &value_data);
ProElementValueSet (elem_offset_dist, value);
/*---------------------------------------------------------------*\
Add it to the constraint element.
\*---------------------------------------------------------------*/
ProElemtreeElementAdd (elem_offset, NULL, elem_offset_dist);
/*---------------------------------------------------------------*\
Get the component path for the offset surface.
\*---------------------------------------------------------------*/
ProSelectionAsmcomppathGet (offset_surface, &comppath);
/*---------------------------------------------------------------*\
Get the model item for the offset surface.
\*---------------------------------------------------------------*/
ProSelectionModelitemGet (offset_surface, &surf_modelitem);
/*---------------------------------------------------------------*\
Make a ProModelitem that refers to the owner of the offset
surface.
\*---------------------------------------------------------------*/
ProMdlToModelitem (surf_modelitem.owner, &model_modelitem);
/*---------------------------------------------------------------*\
Make a ProSelection for the solid that will contain the
new feature.
\*---------------------------------------------------------------*/
ProSelectionAlloc (&comppath, &model_modelitem, &featsel);
/*---------------------------------------------------------------*\
Get the component path for the offset surface.
\*---------------------------------------------------------------*/
ProSelectionAsmcomppathGet (offset_surface, &comppath);
/*---------------------------------------------------------------*\
Make a ProModelitem that refers to the root of the assembly.
\*---------------------------------------------------------------*/
ProMdlToModelitem (comppath.owner, &model_modelitem);
/*---------------------------------------------------------------*\
Make a ProSelection for the root of the assembly.
\*---------------------------------------------------------------*/
ProSelectionAlloc (NULL, &model_modelitem, &featsel);
/*---------------------------------------------------------------*\
Create the datum plane feature.
\*---------------------------------------------------------------*/
ProFeatureCreate (featsel, elem_tree, NULL, 0, &feature,
&errors);
|
|
|
|
|
|
|
|
|
<xsd:sequence>
<xsd:element name="PRO_E_FEATURE_TYPE"
type="StringData"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="PRO_E_FEATURE_FORM" type="StringData"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="PRO_E_PATCH_QUILT" type="Selection"
minOccurs="1" maxOccurs="1"/>
<xsd:element name="PRO_E_PATCH_TYPE" type="IntegerData"
minOccurs="0" maxOccurs="1"/>
<xsd:element name="PRO_E_PATCH_MATERIAL_SIDE" type="IntegerData"
minOccurs="0" maxOccurs="1"/>
<xsd:element name="PRO_E_STD_FEATURE_NAME" type="StringData"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<!-- End Solidify -->
status = ProElemtreeFromXMLCreate ( input_file, &elemtree, &errors );
if ( ( status == PRO_TK_GENERAL_ERROR ) || ( status == PRO_TK_BAD_CONTEXT ))
{
printf ("ProElemtreeFromXMLCreate FAILURE :: %d \n", status );
status = ProArraySizeGet ( errors, &size_errors );
printf("Size of the Error Object is %d \n", size_errors);
printf("Content of the Error Object are \n");
for ( error_count = 0; error_count < size_errors; error_count++ )
{
printf("Error No = %d\n", error_count);
printf("\t+ Error Type = %d\n", errors[error_count].error_type );
if ( status == PRO_TK_GENERAL_ERROR )
{
printf("\t+ Error Path = %s\n",
ProWstringToString ( temp_string, errors[error_count].error_source ));
printf("\t+ Line No = %d\n", errors[error_count].line_number);
printf("\t+ Column No = %d\n", errors[error_count].column_number);
}
else if ( status == PRO_TK_BAD_CONTEXT )
{
printf("\t+ Element Sr No = %d\n",
errors[error_count].line_number);
printf("\t+ Element ID = %d\n",
errors[error_count].column_number);
}
ProWstringLengthGet ( errors[error_count].message,
&string_length );
temp_message_string = (char *) calloc ( 1, (string_length+1) * sizeof (char) );
printf("\t+ Error Message = %s\n",
ProWstringToString ( temp_message_string,
errors[error_count].message ));
free ( temp_message_string );
}
}
Feature Type
|
Feature Name
|
---|---|
PRO_FEAT_DATUM_AXIS
|
Datum Axis Feature
|
PRO_FEAT_DATUM
|
Datum Plane Feature
|
PRO_FEAT_CSYS
|
Datum Coordinate System Feature
|
PRO_FEAT_CURVE
|
Datum Curve Feature
|
PRO_FEAT_DATUM_POINT
|
Datum Point Feature
|
PRO_FEAT_CHAMFER
|
Chamfer Feature
|
PRO_FEAT_ROUND
|
Round Feature
|
PRO_FEAT_DRAFT
|
Draft Feature
|
PRO_FEAT_HOLE
|
Hole Feature
|
PRO_FEAT_WALL
|
Sheetmetal Flat or Flange Wall Feature
|
PRO_FEAT_COMPONENT
|
Assembly Component Feature
|
PRO_FEAT_DATUM_QUILT
|
Surface Merge Feature
|
PRO_FEAT_PATCH
|
Solidify Feature of the type Patch
|
PRO_FEAT_GEN_MERGE
|
General Merge Feature
|
PRO_FEAT_SRF_MDL
|
Mirror or Move Feature
|
PRO_FEAT_PROTRUSION
|
Solidify Feature of the type Protrusion
|
PRO_FEAT_SHELL
|
Shell Feature
|
PRO_FEAT_FIRST_FEAT
|
First Feature
|
PRO_FEAT_CUT
|
Solidify Feature of the type Cut
|
PRO_FEAT_SLOT
|
Slot Feature
|
PRO_FEAT_GEOM_COPY
|
Copy Geometry Feature
|
PRO_FEAT_RIB
|
Rib Feature
|
PRO_FEAT_REPLACE_SURF
|
Replace Surface Feature
|
<PRO_E_REV_ANGLE_FROM_VAL type="double">0.00</PRO_E_REV_ANGLE_FROM_VAL>
<PRO_E_REV_ANGLE_FROM_REF type="selection" />
<PRO_E_REV_ANGLE_FROM_REF type="selection"></PRO_E_REV_ANGLE_FROM_REF type>
<PRO_E_DPOINT_PLA_CONSTR_REF type="selection"> <PRO_XML_REFERENCE type="reference"> <PRO_XML_REFERENCE_STATUS type= “int”>PRO_REF_NOT_FOUND</PRO_XML_REFERENCE_STATUS> <PRO_XML_REFERENCE_OWNER type="owner">COMP2.prt</PRO_XML_REFERENCE_OWNER> <PRO_XML_REFERENCE_ID type="id">46</PRO_XML_REFERENCE_ID> <PRO_XML_REFERENCE_TYPE type="protype">PRO_EDGE</PRO_XML_REFERENCE_TYPE> <PRO_XML_ASMCOMP_PATH comppath="compound"> <PRO_XML_ASMCOMP_PATH_OWNER type="model">ASM_PNT.asm</PRO_XML_ASMCOMP_PATH_OWNER> <PRO_XML_ASMCOMP_PATH_ARRAY type="array"> <PRO_XML_ASMCOMP_PATH_ITEM index="1">40</PRO_XML_ASMCOMP_PATH_ITEM> </PRO_XML_ASMCOMP_PATH_ARRAY> </PRO_XML_ASMCOMP_PATH> <PRO_XML_UV_PARAM uv_parameter="array"> <PRO_XML_DOUBLE_VALUE type="u">0.000000</PRO_XML_DOUBLE_VALUE> <PRO_XML_DOUBLE_VALUE type="v">0.000000</PRO_XML_DOUBLE_VALUE> </PRO_XML_UV_PARAM> </PRO_XML_REFERENCE> </PRO_E_DPOINT_PLA_CONSTR_REF>
<PRO_E_STD_CURVE_COLLECTION_APPL type="collection"> <PRO_XML_COLLECTION type="curve"> <PRO_XML_COLLECTION_INSTRUCTIONS type="array"> <PRO_XML_COLLECTION_INSTRUCTION type="compound"> <PRO_XML_COLLECTION_INSTRUCTION_TYPE type="int">105</PRO_XML_COLLECTION_
INSTRUCTION_TYPE> <PRO_XML_CRVCOLL_REFS type="array"> <PRO_XML_CRVCOLL_REF type="selection"> <PRO_XML_REFERENCE type="reference"> <PRO_XML_REFERENCE_OWNER type="owner">CRV_COLLECTION_PART.prt
</PRO_XML_REFERENCE_OWNER> <PRO_XML_REFERENCE_ID type="id">703</PRO_XML_REFERENCE_ID> <PRO_XML_REFERENCE_TYPE type="protype">PRO_QUILT</PRO_XML_REFERENCE_TYPE> </PRO_XML_REFERENCE> </PRO_XML_CRVCOLL_REF> <PRO_XML_CRVCOLL_REF type="selection"> <PRO_XML_REFERENCE type="reference"> <PRO_XML_REFERENCE_OWNER type="owner">CRV_COLLECTION_PART.prt
</PRO_XML_REFERENCE_OWNER> <PRO_XML_REFERENCE_ID type="id">679</PRO_XML_REFERENCE_ID> <PRO_XML_REFERENCE_TYPE type="protype">PRO_EDGE</PRO_XML_REFERENCE_TYPE> </PRO_XML_REFERENCE> </PRO_XML_CRVCOLL_REF> </PRO_XML_CRVCOLL_REFS> </PRO_XML_COLLECTION_INSTRUCTION> </PRO_XML_COLLECTION_INSTRUCTIONS> </PRO_XML_COLLECTION> </PRO_E_STD_CURVE_COLLECTION_APPL>
<PRO_E_STD_SURF_COLLECTION_APPL type="collection"> <PRO_XML_COLLECTION type="surface"> <PRO_XML_COLLECTION_INSTRUCTIONS type="array"> <PRO_XML_COLLECTION_INSTRUCTION type="compound"> <PRO_XML_COLLECTION_INSTRUCTION_TYPE type="int">2
</PRO_XML_COLLECTION_INSTRUCTION_TYPE> <PRO_XML_SRFCOLL_INCLUDE type="boolean">1</PRO_XML_SRFCOLL_INCLUDE> <PRO_XML_SRFCOLL_REFS type="array"> <PRO_XML_SRFCOLL_REF type="compound"> <PRO_XML_SRFCOLL_REFITEM_TYPE type="int">3</PRO_XML_SRFCOLL_REFITEM_TYPE> <PRO_XML_SRFCOLL_REFITEM type="selection"> <PRO_XML_REFERENCE type="reference"> <PRO_XML_REFERENCE_OWNER type="owner"> SRF_COLLECTION_PART.prt</PRO_XML_REFERENCE_OWNER> <PRO_XML_REFERENCE_ID type="id">17</PRO_XML_REFERENCE_ID> <PRO_XML_REFERENCE_TYPE type="protype">PRO_SURFACE</PRO_XML_REFERENCE_TYPE> </PRO_XML_REFERENCE> </PRO_XML_SRFCOLL_REFITEM> </PRO_XML_SRFCOLL_REF> <PRO_XML_SRFCOLL_REF type="compound"> <PRO_XML_SRFCOLL_REFITEM_TYPE type="int">4</PRO_XML_SRFCOLL_REFITEM_TYPE> <PRO_XML_SRFCOLL_REFITEM type="selection"> <PRO_XML_REFERENCE type="reference"> <PRO_XML_REFERENCE_OWNER type="owner"> SRF_COLLECTION_PART.prt</PRO_XML_REFERENCE_OWNER> <PRO_XML_REFERENCE_ID type="id">26</PRO_XML_REFERENCE_ID> <PRO_XML_REFERENCE_TYPE type="protype">PRO_SURFACE</PRO_XML_REFERENCE_TYPE> </PRO_XML_REFERENCE> </PRO_XML_SRFCOLL_REFITEM> </PRO_XML_SRFCOLL_REF> </PRO_XML_SRFCOLL_REFS> </PRO_XML_COLLECTION_INSTRUCTION> </PRO_XML_COLLECTION_INSTRUCTIONS> </PRO_XML_COLLECTION> </PRO_E_STD_SURF_COLLECTION_APPL>
<PRO_E_SKETCHER type="pointer">**</PRO_E_SKETCHER>
<PRO_E_REV_ANGLE type="compound">
<PRO_E_REV_ANGLE_FROM type="compound">
<PRO_E_REV_ANGLE_FROM_TYPE type="int">262144</PRO_E_REV_ANGLE_FROM_TYPE>
<PRO_E_REV_ANGLE_FROM_VAL type="double">0.00</PRO_E_REV_ANGLE_FROM_VAL>
<PRO_E_REV_ANGLE_FROM_REF type="selection" />
<PRO_E_REV_ANGLE_FROM_LIMIT type="int">0</PRO_E_REV_ANGLE_FROM_LIMIT>
</PRO_E_REV_ANGLE_FROM>
<PRO_E_REV_ANGLE_TO type="compound">
<PRO_E_REV_ANGLE_TO_TYPE type="int">4194304</PRO_E_REV_ANGLE_TO_TYPE>
<PRO_E_REV_ANGLE_TO_VAL type="double">120.00</PRO_E_REV_ANGLE_TO_VAL>
<PRO_E_REV_ANGLE_TO_REF type="selection" />
<PRO_E_REV_ANGLE_TO_LIMIT type="int">0</PRO_E_REV_ANGLE_TO_LIMIT>
</PRO_E_REV_ANGLE_TO>
</PRO_E_REV_ANGLE>
<PRO_E_RNDCH_RADII type="array"> <PRO_E_RNDCH_RADIUS type="compound"> <PRO_E_STD_POINT_COLLECTION_APPL type="selection"> <PRO_XML_REFERENCE type="reference"> <PRO_XML_REFERENCE_OWNER type="owner">K01_X_COLLECTION_PART.prt
</PRO_XML_REFERENCE_OWNER> <PRO_XML_REFERENCE_ID type="id">1268</PRO_XML_REFERENCE_ID> <PRO_XML_REFERENCE_TYPE type="protype">PRO_CRV_END</PRO_XML_REFERENCE_TYPE> </PRO_XML_REFERENCE> </PRO_E_STD_POINT_COLLECTION_APPL> <PRO_E_RNDCH_LEG1 type="compound"> <PRO_E_RNDCH_LEG_TYPE type="int">1</PRO_E_RNDCH_LEG_TYPE> <PRO_E_RNDCH_LEG_VALUE type="double">36.00</PRO_E_RNDCH_LEG_VALUE> <PRO_E_RNDCH_REFERENCE_EDGE type="selection" /> <PRO_E_RNDCH_REFERENCE_POINT type="selection" /> </PRO_E_RNDCH_LEG1> <PRO_E_RNDCH_LEG2 type="compound"> <PRO_E_RNDCH_LEG_TYPE type="int">0</PRO_E_RNDCH_LEG_TYPE> <PRO_E_RNDCH_LEG_VALUE type="double">0.00</PRO_E_RNDCH_LEG_VALUE> <PRO_E_RNDCH_REFERENCE_EDGE type="selection" /> <PRO_E_RNDCH_REFERENCE_POINT type="selection" /> </PRO_E_RNDCH_LEG2> </PRO_E_RNDCH_RADIUS> <PRO_E_RNDCH_RADIUS type="compound"> <PRO_E_STD_POINT_COLLECTION_APPL type="selection"> <PRO_XML_REFERENCE type="reference"> <PRO_XML_REFERENCE_OWNER type="owner">K01_X_COLLECTION_PART.prt
</PRO_XML_REFERENCE_OWNER> <PRO_XML_REFERENCE_ID type="id">1268</PRO_XML_REFERENCE_ID> <PRO_XML_REFERENCE_TYPE type="protype">PRO_CRV_START</PRO_XML_REFERENCE_TYPE> </PRO_XML_REFERENCE> </PRO_E_STD_POINT_COLLECTION_APPL> <PRO_E_RNDCH_LEG1 type="compound"> <PRO_E_RNDCH_LEG_TYPE type="int">1</PRO_E_RNDCH_LEG_TYPE> <PRO_E_RNDCH_LEG_VALUE type="double">55.39</PRO_E_RNDCH_LEG_VALUE> <PRO_E_RNDCH_REFERENCE_EDGE type="selection" /> <PRO_E_RNDCH_REFERENCE_POINT type="selection" /> </PRO_E_RNDCH_LEG1> <PRO_E_RNDCH_LEG2 type="compound"> <PRO_E_RNDCH_LEG_TYPE type="int">0</PRO_E_RNDCH_LEG_TYPE> <PRO_E_RNDCH_LEG_VALUE type="double">0.00</PRO_E_RNDCH_LEG_VALUE> <PRO_E_RNDCH_REFERENCE_EDGE type="selection" /> <PRO_E_RNDCH_REFERENCE_POINT type="selection" /> </PRO_E_RNDCH_LEG2> </PRO_E_RNDCH_RADIUS> </PRO_E_RNDCH_RADII>
<PRO_E_SHELL_SRF type="multivalue">
<PRO_E_SHELL_SRF_MULTI type="selection">
<PRO_XML_REFERENCE type="reference">
<PRO_XML_REFERENCE_OWNER type="owner">X_SHELL_REDEF.prt</PRO_XML_REFERENCE_OWNER>
<PRO_XML_REFERENCE_ID type="id">76</PRO_XML_REFERENCE_ID>
<PRO_XML_REFERENCE_TYPE type="protype">PRO_SURFACE</PRO_XML_REFERENCE_TYPE>
</PRO_XML_REFERENCE>
</PRO_E_SHELL_SRF_MULTI>
<PRO_E_SHELL_SRF_MULTI type="selection">
<PRO_XML_REFERENCE type="reference">
<PRO_XML_REFERENCE_OWNER type="owner">X_SHELL_REDEF.prt</PRO_XML_REFERENCE_OWNER>
<PRO_XML_REFERENCE_ID type="id">72</PRO_XML_REFERENCE_ID>
<PRO_XML_REFERENCE_TYPE type="protype">PRO_SURFACE</PRO_XML_REFERENCE_TYPE>
</PRO_XML_REFERENCE>
</PRO_E_SHELL_SRF_MULTI>
<PRO_E_SHELL_SRF_MULTI type="selection">
<PRO_XML_REFERENCE type="reference">
<PRO_XML_REFERENCE_OWNER type="owner">X_SHELL_REDEF.prt</PRO_XML_REFERENCE_OWNER>
<PRO_XML_REFERENCE_ID type="id">68</PRO_XML_REFERENCE_ID>
<PRO_XML_REFERENCE_TYPE type="protype">PRO_SURFACE</PRO_XML_REFERENCE_TYPE>
</PRO_XML_REFERENCE>
</PRO_E_SHELL_SRF_MULTI>
</PRO_E_SHELL_SRF>
• | Creo Parametric models can have only a single feature with a specific name - before using the XML for creating a new feature, modify the value of the element PRO_E_STD_FEATURE_NAME appropriately. Since, feature name is an optional element, the XML tag for this element can be deleted from the XML file to promote reuse. |
• | The function ProElemtreeWrite() writes all of the elements in the input Creo TOOLKIT native element tree. Optional elements with empty data within XML tags from the XML file can be removed before reusing the XML file. It is also permitted to keep the optional elements as they are in the XML, but these elements are ignored by ProElemtreeFromXMLCreate(). |
• | ProElemtreeFromXMLCreate() converts the XML file to an element tree without validating that the data is appropriate for that feature type (for example, ensuring that the correct type is selected for references.) The error is detected when the element tree is used by ProFeatureCreate() or ProFeatureRedefine(). |
• | ProElemtreeFromXMLCreate() supports some enumerated symbols or the actual integer values. Use the output XML file as a guide to see which enumerated type names are accepted. |
• | The tag names used in the XML representation are derived from the list of ProElemId from ProElemId.h.These names must be used exactly as found in the ProElemId.h file. |
• | XML files created by one version of Creo Parametric are not guaranteed to be usable by other Creo Parametric versions, because the structure of the element tree also change between versions. |
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML File for shell feature -->
<PRO_E_FEATURE_TREE AppName="Creo Parametric" AppVersion="2003440"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ProTKFeature.xsd" type="compound">
<PRO_E_FEATURE_TYPE type="int">PRO_FEAT_SHELL</PRO_E_FEATURE_TYPE>
<PRO_E_STD_FEATURE_NAME type="wstring">SHELL</PRO_E_STD_FEATURE_NAME>
<PRO_E_SHELL_SRF type="multivalue">
<PRO_E_SHELL_SRF_MULTI type="selection">
<PRO_XML_REFERENCE type="reference">
<PRO_XML_REFERENCE_OWNER type="owner">X_SHELL.prt</PRO_XML_REFERENCE_OWNER>
<PRO_XML_REFERENCE_ID type="id">76</PRO_XML_REFERENCE_ID>
<PRO_XML_REFERENCE_TYPE type="protype">PRO_SURFACE</PRO_XML_REFERENCE_TYPE>
</PRO_XML_REFERENCE>
</PRO_E_SHELL_SRF_MULTI>
</PRO_E_SHELL_SRF>
<PRO_E_SHELL_THICK type="double">4.02</PRO_E_SHELL_THICK>
<PRO_E_SHELL_FLIP type="int">1</PRO_E_SHELL_FLIP>
<PRO_E_ST_SHELL_LOCL_LIST type="array">
<PRO_E_ST_SHELL_LOCL_CMPD type="compound">
<PRO_E_ST_SHELL_SPEC_SRF type="selection">
<PRO_XML_REFERENCE type="reference">
<PRO_XML_REFERENCE_OWNER type="owner">X_SHELL.prt</PRO_XML_REFERENCE_OWNER>
<PRO_XML_REFERENCE_ID type="id">53</PRO_XML_REFERENCE_ID>
<PRO_XML_REFERENCE_TYPE type="protype">PRO_SURFACE</PRO_XML_REFERENCE_TYPE>
</PRO_XML_REFERENCE>
</PRO_E_ST_SHELL_SPEC_SRF>
<PRO_E_ST_SHELL_SPEC_THCK type="double">10.00</PRO_E_ST_SHELL_SPEC_THCK>
</PRO_E_ST_SHELL_LOCL_CMPD>
<PRO_E_ST_SHELL_LOCL_CMPD type="compound">
<PRO_E_ST_SHELL_SPEC_SRF type="selection">
<PRO_XML_REFERENCE type="reference">
<PRO_XML_REFERENCE_OWNER type="owner">X_SHELL.prt</PRO_XML_REFERENCE_OWNER>
<PRO_XML_REFERENCE_ID type="id">66</PRO_XML_REFERENCE_ID>
<PRO_XML_REFERENCE_TYPE type="protype">PRO_SURFACE</PRO_XML_REFERENCE_TYPE>
</PRO_XML_REFERENCE>
</PRO_E_ST_SHELL_SPEC_SRF>
<PRO_E_ST_SHELL_SPEC_THCK type="double">9.00</PRO_E_ST_SHELL_SPEC_THCK>
</PRO_E_ST_SHELL_LOCL_CMPD>
<PRO_E_ST_SHELL_LOCL_CMPD type="compound">
<PRO_E_ST_SHELL_SPEC_SRF type="selection">
<PRO_XML_REFERENCE type="reference">
<PRO_XML_REFERENCE_OWNER type="owner">X_SHELL.prt</PRO_XML_REFERENCE_OWNER>
<PRO_XML_REFERENCE_ID type="id">74</PRO_XML_REFERENCE_ID>
<PRO_XML_REFERENCE_TYPE type="protype">PRO_SURFACE</PRO_XML_REFERENCE_TYPE>
</PRO_XML_REFERENCE>
</PRO_E_ST_SHELL_SPEC_SRF>
<PRO_E_ST_SHELL_SPEC_THCK type="double">15.00</PRO_E_ST_SHELL_SPEC_THCK>
</PRO_E_ST_SHELL_LOCL_CMPD>
</PRO_E_ST_SHELL_LOCL_LIST>
</PRO_E_FEATURE_TREE>
#include <ProToolkit.h>
#include <ProMenuBar.h>
#include <ProMdl.h>
#include <ProSelection.h>
#include <ProFeature.h>
#include <ProWstring.h>
static
wchar_t MSGFIL[] = {'u','t','i','l','i','t','i','e','s','.','t','x','t','\0'};
/*=====================================================================*\
FUNCTION: UserFeatXMLWrite
PURPOSE: Write a feature's element tree to an XML file.
\*=====================================================================*/
int UserFeatXMLWrite (ProFeature* feat)
{
ProElement elemtree;
wchar_t wFilename [PRO_FILE_NAME_SIZE];
/*--------------------------------------------------------------------*\
Prompt for the filename
\*--------------------------------------------------------------------*/
ProMessageDisplay ( MSGFIL, "USER Enter the XML file name:");
if (ProMessageStringRead (PRO_FILE_NAME_SIZE, wFilename)
!= PRO_TK_NO_ERROR)
return (0);
/*--------------------------------------------------------------------*\
Extract the element tree and convert it to XML
\*--------------------------------------------------------------------*/
status = ProFeatureElemtreeExtract (feat,NULL,PRO_FEAT_EXTRACT_NO_OPTS,
&elemtree);
if ( status == PRO_TK_NO_ERROR )
{
status = ProElemtreeWrite (elemtree, PRO_ELEMTREE_XML, wFilename);
ProElementFree (&elemtree);
}
return status;
}