二次开发创建坐标系常用的方法式调用UDF来创建,但是参数的控制比较单一。那么用特征元素树来做的话,就非常的容易控制各种参数了。
PRO_E_FEATURE_TREE
|
|–PRO_E_FEATURE_TYPE
|
|–PRO_E_STD_FEATURE_NAME
|
|–PRO_E_CSYS_ORIGIN_CONSTRS Array of origin constraints
| |–PRO_E_CSYS_ORIGIN_CONSTR
| |–PRO_E_CSYS_ORIGIN_CONSTR_REF
|
|–PRO_E_CSYS_OFFSET_TYPE
|
|–PRO_E_CSYS_ONSURF_TYPE
|
|–PRO_E_CSYS_DIM_CONSTRS
| |–PRO_E_CSYS_DIM_CONSTR
| |–PRO_E_CSYS_DIM_CONSTR_REF
| |–PRO_E_CSYS_DIM_CONSTR_TYPE
| |–PRO_E_CSYS_DIM_CONSTR_VAL
|
|–PRO_E_CSYS_ORIENTMOVES Array of orientation constraints
| |–PRO_E_CSYS_ORIENTMOVE
| |–PRO_E_CSYS_ORIENTMOVE_MOVE_TYPE
| |–PRO_E_CSYS_ORIENTMOVE_MOVE_VAL
|
|–PRO_E_CSYS_NORMAL_TO_SCREEN
|
|–PRO_E_CSYS_ORIENT_BY_METHOD
|
|–PRO_E_CSYS_ORIENTSELAXIS1_REF Orientation direction 1 reference
|–PRO_E_CSYS_ORIENTSELAXIS1_REF_OPT To use csys origin, x, y, or z axis
|–PRO_E_CSYS_ORIENTSELAXIS1_OPT Axis option of direction 1 reference
|–PRO_E_CSYS_ORIENTSELAXIS1_FLIP
|–PRO_E_CSYS_ORIENTSELAXIS2_REF Orientation direction 2 reference
|–PRO_E_CSYS_ORIENTSELAXIS2_REF_OPT To use csys origin, x, y, z or axis
|–PRO_E_CSYS_ORIENTSELAXIS2_OPT Axis option of direction 2 reference
|–PRO_E_CSYS_ORIENTSELAXIS2_FLIP
|–PRO_E_CSYS_ORIENTSELAXIS2_ROT_OPT Rotation angle option about the First Axis
|–PRO_E_CSYS_ORIENTSELAXIS2_ROT Rotation angle about the First Axis
|
|–PRO_E_CSYS_TYPE_MECH csys type in Creo Simulate environment ( ONLY )
|–PRO_E_CSYS_FOLLOW_SRF_OPT csys follow option in sheetmetal environment ( ONLY )
|
|–PRO_E_CSYS_NAME_DISPLAY_OPT Csys name display option ( yes/no )
|–PRO_E_CSYS_DISPLAY_ZOOM_DEP_OPT Csys display zoom dependent option ( yes/no )
|–PRO_E_CSYS_AXIS_LENGTH Csys axis length
下面给出创建默认坐标系的代码实例:
wfcElements_ptr elements = wfcElements::create();
wfcElement_ptr elem_0_0 = wfcElement::Create(wfcPRO_E_FEATURE_TREE, 0, 0);
elements->append(elem_0_0);
wfcElement_ptr elem_1_1 = wfcElement::Create(wfcPRO_E_FEATURE_TYPE, pfcCreateIntArgValue(PRO_FEAT_CSYS), 1);
elements->append(elem_1_1);
wfcElement_ptr elem_1_2 = wfcElement::Create(wfcPRO_E_STD_FEATURE_NAME, pfcCreateStringArgValue("CREOBOX"), 1);
elements->append(elem_1_2);
wfcElement_ptr elem_1_3 = wfcElement::Create(wfcPRO_E_CSYS_FOLLOW_SRF_OPT, pfcCreateIntArgValue(0), 1);
elements->append(elem_1_3);
wfcFeatCreateOptions_ptr featOpts = wfcFeatCreateOptions::create();
featOpts->append(wfcFEAT_CR_INCOMPLETE_FEAT);
wfcWRegenInstructions_ptr regenInstr = wfcWRegenInstructions::Create();
wfcElementTree_ptr elemTree = WSession->CreateElementTree(elements);
wfcWFeature_ptr sweepFeat = wfcWSolid::cast(sld) ->WCreateFeature(elemTree, featOpts, regenInstr);