- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
not able to get facet data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-28-2011 09:53 PM
I am not able to get facet data.
Is something missing in this code??
FILE *fp = NULL;
fp = fopen("PointData.txt","w");
api_start_modeller(0);
api_initialize_faceter();
BODY *hoop;
outcome o1 = api_make_torus(50,10,hoop);
//box bx = get_body_box(hoop);
//double sd = (bx.)
REFINEMENT *ref = new REFINEMENT();
ref->set_surf_mode(AF_SURF_ALL);
ref->set_adjust_mode(AF_ADJUST_NONE);
ref->set_triang_mode(AF_TRIANG_ALL);
ref->set_surface_tol(3.417601);
o1 = api_set_default_refinement(ref);
ENTITY_LIST face_list;
api_get_faces( hoop, face_list );
parameter_token ptoken[2];
ptoken[0] = POSITION_TOKEN;
ptoken[1] = NORMAL_TOKEN;
VERTEX_TEMPLATE *vt = new VERTEX_TEMPLATE(2,ptoken);
api_set_default_vertex_template(vt);
FACE *f = hoop->lump()->shell()->face_list();
int faceSize = f->size();
while(f)
{
POLYGON_POINT_MESH *facets = (POLYGON_POINT_MESH*)NULL;
o1 = api_facet_entity(f);
o1 = api_get_body_facets(hoop,facets);
//o1 = api_get_face_facets(f,facets);
POLYGON *poly;
POLYGON_VERTEX *poly_vtx;
SPAposition vtx_pos;//position vtx_pos;
int facetCount = facets->count();
for(poly=facets->first(); poly!=NULL; poly = poly->next())
{
for(poly_vtx = poly->first(); poly_vtx!=NULL;poly_vtx= poly_vtx->next())
{
poly_vtx->point(vtx_pos);
//double coordinate[3] = vtx_pos
fprintf(fp,"%lf,%lf,%lf",vtx_pos.x(),vtx_pos.y(),
}
}
delete facets;
f=f->next_in_list();
}
api_terminate_faceter();
api_stop_modeller();
fclose(fp);
return 0;
Re: not able to get facet data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-29-2011 02:41 PM
You need to preceed the call to api_facet_entity with storing off the old mesh manager and setting the new one. Then after the call to api_facet_entity, delete the mesh manager and restore the old one. We made a change recently to the faceter, and changed the default mesh manager from PPM_ON_FACE_MESH_MANAGER to INDEXED_MESH_MANAGER, since that seemed like the most popular. This was documented and I am sorry for the inconvenience.
So, your code would look something like the following:
MESH_MANAGER *oldMM = NULL;
MESH_MANAGER * MM = ACIS_NEW PPM_ON_FACE_MESH_MANAGER;
api_get_mesh_manager( oldMM );
api_set_mesh_manager( MM );
api_facet_entity(f);
api_set_mesh_manager( oldMM);
ACIS_DELETE MM;
You may want to move the allocation and deletion code of the mesh manager (and maybe the seg/get methods) outside your "for" loop.
Re: not able to get facet data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-02-2011 02:16 AM
Thanks

