📄 testcollect.c
字号:
status, status != PRO_TK_NO_ERROR); /* Print out surf ID */ fprintf( fp_out, "ID %d:\t", surf_id ); /* Get the surface type */ status = ProSurfaceTypeGet( p_surfaces[i], &surf_type ); TEST_CALL_REPORT( "ProSurfaceTypeGet()", "ProTestCollectSolidSurfaces()", status, status != PRO_TK_NO_ERROR); /* Print out surf type */ fprintf( fp_out, "%s\n", ProUtilSurfaceTypeToString( surf_type ) ); } status = ProArrayFree( (ProArray*)&p_surfaces ); TEST_CALL_REPORT( "ProArrayFree()", "ProTestCollectSolidSurfaces()", status, status != PRO_TK_NO_ERROR); } return status;}/*=========================================================================*\ File: TestCollect.c Function: ProUtilSurfaceTypeToString() Purpose: Return the string with surface type Returns: Surface type name\*=========================================================================*/char *ProUtilSurfaceTypeToString( ProSrftype surf_type /* In: Surface type to convert to string */){ int i; for( i=0; surface_type_name[i].p_name != NULL; i++ ) if( surface_type_name[i].type == surf_type ) return surface_type_name[i].p_name; return "unknown";}/*=========================================================================*\ File: TestCollect.c Function: ProTestCollectSolidSimpreps() Purpose: On button function. Test simpreps collection. Returns: 0 if successful, non-zero otherwise.\*=========================================================================*/int ProTestCollectSolidSimpreps( ProAppData p_appdata, int int_dummy ){#ifndef PT_PRODUCTS_BUILD ProError status; ProMdl p_model; ProSimprep *p_simpreps; ProName w_name; ProCharName name; ProSimprepdata *p_simprep_data; int n; int i; /* Print the header */ fprintf( fp_out, "\n# Solid simprep\n" ); p_model = *((ProMdl*)p_appdata); /* Get solid simp reps */ status = ProUtilCollectSolidSimpreps( (ProSolid)p_model, &p_simpreps ); /* Print out obtained simp reps */ if( status == PRO_TK_NO_ERROR ) { /* Get the array size */ n = 0; status = ProArraySizeGet( p_simpreps, &n ); TEST_CALL_REPORT( "ProArraySizeGet()", "ProTestCollectSolidSimpreps()", status, status != PRO_TK_NO_ERROR); /* Print out the simp reps array */ fprintf( fp_out, "Number of simp reps:\t%d\n", n ); for( i=0; i<n; i++ ) { /* Get the simp rep name */ status = ProSimprepdataGet( p_simpreps+i, &p_simprep_data ); TEST_CALL_REPORT( "ProSimprepdataGet()", "ProTestCollectSolidSimpreps()", status, status != PRO_TK_NO_ERROR); status = ProSimprepdataNameGet( p_simprep_data, w_name ); TEST_CALL_REPORT( "ProSimprepdataNameGet()", "ProTestCollectSolidSimpreps()", status, status != PRO_TK_NO_ERROR); ProWstringToString( name, w_name ); /* Print the simp rep name */ fprintf( fp_out, "%s\n", name ); /* Free the memory allocated by ProSimprepdataGet() */ status = ProSimprepdataFree( &p_simprep_data ); TEST_CALL_REPORT( "ProSimprepdataFree()", "ProTestCollectSolidSimpreps()", status, status != PRO_TK_NO_ERROR); } status = ProArrayFree( (ProArray*)&p_simpreps ); TEST_CALL_REPORT( "ProArrayFree()", "ProTestCollectSolidSimpreps()", status, status != PRO_TK_NO_ERROR); } return status;#else return (PRO_TK_E_NOT_FOUND);#endif}/*=========================================================================*\ File: TestCollect.c Function: ProTestFeatureArrayPrint Purpose: write feature information to a file Returns: 0 if successful, non-zero otherwise.\*=========================================================================*/int ProTestFeatureArrayPrint( ProFeature *p_features, /* In : list of features, allocated by ProArrayAlloc */ FILE *fp) /* In : file to output */{ ProError status; int i, n; ProFeattype feat_type; ProFeatStatus feat_status; /* Get the array size */ n = 0; status = ProArraySizeGet( p_features, &n ); TEST_CALL_REPORT( "ProArraySizeGet()", "ProTestFeatureArrayPrint()", status, status != PRO_TK_NO_ERROR); /* Print out the features array */ fprintf( fp, "Number of features:\t%d\n", n ); for( i=0; i<n; i++ ) { status = ProFeatureTypeGet( p_features + i, &feat_type ); TEST_CALL_REPORT( "ProFeatureTypeGet()", "ProTestFeatureArrayPrint()", status, status != PRO_TK_NO_ERROR); status = ProFeatureStatusGet( p_features + i, &feat_status ); TEST_CALL_REPORT( "ProFeatureStatusGet()", "ProTestFeatureArrayPrint()", status, status != PRO_TK_NO_ERROR); fprintf( fp, "Id %d,\ttype %d,\tstatus: %s\n", p_features[i].id, feat_type, ProUtilFeatureStatusToString( feat_status ) ); } return (0);}/*=========================================================================*\ File: TestCollect.c Function: ProTestCollectSolidFeatures() Purpose: On button function. Test solid features collection. Test visible features collection. Test asm comps collection. Returns: 0 if successful, non-zero otherwise.\*=========================================================================*/int ProTestCollectSolidFeatures( ProAppData p_appdata, int int_dummy ){ ProError status; ProMdl p_model; ProMdlType mdltype; ProFeature *p_features; /* Print the header */ fprintf( fp_out, "\n# Solid features\n" ); p_model = *((ProMdl*)p_appdata); /* Get solid features */ status = ProUtilCollectSolidFeatures( (ProSolid)p_model, &p_features ); /* Print out obtained features */ if( status == PRO_TK_NO_ERROR ) { ProTestFeatureArrayPrint(p_features, fp_out); status = ProArrayFree( (ProArray*)&p_features ); TEST_CALL_REPORT( "ProArrayFree()", "ProTestCollectSolidFeatures()", status, status != PRO_TK_NO_ERROR); } /* Get visible features */ status = ProUtilCollectSolidFeatvis( (ProSolid)p_model, &p_features ); /* Print out obtained features */ if( status == PRO_TK_NO_ERROR ) { ProTestFeatureArrayPrint(p_features, fp_out); status = ProArrayFree( (ProArray*)&p_features ); TEST_CALL_REPORT( "ProArrayFree()", "ProTestCollectSolidFeatures()", status, status != PRO_TK_NO_ERROR); } status = ProMdlTypeGet(p_model, &mdltype); if (mdltype == PRO_MDL_ASSEMBLY) { /* Get asm comp features */ status = ProUtilCollectAsmcomp((ProAssembly) p_model, (ProAsmcomp**)&p_features ); /* Print out obtained features */ if( status == PRO_TK_NO_ERROR ) { ProTestFeatureArrayPrint(p_features, fp_out); status = ProArrayFree( (ProArray*)&p_features ); TEST_CALL_REPORT( "ProArrayFree()", "ProTestCollectSolidFeatures()", status, status != PRO_TK_NO_ERROR); } } return status;}/*=========================================================================*\ File: TestCollect.c Function: ProUtilFeatureStatusToString() Purpose: Return the string with feature status Returns: Surface type name\*=========================================================================*/char *ProUtilFeatureStatusToString( ProFeatStatus feat_status /* In: Surface type to convert to string */){ int i; for( i=0; feature_status_name[i].p_name != NULL; i++ ) if( feature_status_name[i].type == feat_status ) return feature_status_name[i].p_name; return "unknown";}/*=========================================================================*\ File: TestCollect.c Function: ProTestCollectModelNotes() Purpose: On button function. Test solid notes collection. Returns: 0 if successful, non-zero otherwise.\*=========================================================================*/int ProTestCollectModelNotes( ProAppData p_appdata, int int_dummy ){ ProError status; ProMdl p_model; ProModelitem *p_notes; ProName w_name; ProCharName name; int n; int i; /* Print the header */ fprintf( fp_out, "\n# Model notes\n" ); p_model = *((ProMdl*)p_appdata); if( p_model == NULL ) return -1; /* Get solid notes */ status = ProUtilCollectModelNotes( p_model, &p_notes ); /* Print out obtained notes */ if( status == PRO_TK_NO_ERROR ) { /* Get the array size */ n = 0; status = ProArraySizeGet( p_notes, &n ); TEST_CALL_REPORT( "ProArraySizeGet()", "ProTestCollectModelNotes()", status, status != PRO_TK_NO_ERROR); /* Print out the notes array */ fprintf( fp_out, "Number of notes:\t%d\n", n ); for( i=0; i<n; i++ ) { status = ProModelitemNameGet( p_notes+i, w_name ); TEST_CALL_REPORT( "ProModelitemNameGet()", "ProTestCollectModelNotes()", status, status != PRO_TK_NO_ERROR); ProWstringToString( name, w_name ); fprintf( fp_out, "%s\n", name ); } status = ProArrayFree( (ProArray*)&p_notes ); TEST_CALL_REPORT( "ProArrayFree()", "ProTestCollectModelNotes()", status, status != PRO_TK_NO_ERROR); } return status;}/*=========================================================================*\ File: TestCollect.c Function: ProTestCollectMfgTools() Purpose: On button function. Test manufacturing tools collection. Returns: 0 if successful, non-zero otherwise.\*=========================================================================*/int ProTestCollectMfgTools( ProAppData p_appdata, int int_dummy ){ ProError status = PRO_TK_NO_ERROR; ProMdl p_model; ProTool *p_tools; ProToolType tool_type; int n; int i; /* Print the header */ fprintf( fp_out, "\n# Manufacturing tools\n" ); p_model = *((ProMdl*)p_appdata); if( p_model == NULL ) return -1; /* Get solid tools */ /*status =*/ ProUtilCollectMfgTools( (ProMfg)p_model, &p_tools ); /* Print out obtained tools */ if( status == PRO_TK_NO_ERROR ) { /* Get the array size */ n = 0; status = ProArraySizeGet( p_tools, &n ); TEST_CALL_REPORT( "ProArraySizeGet()", "ProTestCollectMfgTools()", status, status != PRO_TK_NO_ERROR); /* Print out the tools array */ fprintf( fp_out, "Number of mfg tools:\t%d\n", n ); for( i=0; i<n; i++ ) { /* Get the tool type */ tool_type = PRO_TOOL_NONE; status = ProToolTypeGet( p_tools+i, &tool_type ); TEST_CALL_REPORT( "ProToolTypeGet()", "ProTestCollectMfgTools()", status, status != PRO_TK_NO_ERROR); fprintf( fp_out, "%s\n", ProUtilToolTypeToString( tool_type ) ); } status = ProArrayFree( (ProArray*)&p_tools ); TEST_CALL_REPORT( "ProArraySizeGet()", "ProTestCollectMfgTools()", status, status != PRO_TK_NO_ERROR); } return status;}/*=========================================================================*\ File: TestCollect.c Function: ProUtilToolTypeToString() Purpose: Return the string with feature status Returns: Surface type name\*=========================================================================*/char *ProUtilToolTypeToString( ProToolType tool_type /* In: Tool type */){ int i; for( i=0; tool_type_name[i].p_name != NULL; i++ ) if( tool_type_name[i].type == tool_type ) return tool_type_name[i].p_name; return "unknown";}/*=========================================================================*\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -