In proe, the ASM file is usually very small, because the PRT or sub-ASM file is not copied but stored as a pointer.
The following example is used to access the group profile and output the architecture of the group profile in the form of a TXT file.
Source code download: http://download.csdn.net/detail/wangyao1052/4995636
The Code is as follows:
// Else //-----------------------------------------------------------------------------//*********************************** **************************************** ** // --------------------------------------------------------------------------------- # pragma region # include <protoolkit. h> # include <proutil. h> # include <promenubar. h> # include <promenu. h> # include <promode. h> # include <promdl. h> # include <prosolid. h> # Inc Lude <proasmcomp. h> # include <proarray. h> # include <promodelitem. h> # include <profeature. h> # include <profeattype. h> # include <prolayer. h> // function declaration uicmdaccessstate testaccess (uicmdaccessmode access_mode); uicmdaccessstate asmoutputtestaccess (uicmdaccessmode access_mode); int test (uicmd1_id command, cmd* p_value, void * handle ); int asmoutputtest (uicmd1_id command, uicmdvalue * p_value, Void * temperature); proerror _ temperature _ (profeature * p_feature, proerror status, proappdata app_data); extern "C" int user_initialize () {proerror err; profamilyname msgfile; prostringtowstring (msgfile, "test_msg.txt"); // Add the menu testmenu err = promenubarmenuadd ("testmenu", "testmenu", "help", pro_ B _true, msgfile ); // Add the command and menu item uicmd1_id pai_id1; err = pro1_actionadd ("test", te St, uiproeimmediate, testaccess, pro_ B _false, pro_ B _false, & cmd_id1); err = encrypt ("testmenu", "test", "test", "test_help", null, pro_ B _true, cmd_id1, msgfile); optional values _id2; err = promo-actionadd ("asmoutputtest", asmoutputtest, example, example, pro_ B _false, pro_ B _false, & optional _id2); err = example ("testmenu", "example ", "asmou Tputtest "," success ", null, pro_ B _true, cmd_id2, msgfile); Return 0;} extern" C "Void user_terminate () {} int test (uicmd1_id command, uicmdvalue * p_value, void * p_push_command_data) {afxmessagebox (text ("just for test"); Return 0 ;}struct asmtreenode {char name [pro_name_size]; asmtreenode * pparent; // parent node vector <asmtreenode> vchilds; // asmtreenode () {memset (name, 0, sizeof (name) set of Child Nodes )); Pparent = NULL ;}}; void outputasm (File * FP, asmtreenode * pnode, int nlayer) {for (INT I = 0; I <nlayer; ++ I) {fprintf (FP, "--") ;}fprintf (FP, "% s \ n", pnode-> name); nlayer ++; For (INT I = 0; I <pnode-> vchilds. size (); ++ I) {outputasm (FP, & (pnode-> vchilds [I]), nlayer) ;} nlayer -- ;} int asmoutputtest (uicmd1_id command, uicmdvalue * p_value, void * p_push_command_data) {proerror err; promdl mdl_curr; prom Dltype mdl_type; // obtain the current model and determine whether the archive err = promdlcurrentget (& mdl_curr); err = promdltypeget (mdl_curr, & mdl_type); If (pro_mdl_assembly! = Mdl_type) {afxmessagebox (text ("the current model is not a group file! "); Return-1;} // obtain the name of the current group profile proname mdl_name; promdlnameget (mdl_curr, mdl_name); // construct the node asmtreenode head; prowstringtostring (head. name, mdl_name); // recursively access all component err = prosolidfeatvisit (prosolid) mdl_curr, _ visitasmallcomponent _, null, & head) in the group profile ); // output file * fp = fopen ("D: \ 123.txt"," A "); outputasm (FP, & head, 0); fclose (FP); Return 0 ;} uicmdaccessstate testaccess (uicmdaccessmode access_m Ode) {return access_available;} uicmdaccessstate asmoutputtestaccess (uicmdaccessmode access_mode) {proerror err; promode mode; err = promodecurrentget (& mode); If (Err! = Condition) {return access_unavailable;} If (mode = pro_mode_assembly) {return access_available;} else {return access_unavailable;} proerror _ condition _ (profeature * p_feature, proerror status, proappdata app_data) {asmtreenode * pparent = (asmtreenode *) app_data; // determines if it is proasmcomp proerror err; profeattype feat_type; condition (p_feature, & feat_type); If (temperature Ponent! = Feat_type) {return character;} // construct the node asmtreenode node; promdl character; character (p_feature, & temperature); proname mdl_name; promdlnameget (temperature, mdl_name); prowstringtostring (node. name, mdl_name); // recursively traverse the subnode err = prosolidfeatvisit (prosolid) mdl_asmcomp, _ visitasmallcomponent _, null, & node); // associate with the parent node. pparent = pparent; pparent-> vchilds. push_back (node); Return pro_tk_no_error ;} # pragma endregion // region //-----------------------------------------------------------------------------//******************************** **************************************** *****//-----------------------------------------------------------------------------