Continue to Site

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.

about ProSolidFeatVisit

stomata

New member
Hi all,
I am confused using this function.
In PTC's documentations, it said....

"ProSolidFeatVisit()
 
Hi,


Some time in a Part you required to find out some inteneded features are exist then you need to traverse the model tree corresponding part.There is significantrole of Visit functionswith in the Pro-Toolkit .


As per the Assembly is concern "Feaure" is the PART or Component. You can traverse the model tree of the given assembly using the same visit function.


Finally Visit functions are plays key role to retrieve information in a single attempt.


With regards,


Kishore V
 
here is the core of the action function i use to visit members of an assembly


// Visit the features this way with this function on the current solid
ProSolidFeatVisit(solid, Action, NULL, NULL);


/*========================================================== ==========*\
FUNCTION : Action()
PURPOSE: Visit action function called for each feature
\*========================================================== ==========*/
ProError Action(ProFeature *feature, ProError filt_status, ProAppData data)
{
ProError err;

// If the feature is not active, skip it
ProFeatStatus FeatureStatus;
ProFeatureStatusGet(feature, &FeatureStatus);
if(FeatureStatus != PRO_FEAT_ACTIVE)
return(PRO_TK_NO_ERROR);


// if we are in assembly we will have component feature which contain a pointer to our part
ProFeattype FeatureType;
ProFeatureTypeGet(feature, &FeatureType);
if(FeatureType == PRO_FEAT_COMPONENT) {


// Retrieve the component feature from the assembly
ProElement FeatureTree;
err = ProFeatureElemtreeCreate(feature, &FeatureTree);
if(err == PRO_TK_NO_ERROR) {


// path to PRO_E_COMPONENT_MODEL element which contain our Part Solid
ProElempath path;
ProElempathItem path_items[2];
ProValue value;
ProValueData value_data;
ProElement part_element;


path_items[0].type = PRO_ELEM_PATH_ITEM_TYPE_ID;
path_items[0].path_item.elem_id = PRO_E_COMPONENT_MODEL;
err = ProElempathAlloc(&path);
err = ProElempathDataSet(path, path_items, 1);
err = ProElemtreeElementGet(FeatureTree, path, &part_element);


// the element exists in the tree ?
if(err == PRO_TK_NO_ERROR) {
err = ProElementValueGet(part_element, &value);
err = ProValueDataGet(value, &value_data);


// Retrieve the part
ProSolid Part = (ProSolid)(value_data.v.p);


//...
// here you can test if its a part or an assembly to ProMdlTypeGet
//...


}


// free path items
ProElempathFree(&path);
ProFeatureElemtreeFree(feature, FeatureTree);
}
}


return(PRO_TK_NO_ERROR);
}
 
oh thanks
I was using the ProMdlDependenciesList instead but that doesn't give me the ProMdl object.
so I better retry the visit funtion.
THANKS!
 

Sponsor

Back
Top