[cgma-dev] errors with OCC

Jiangtao Hu jiangtao_ma at yahoo.com
Thu Nov 20 15:39:13 CST 2008


Hi, Leidy

Please see comments below.

Jane

--- On Thu, 11/20/08, Leidy Suarez <ly.suarez at ingeciber.com> wrote:
From: Leidy Suarez <ly.suarez at ingeciber.com>
Subject: Re: [cgma-dev] errors with OCC
To: cgma-dev at mcs.anl.gov
Date: Thursday, November 20, 2008, 7:03 AM

Hi,

1.  And another bug in line 73 in file:  "OCCDrawTool.cpp" :

OCCSurface *occ_face = CAST_TO(occ_face, OCCSurface);


Maybe is:

OCCSurface *occ_face = CAST_TO(face, OCCSurface);

This has been fixed in the updated version of OCC codes.

2. We have tried using "OCCDrawTool". The example is:

//======================== create objects
======================================
  //Create sphere
   RefEntity* sphereEnt= GeometryModifyTool::instance()->sphere(1.5);
   sphereEnt->entity_name("sphere");
//========================================================================
//======================== Plot objects ======================================

   TopoDS_CompSolid* objOCC;
   int numBodies = GeometryQueryTool::instance()->num_bodies();    Body*
tmpBd = GeometryQueryTool::instance()->get_first_body();
   for (int i = 0; i < numBodies; i++)
   {
       BodySM* tmpBdSM = tmpBd->get_body_sm_ptr();
       objOCC = ( (OCCBody*) tmpBdSM )->get_TopoDS_Shape(); //Opencascade
Object
       OCCDrawTool::instance()->draw_TopoDS_Shape(objOCC, 200);
       tmpBd = GeometryQueryTool::instance()->get_next_body();
   }
//========================================================================

We have had a problem when the method "draw_TopoDS_Shape" in the
calling of the method "draw_FACE".
The problem is exactly in the method "draw_FACE", when is called the
method "draw_curve".  Because in "get_graphics"  the
"facets" are not generated.
We have added the check:

//====================
 if (facets.IsNull())
   return CUBIT_FAILURE;
//====================

Why do you use the "BRep_Tool::Polygon3D" ?

The draw_TopoDS_Shape(TopoDS_Shape *shape, int color,
                      CubitBoolean tessellate,
                      CubitBoolean flush) 
has a boolean option of tesselation, for surfaces, if it's true,
it tries to give the triangulation of the surface; if it's false,
it tries to give the tesselation of the its boundary curves. 

Now if you use the updated version, and set tessellate to be true,
you can get the triangluation representive of the surface.

For a sphere, there should be no boundary curves, however, the code
generated 3 curves, including two degenerated curves, and a curve of
half its great circle. I don't know why and am investigating on it.
Also, as you pointed out, I need to first tessellate the edge before
using BRep_Tool::Polygon3D, which is to ask for edge's polygon 
representation.  

Tomorrow I'll make some more changes which will allow you to do display of 
edges only for surfaces, but for now, please don't use option of
tessellate = false.

Thanks.

Mahy thanks,
Leidy







      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mcs.anl.gov/mailman/private/cgma-dev/attachments/20081120/2df557c2/attachment.htm>


More information about the cgma-dev mailing list