Vin Yovanovich

Home Consulting Resume Pro/TOOLKIT Pro/RTOOLKIT Articles

 
 
 
typedef struct edgedata{
  ProSolid solid;
  double criticrad;
  vector<int> edge_ids;
} edgedata_type;


static ProError user_action_get_edge_ids(
  ProGeomitem  *g_handle,
  ProError     status,
  ProAppData   appdata)
{
  edgedata_type *edgd = (edgedata_type *)appdata;
  ProEdge thisedge;
  ProEnttype etype;
  ProError err;
  ProModelitem modelitem;
  ProSelection selection;
  ProSolid solid = edgd->solid;
  ProBoolean p_is_active;
  ProGeomitemdata *geomitemdata= NULL;
  double radius;

  ProGeomitemIsInactive(g_handle,&p_is_active);
  if(p_is_active==PRO_B_TRUE)
		return PRO_TK_NO_ERROR;

  ProEdgeInit(solid,g_handle->id,&thisedge);

  ProEdgeToGeomitem(solid,thisedge,&modelitem);
  ProEdgeTypeGet(thisedge,&etype);

  if (etype == PRO_ENT_ARC){
	ProGeomitemdataGet(g_handle,&geomitemdata);
	radius = geomitemdata->data.p_curve_data->arc.radius;
	//printf("%f\n",radius);
	if (radius >= edgd->criticrad){ // don't highlight anything in this case
		//printf("%f\n",radius);
		goto RETURN;
	}
	err=ProSelectionAlloc(NULL,&modelitem,&selection);
	if(err != PRO_TK_NO_ERROR){
		goto RETURN;  // failure to allocate memory
	}
    err=ProSelectionHighlight(selection,PRO_COLOR_HIGHLITE);
	err= ProSelectionFree(&selection);
    if(err != PRO_TK_NO_ERROR){
        goto RETURN;  // failure
    }
	edgd->edge_ids.push_back(g_handle->id);
  }

  RETURN : 
  ProGeomitemdataFree(&geomitemdata);
  return(PRO_TK_NO_ERROR);
}

   
static ProError user_action_get_feat4edge_ids(
  ProFeature  *feature,
  ProError     status,
  ProAppData   appdata)
{
  ProFeatureGeomitemVisit(feature,PRO_EDGE,(ProGeomitemAction )user_action_get_edge_ids,NULL,appdata);
  return(PRO_TK_NO_ERROR);
}
  
void ptk_edgeids(double rad)  // main function
{
  edgedata_type edgd; 
  long mdlhandle;

  edgd.solid = (ProSolid) mdlhandle;
  edgd.criticrad = rad;

  ProSolidFeatVisit(edgd.solid,(ProFeatureVisitAction)user_action_get_feat4edge_ids,NULL,(ProAppData) &edgd);
}
      

Home • About Me • Search • Site Map • Contact

 
 

Copyright @20XX   Vin Yovanovich,  All rights reserved.