ProError SectionCreate(ProSection section,ProName section_name,int hole_offset,ProMdl mdl) { ProError status, solve_status; Pro2dCircledef circle; Pro2dLinedef line; int bottom_id, right_id, top_id, left_top_id,left_bottom_id, arc_id; int width_dim, height_dim, bite_height_dim, bite_radius_dim,circle_id; ProSectionPointType pnt_types[2]; Pro2dPnt point; int n_errors, e; ProWSecerror errors; ProMsg wmsg; char msg[PRO_PATH_SIZE]; int dims[2]; double width = a; double height = b; ProFeature exfeat; int sum; ProBoolean b; int n_sec,i,error_id; ProMsg error_message; char error_message_s[100]; ProWSecerror section_errors1; /*-----------------------------------------------------------*\ Set the epsilon value. \*-----------------------------------------------------------*/ status = ProSectionEpsilonSet (section, 0.5); /*-----------------------------------------------------------*\ Add a straight-line entity for the bottom of the rectangle. \*-----------------------------------------------------------*/ line.type = PRO_2D_LINE; line.end1[0] = 0.0; line.end1[1] = 0.0; line.end2[0] = width; line.end2[1] = 0.0; status = ProSectionEntityAdd (section, (Pro2dEntdef*)&line, &bottom_id); /*-----------------------------------------------------------*\ ...right \*-----------------------------------------------------------*/ line.type = PRO_2D_LINE; line.end1[0] = width; line.end1[1] = 0.0; line.end2[0] = width; line.end2[1] = height; status = ProSectionEntityAdd (section, (Pro2dEntdef*)&line, &right_id); /*-----------------------------------------------------------*\ ...top \*-----------------------------------------------------------*/ line.type = PRO_2D_LINE; line.end1[0] = width; line.end1[1] = height; line.end2[0] = 0.0; line.end2[1] = height; status = ProSectionEntityAdd (section, (Pro2dEntdef*)&line, &top_id); /*-----------------------------------------------------------*\ ...left \*-----------------------------------------------------------*/ line.type = PRO_2D_LINE; line.end1[0] = 0.0; line.end1[1] = height; line.end2[0] = 0.0; line.end2[1] = 0.0; status = ProSectionEntityAdd (section, (Pro2dEntdef*)&line, &left_top_id); ////////////////////////////////////////////////////////////////// status = ProSectionIntentManagerModeSet(section,b);// b = PRO_B_FALSE /*-----------------------------------------------------------*\ Claim memory for the error structure. \*-----------------------------------------------------------*/ status = ProSecerrorAlloc (&errors); status = ProSecerrorAlloc (§ion_errors1); status = ProSectionAutodim(section,&errors); //status = -1 if ( status != PRO_TK_NO_ERROR ) { status = ProSecerrorCount ( &errors, &n_sec ); //status = PRO_TK_NO_ERROR, n_sec = 0 for ( i = 0; i < n_sec; i++ ) { status = ProSecerrorMsgGet (errors, i, error_message); ProWstringToString (error_message_s, error_message); status = ProSecerrorItemGet ( section_errors1, i, &error_id); } } status = ProSectionRegenerate ( section, &errors ); //status = -1 if ( status != PRO_TK_NO_ERROR ) status = ProSecerrorCount ( &errors, &n_sec ); //status = PRO_TK_NO_ERROR, n_sec = 0 /*-----------------------------------------------------------*\ Solve the section. \*-----------------------------------------------------------*/ solve_status = ProSectionSolve (section, &errors);//solve_status = -1 /*-----------------------------------------------------------*\ Return the section handle \*-----------------------------------------------------------*/ status = ProSecerrorFree(&errors); return PRO_TK_NO_ERROR; } ProError ECADFeature() { options[0] = PRO_FEAT_CR_INCOMPLETE_FEAT; status = ProMdlToModelitem( mdl, &model_item ); //My mdl type is part. status = ProSelectionAlloc( NULL, &model_item, &model_selection ); status = ProFeatureCreate ( model_selection, feat_elemtree, options, 1, &created_feature, &p_errors ); /* Using the element tree from created feature */ status = ProFeatureElemtreeExtract (&created_feature, NULL, PRO_FEAT_EXTRACT_NO_OPTS, &created_elemtree); path_items[0].type = PRO_ELEM_PATH_ITEM_TYPE_ID; path_items[0].path_item.elem_id = PRO_E_STD_SECTION; path_items[1].type = PRO_ELEM_PATH_ITEM_TYPE_ID; path_items[1].path_item.elem_id = PRO_E_SKETCHER; status = ProElempathAlloc (&path); status = ProElempathDataSet (path, path_items, 2); status = ProElemtreeElementGet ( created_elemtree, path, &sketch_element); status = ProElementValueGet ( sketch_element, &value); status = ProValueDataGet (value, &value_data); section = (ProSection)value_data.v.p; ProStringToWstring(item_name,"Section2"); SectionCreate((ProSection)(value_data.v.p),item_name,2,mdl); options[0] = PRO_FEAT_CR_DEFINE_MISS_ELEMS; // status = ProFeatureRedefine (NULL, &created_feature, created_elemtree, options, 1, &p_errors); // return -1 }