creo二次开发中主表示的坑
creo中的坑:
ProSolidSimprepVisit 这个函数遍历只能得到默认表示的 主表示 却不能得到活动的主表示(即当前显示的主表示),那么要前面那个函数有何用??
想要得到活动的主表示,需要用到ProSimprepActiveGet 这个函数,然后遍历所有的项数据,具体代码如下:
ProError ProUtilCollect2ParamDBVisitAction( void *p_object, /* In: The pointer to the object being visited */ ProAppData app_data) /* In: In fact it's ProArray** */ { ProError status; ProArray *p_array; p_array = (ProArray*)((void**)app_data)[0]; status = ProArrayObjectAdd(p_array, PRO_VALUE_UNUSED, 1, p_object ); return (status); } ProError ProUtilCollect3ParamDBVisitAction( void *p_object, /* In: The pointer to the object being visited */ ProError status, /* In: The status returned by filter func */ ProAppData app_data) /* In: In fact it's ProArray** */ { return (ProUtilCollect2ParamDBVisitAction(p_object, app_data)); } ProError ProUtilCollectSimprepsdataitems( ProSimprepdata *p_simprepdata,/* In: The simprepdata handle */ ProSimprepitem **p_simprepitems /* Out: ProArray with collected simp reps items. The function allocates memory for this argument, but you must free it. To free the memory, call the function ProArrayFree() */ ) { ProError status; if( p_simprepitems != NULL ) { status = ProArrayAlloc(0,sizeof(ProSimprepitem), 1, (ProArray*)p_simprepitems); if( status == PRO_TK_NO_ERROR ) { status = ProSimprepdataitemsVisit( p_simprepdata, (ProFunction)NULL, (ProFunction)ProUtilCollect3ParamDBVisitAction, (ProAppData)&p_simprepitems ); if( status != PRO_TK_NO_ERROR ) { ProArrayFree( (ProArray*)p_simprepitems ); *p_simprepitems = NULL; } } } else status = PRO_TK_BAD_INPUTS; return (status); } ProError ProTestSRepItemsVisit ( ProSimprepitem *item, ProSolid solid, vector<ProAsmcomppath> &arrayComPath ) { wchar_t wname[PRO_MDLNAME_SIZE]; char name[PRO_MDLNAME_SIZE]; ProAsmcomppath comp_path; ProMdl model; ProFeature feature; ProFeattype type; ProBoolean is_visibile; ProError status; if ( item->item_path.path_size == PRO_VALUE_UNUSED ) { /*--------------------------------------------------------------------*\ Feature simp rep \*--------------------------------------------------------------------*/ status = ProFeatureInit(solid, item->item_path.feat_id, &feature); status = ProFeatureTypeGet(&feature, &type); } else { /*--------------------------------------------------------------------*\ Assembly simp rep \*--------------------------------------------------------------------*/ status = ProAsmcomppathInit(solid, item->item_path.comp_path, item->item_path.path_size, &comp_path); //status = ProAsmcomppathMdlGet(&comp_path, &model); //status = ProMdlMdlnameGet(model, wname); is_visibile = PRO_B_TRUE; status = ProAsmcompVisibilityGet( &comp_path, NULL, &is_visibile ); if( status == PRO_TK_NO_ERROR && is_visibile == PRO_B_TRUE) arrayComPath.push_back(comp_path); } return PRO_TK_NO_ERROR; }
//通过ProSolid 获得 主表示
此处内容已隐藏,评论后刷新即可查看!
转载请注明出处: 芝麻开花
本文的链接地址: http://www.vmould.cn/?post=192
下一篇
ProToolkit开发向导
您可能对以下文章感兴趣
发表评论 取消回复