cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

In Creo6 environment, ProToolkit C++ performs multiple sheet metal flattening operations, Creo crash

BJ_10214234
3-Newcomer

In Creo6 environment, ProToolkit C++ performs multiple sheet metal flattening operations, Creo crash

在Creo6环境中,ProToolkit C++进行多次钣金展平操作,Creo崩溃

在Creo6环境中,使用ProToolkit C++开发工具进行钣金展平操作,执行多次后有概率导致Creo遇到严重错误并弹出“自动回溯信息”窗口,点击窗口后Creo自动退出。
钣金展平部分代码如下:
---------------------------------------------------------------------------------------------------------------
Translated by Vivek Namboodheri using Google Translator on 11th May 2022:

 

In Creo6 environment, ProToolkit C++ performs multiple sheet metal flattening operations, Creo crashes.

 

In the Creo6 environment, use the ProToolkit C++ development tool to perform sheet metal flattening operations.

After multiple executions, there is a possibility that Creo encounters a serious error and pops up the "Auto Traceback Information" window. Creo automatically exits after clicking the window. The code for the sheet metal flattening part is as follows:


bool CreateUnBendFeature(ProSelection model_selection, const ProSelection& ref_surface_selection,
ProFeature& new_feature)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
ProAsmcomppath model_path;
ProSelectionAsmcomppathGet(model_selection, &model_path);
ProMdl create_mdl = NULL;
ProAsmcomppathMdlGet(&model_path, &create_mdl);
CString feature_name = _T("unbend_feat");
ProName new_feature_name = { 0 };
wcsncpy_s(name, PRO_NAME_SIZE, feature_name, _TRUNCATE);
ProElement feature_tree_root = NULL;
ProElementAlloc(PRO_E_FEATURE_TREE, &feature_tree_root);
ProElement elem_feature_type = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_FEATURE_TYPE,
PRO_FEAT_UNBEND, elem_feature_type);
ProElement elem_feature_name = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_STD_FEATURE_NAME,
new_feature_name, elem_feature_name);
ProElement elem_unbend_type = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_UNBEND_TYPE,
1, elem_unbend_type);
ProElement elem_unbend_sub_type = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_UNBEND_SUB_TYPE,
0, elem_unbend_sub_type);
ProElement elem_primary_fixed_geom = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_PRIMARY_FIXED_GEOM,
elem_primary_fixed_geom);
ProElement elem_fix_ref = NULL;
CElementOperator::AddElement(elem_primary_fixed_geom, PRO_E_SMT_FIXED_REF,
ref_surface_selection, elem_fix_ref);
ProElement elem_fix_ref_side = NULL;
CElementOperator::AddElement(elem_primary_fixed_geom, PRO_E_SMT_FIXED_REF_SIDE,
-1, elem_fix_ref_side);
ProElement elem_unbend_ref_arr = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_UNBEND_REF_ARR,
elem_unbend_ref_arr);
ProElement elem_auto_deform_ref_arr = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_AUTO_DEFORM_REF_ARR,
elem_auto_deform_ref_arr);
ProElement elem_deform_surfaces = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_DEFORM_SURFACES,
elem_deform_surfaces);
ProElement elem_surf_collection_appl = NULL;
CElementOperator::AddElement(elem_deform_surfaces, PRO_E_STD_SURF_COLLECTION_APPL,
elem_surf_collection_appl);
ProElement elem_distinct_areas_arr = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_DISTINCT_AREAS_ARR,
elem_distinct_areas_arr);
ProElement elem_distincy_area = NULL;
CElementOperator::AddElement(elem_distinct_areas_arr, PRO_E_SMT_DISTINCT_AREA,
elem_distincy_area);
ProElement elem_add_fixed_geom = NULL;
CElementOperator::AddElement(elem_distincy_area, PRO_E_SMT_ADD_FIXED_GEOM,
elem_add_fixed_geom);
ProElement elem_fixed_ref = NULL;
CElementOperator::AddElement(elem_add_fixed_geom, PRO_E_SMT_FIXED_REF,
ref_surface_selection, elem_fixed_ref);
ProElement elem_fixed_ref_side = NULL;
CElementOperator::AddElement(elem_add_fixed_geom, PRO_E_SMT_FIXED_REF_SIDE,
-1, elem_fixed_ref);
ProElement elem_add_corner_reliefs_opts = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_ADD_CORNER_RELIEFS_OPTS,
elem_add_corner_reliefs_opts);
ProElement elem_add_corner_reliefs = NULL;
CElementOperator::AddElement(elem_add_corner_reliefs_opts, PRO_E_SMT_ADD_CORNER_RELIEFS,
1, elem_add_corner_reliefs);
ProElement elem_add_corner_reliefs_type = NULL;
CElementOperator::AddElement(elem_add_corner_reliefs_opts, PRO_E_SMT_ADD_CORNER_RELIEFS_TYPE,
0, elem_add_corner_reliefs_type);
ProElement elem_flatten_form_walls = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_FLATTEN_FORM_WALLS,
1, elem_flatten_form_walls);
ProElement elem_flatten_all_forms = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_FLATTEN_ALL_FORMS,
0, elem_flatten_all_forms);
ProElement elem_flatten_proj_cuts = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_FLATTEN_PROJ_CUTS,
0, elem_flatten_proj_cuts);
ProElement elem_merge_same_sides = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_MERGE_SAME_SIDES,
0, elem_merge_same_sides);
ProElement elem_flat_pat_bbox_dims = NULL;
CElementOperator::AddElement(feature_tree_root, PRO_E_SMT_FLAT_PAT_BBOX_DIMS,
0, elem_flat_pat_bbox_dims);
ProModelitem active_mdlitem;
ProMdlToModelitem(create_mdl, &active_mdlitem);
ProSelection active_mdl_selection;
ProSelectionAlloc(&model_path, &active_mdlitem, &active_mdl_selection);
ProFeatureCreateOptions opts[1];
opts[0] = PRO_FEAT_CR_NO_OPTS;
ProErrorlist errors;
ProFeatureCreate(active_mdl_selection, feature_tree_root, opts, 1, &new_feature, &errors);
ProElementFree(&feature_tree_root);
return true;
}

0 REPLIES 0
Announcements


Top Tags