构造要删除零件的特征del_feat
ProSelection *p_sel = NULL; int n_sel; ProMdl mdl; ProModelitem sel_item; ProFeature feature, p_feat_handle; ProMdl p_owner; ProAsmcomppath path; ProMdlCurrentGet(&mdl); std::vector<ProFeature> featls; err = ProSolidFeatVisit((ProSolid)mdl, ProFeatureVisitAction_f10, ProFeatureFilterAction_f10, &featls); err = ProSelect((char*)"prt_or_asm", 1, NULL,NULL, NULL, NULL, &p_sel, &n_sel); if (err != PRO_TK_NO_ERROR || n_sel < 1) return; err = ProSelectionAsmcomppathGet(p_sel[0], &path); if (err != PRO_TK_NO_ERROR) return; ProAsmcomppath father_path = path; father_path.table_num--; ProMdl father_mdl; err = ProAsmcomppathMdlGet(&father_path,&father_mdl); ProFeature del_feat; del_feat.owner = father_mdl; del_feat.id = path.comp_id_table[path.table_num-1]; del_feat.type = PRO_FEATURE; featureDel(&del_feat);
ProFeatureDelete函数
ProError featureDel(ProFeature *feat)
ProError err = PRO_TK_NO_ERROR; int featsDelids[1]; featsDelids[0]=feat->id; ProFeatureDeleteOptions delOps[]={PRO_FEAT_DELETE_NO_OPTS}; err=ProFeatureDelete((ProSolid)feat->owner,featsDelids,1,delOps,1); if (err != PRO_TK_NO_ERROR) return err; return err;动作 函数
ProError ProFeatureVisitAction_f10(ProFeature* p_feature, ProError status, ProAppData app_data);
ProError ProFeatureVisitAction_f10(ProFeature* p_feature, ProError status, ProAppData app_data){ std::vector<ProFeature>* pls = (std::vector<ProFeature>*)app_data; ProMdl p_mdl_handle; ProError err; ProFeattype p_type; ProMdlType ptype; ProBoolean p_is_auto_round_member; err = ProFeatureTypeGet(p_feature, &p_type); if (p_type == PRO_FEAT_COMPONENT) { ProAsmcompMdlGet((ProAsmcomp*)p_feature, &p_mdl_handle); ProMdlTypeGet(p_mdl_handle, &ptype); if (ptype == PRO_MDL_ASSEMBLY) { ProSolidFeatVisit((ProSolid)p_mdl_handle, ProFeatureVisitAction_f10, ProFeatureFilterAction_f10, app_data); } } pls->push_back(*p_feature); return PRO_TK_NO_ERROR;} 过滤函数
ProError ProFeatureFilterAction_f10(ProFeature* p_parameter, ProAppData app_data);
ProError ProFeatureFilterAction_f10(ProFeature* p_parameter, ProAppData app_data){ return PRO_TK_NO_ERROR;}
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删