[cgma-dev] r2136 - cgm/trunk/geom/OCC
janehu at mcs.anl.gov
janehu at mcs.anl.gov
Wed Oct 8 13:03:04 CDT 2008
Author: janehu
Date: 2008-10-08 13:03:04 -0500 (Wed, 08 Oct 2008)
New Revision: 2136
Modified:
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCSurface.cpp
Log:
Use 1x10^-7 instead of 1x10^-6 as tolerance as seen in Extrema_ExtPS intenal uses.
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-10-07 20:15:04 UTC (rev 2135)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-10-08 18:03:04 UTC (rev 2136)
@@ -3792,7 +3792,6 @@
{
//in OCC, there's no sweep surface with draft option, this can be done by
//creating draft shell then make solid to achieve.
-/*
TopoDS_Shape *stop_shape = NULL;
if(stop_surf)
{
@@ -3814,6 +3813,31 @@
for (int i = ref_ent_list.size(); i > 0; i--)
{
GeometryEntity *ref_ent = ref_ent_list.get_and_step();
+ //check if the ref_ent has free boundary, if not, bail out
+ OCCSurface* surface = CAST_TO(ref_ent, OCCSurface);
+ if(surface != NULL)
+ {
+ if(surface->my_body() == NULL)
+ continue;
+ }
+ CubitVector center = surface->center_point();
+ CubitVector normal;
+ surface->closest_point(center,NULL,&normal);
+ if(normal % sweep_vector > 0)
+ {
+ DLIList<Surface*> surfaces;
+ surfaces.append(surface);
+ flip_normals(surfaces);
+ surface = CAST_TO(surfaces.get(), OCCSurface);
+ ref_ent = (GeometryEntity *)surface;
+ }
+
+ else if(normal % sweep_vector == 0)
+ {
+ PRINT_ERROR("Sweeping direction should not be on the surface.\n");
+ continue;
+ }
+
TopoDS_Shape* toposhape =
OCCQueryEngine::instance()->get_TopoDS_Shape_of_entity(ref_ent);
TopoDS_Wire wire;
@@ -3833,14 +3857,7 @@
wire = BRepBuilderAPI_MakeWire(edge);
toposhape = &wire;
}
-
- //check if the ref_ent has free boundary, if not, bail out
- OCCSurface* surface = CAST_TO(ref_ent, OCCSurface);
- if(surface != NULL)
- {
- if(surface->my_body() == NULL)
- continue;
- }
+
//create the draft
BRepOffsetAPI_MakeDraft draft(*toposhape, adir, draft_angle);
BRepBuilderAPI_TransitionMode Cornertype;
@@ -3862,9 +3879,9 @@
assert(tbs.size() == 1);
BodySM* bodysm = CAST_TO(tbs.get(), BodySM);
- if(surface != NULL) //only gets swept side and top surfaces
+ if(bodysm && surface != NULL) //only gets swept side and top surfaces
{
- //get surfaces from the shell body and add the original surface to
+ //get surfaces from the shell body and add the original surface to
//make a swept solid.
OCCShell* occ_shell = CAST_TO(bodysm, OCCBody)->shell();
if(!occ_shell)
@@ -3872,13 +3889,12 @@
PRINT_WARNING("Sweep surface failed inside OCC engine.\n");
return CUBIT_FAILURE;
}
- DLIList<OCCCoFace*> cofaces = occ_shell->cofaces();
+ DLIList<OCCCoFace*> cofaces = occ_shell->cofaces();
DLIList<Surface*> surface_list;
surface_list.append(surface);
for(int i = 0; i < cofaces.size(); i++)
surface_list.append(cofaces.get_and_step()->surface());
- flip_normals(surface_list);
DLIList<BodySM*> bodies;
create_solid_bodies_from_surfs(surface_list, bodies);
@@ -3893,7 +3909,6 @@
if (bodysm)
result_body_list.append(bodysm);
}
-*/
return CUBIT_SUCCESS;
}
Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp 2008-10-07 20:15:04 UTC (rev 2135)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp 2008-10-08 18:03:04 UTC (rev 2136)
@@ -405,7 +405,7 @@
gp_Pnt p(location.x(), location.y(), location.z()), newP(0.0, 0.0, 0.0);
double minDist=0.0;
int i;
- Extrema_ExtPS ext(p, asurface, Precision::Approximation(), Precision::Approximation());
+ Extrema_ExtPS ext(p, asurface, Precision::Confusion(), Precision::Confusion());
if (ext.IsDone() && (ext.NbExt() > 0)) {
for ( i = 1 ; i <= ext.NbExt() ; i++ ) {
if ( (i==1) || (p.Distance(ext.Point(i).Value()) < minDist) ) {
More information about the cgma-dev
mailing list