Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Register Log in

where can i find the ROUND FEATURE TREE????

chandra4

New member
Hi, ander


Here is the code for round feature for one edge only. If you want more edges


extend code


/*=====================================================*\
FUNCTION : UserEdgeRoundCreate()
PURPOSE : Function for creation of Single-Edge Round features.
\*=====================================================*/


ProError ProUserEdgeRoundCreate(Dt3 *mdl,int edge_id,double fil_rad,wchar_t* fil_name)



{

ProErrorlist errors;
ProSelection model_sel;
ProFeature&n bsp; feature;
ProFeatureCreateOptions opts[1];

ProAsmcomppath&nbs p; *p_comp_path = NULL;
ProCollection collection;
ProCrvcollinstr instr;
ProModelitem model_item;
ProReference reference;
ProElement pro_e_feature_tree;
ProElement pro_e_feature_type;
ProElement pro_e_std_feature_name;
ProElement pro_e_rndch_sets;
ProElement pro_e_rndch_set;
ProElement pro_e_rndch_shape_options;
ProElement pro_e_rndch_compound_conic;
ProElement pro_e_rndch_conic_type;
ProElement pro_e_rndch_references;
ProElement pro_e_rndch_reference_type;
ProElement pro_e_std_curve_collection_appl;
ProElement pro_e_rndch_radii;
ProElement pro_e_rndch_radius;
ProElement pro_e_rndch_leg1;
ProElement pro_e_rndch_leg_type;
ProElement pro_e_rndch_leg_value;
ProElement pro_e_rndch_attach_type;

ProError status;




//Populating root element PRO_E_FEATURE_TREE


status = ProElementAlloc ( PRO_E_FEATURE_TREE, &pro_e_feature_tree );


// Populating element PRO_E_FEATURE_TYPE


status = ProElementAlloc ( PRO_E_FEATURE_TYPE, &pro_e_feature_type );
status = ProElementIntegerSet ( pro_e_feature_type, PRO_FEAT_ROUND );
status = ProElemtreeElementAdd ( pro_e_feature_tree, NULL, pro_e_feature_type );


// Populating element PRO_E_STD_FEATURE_NAME


status = ProElementAlloc ( PRO_E_STD_FEATURE_NAME, &pro_e_std_feature_name );
// ProStringToWstring
status = ProElementWstringSet ( pro_e_std_feature_name, fil_name );
status = ProElemtreeElementAdd ( pro_e_feature_tree, NULL, pro_e_std_feature_name );

// Populating element PRO_E_RNDCH_SETS


status = ProElementAlloc ( PRO_E_RNDCH_SETS, &pro_e_rndch_sets );
status = ProElemtreeElementAdd ( pro_e_feature_tree, NULL, pro_e_rndch_sets );

//Populating element PRO_E_RNDCH_SET


status = ProElementAlloc ( PRO_E_RNDCH_SET, &pro_e_rndch_set );
status = ProElemtreeElementAdd ( pro_e_rndch_sets, NULL, pro_e_rndch_set );

//Populating element PRO_E_RNDCH_SHAPE_OPTIONS


status = ProElementAlloc ( PRO_E_RNDCH_SHAPE_OPTIONS, &pro_e_rndch_shape_options );
status = ProElementIntegerSet ( pro_e_rndch_shape_options,PRO_ROUND_TYPE_CONSTANT );
status = ProElemtreeElementAdd ( pro_e_rndch_set, NULL, pro_e_rndch_shape_options);

//Populating element PRO_E_RNDCH_COMPOUND_CONIC


status = ProElementAlloc ( PRO_E_RNDCH_COMPOUND_CONIC, &pro_e_rndch_compound_conic );
status = ProElemtreeElementAdd ( pro_e_rndch_set, NULL, pro_e_rndch_compound_conic );


// Populating element PRO_E_RNDCH_CONIC_TYPE


status = ProElementAlloc ( PRO_E_RNDCH_CONIC_TYPE, &pro_e_rndch_conic_type );


status = ProElementIntegerSet ( pro_e_rndch_conic_type, PRO_ROUND_CONIC_DISABLE );
status = ProElemtreeElementAdd ( pro_e_rndch_compound_conic, NULL, pro_e_rndch_conic_type );

//Populating element PRO_E_RNDCH_REFERENCES


status = ProElementAlloc ( PRO_E_RNDCH_REFERENCES, &pro_e_rndch_references );
status = ProElemtreeElementAdd ( pro_e_rndch_set, NULL, pro_e_rndch_references);

//Populating element PRO_E_RNDCH_REFERENCE_TYPE


status = ProElementAlloc ( PRO_E_RNDCH_REFERENCE_TYPE, &pro_e_rndch_reference_type );
status = ProElementIntegerSet ( pro_e_rndch_reference_type,PRO_ROUND_REF_EDGE );
status = ProElemtreeElementAdd ( pro_e_rndch_references, NULL, pro_e_rndch_reference_type );

// Populating element PRO_E_STD_CURVE_COLLECTION_APPL


status = ProElementAlloc ( PRO_E_STD_CURVE_COLLECTION_APPL, &pro_e_std_curve_collection_appl );
status = ProCrvcollectionAlloc ( &collection );



status = ProCrvcollinstrAlloc ( PRO_CURVCOLL_ADD_ONE_INSTR , &instr );
{
ProSelection sel_array;


status=ProUtilSelectionFromEdgeId(mdl->model,edge_i d,&sel_array);

printf("\n At Edge Selection 1:%d",edge_id);
status = ProSelectionToReference ( sel_array, &reference );


}
status = ProCrvcollinstrReferenceAdd ( instr, reference );
status = ProCrvcollectionInstructionAdd ( collection, instr );



status = ProCrvcollinstrAlloc ( PRO_CURVCOLL_ADD_TANGENT_INSTR, &instr );
status = ProCrvcollectionInstructionAdd ( collection, instr );
status = ProElementCollectionSet( pro_e_std_curve_collection_appl, collection );
status = ProElemtreeElementAdd ( pro_e_rndch_references, NULL, pro_e_std_curve_collection_appl );


//Populating element PRO_E_RNDCH_RADII


status = ProElementAlloc ( PRO_E_RNDCH_RADII, &pro_e_rndch_radii );
status = ProElemtreeElementAdd ( pro_e_rndch_set, NULL, pro_e_rndch_radii );

// Populating element PRO_E_RNDCH_RADIUS


status = ProElementAlloc ( PRO_E_RNDCH_RADIUS, &pro_e_rndch_radius );
status = ProElemtreeElementAdd ( pro_e_rndch_radii, NULL, pro_e_rndch_radius );

//Populating element PRO_E_RNDCH_LEG1


status = ProElementAlloc ( PRO_E_RNDCH_LEG1, &pro_e_rndch_leg1 );
status = ProElemtreeElementAdd ( pro_e_rndch_radius, NULL, pro_e_rndch_leg1 );

//Populating element PRO_E_RNDCH_LEG_TYPE


status = ProElementAlloc ( PRO_E_RNDCH_LEG_TYPE, &pro_e_rndch_leg_type );
status = ProElementIntegerSet ( pro_e_rndch_leg_type, PRO_ROUND_RADIUS_TYPE_VALUE );
status = ProElemtreeElementAdd ( pro_e_rndch_leg1, NULL, pro_e_rndch_leg_type );

// Populating element PRO_E_RNDCH_LEG_VALUE


status = ProElementAlloc ( PRO_E_RNDCH_LEG_VALUE, &pro_e_rndch_leg_value );
status = ProElementDoubleSet ( pro_e_rndch_leg_value, fil_rad);
status = ProElemtreeElementAdd ( pro_e_rndch_leg1, NULL, pro_e_rndch_leg_value );


// Populating element PRO_E_RNDCH_ATTACH_TYPE


status = ProElementAlloc ( PRO_E_RNDCH_ATTACH_TYPE, &pro_e_rndch_attach_type );
status = ProElementIntegerSet ( pro_e_rndch_attach_type, PRO_ROUND_ATTACHED );
status = ProElemtreeElementAdd ( pro_e_feature_tree, NULL, pro_e_rndch_attach_type );

//Creating feature in the current model.


status = ProMdlToModelitem( mdl->model, &model_item );
status = ProSelectionAlloc (p_comp_path, &model_item, &model_sel);
opts[0] = PRO_FEAT_CR_INCOMPLETE_FEAT;
status = ProFeatureCreate (model_sel, pro_e_feature_tree, opts, 1, &feature, &errors);



//Free up the allocated memory.


status = ProElementFree (&pro_e_feature_tree );
return (status);


}
 

Sponsor

Top