Pro/E is a feature-based 3D software.
Each item in the model tree is a feature. As shown in
The following program implements traversal of the feature under the current model of proe, with code:
Proerror _ visitsolidallfeats _ (profeature * p_feature, proerror status, proappdata app_data) {proarrayobjectadd (proarray *) app_data,-1, 1, p_feature); Return pro_tk_no_error ;} int test (uicmd1_id command, uicmdvalue * p_value, void * p_push_command_data) {proerror err; promdl MDL; // get the current model handle err = promdlcurrentget (& MDL); If (then! = ERR) Return-1; // defines the array variables, used to record all profeature proarray arr; proarrayalloc (0, sizeof (profeature), 10, & ARR ); // The variable accesses all feature prosolidfeatvisit (prosolid) MDL, _ visitsolidallfeats _, null, & ARR) in the current model; // The ID int nsize of all profeature values in the output array; proarraysizeget (ARR, & nsize); cstring CSTR; CSTR. format (text ("% d feature in total"), nsize); afxmessagebox (CSTR); For (INT I = 0; I <nsize; ++ I) {int id = (profeature *) Arr) [I]. ID; CSTR. format (text ("feature id = % d"), ID); afxmessagebox (CSTR);} // release the array resource proarrayfree (& ARR); Return 0 ;}
Download the source code vs2005 + proe3.0
Http://download.csdn.net/detail/wangyao1052/4945338