[cgma-dev] r5370 - cgm/trunk/geom/OCC

jiangtao_ma at yahoo.com jiangtao_ma at yahoo.com
Thu Feb 2 10:11:55 CST 2012


Author: janehu
Date: 2012-02-02 10:11:55 -0600 (Thu, 02 Feb 2012)
New Revision: 5370

Modified:
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
Log:
Added a preventive check on offset curve code, to make sure the result offset curve is at the correctly offset direction. No changes on testcase.

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2012-02-02 16:03:00 UTC (rev 5369)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2012-02-02 16:11:55 UTC (rev 5370)
@@ -1836,7 +1836,7 @@
     TopoDS_Shape newShape = api_copy.ModifiedShape(*theCS);
 
     TopoDS_Compound newCS = TopoDS::Compound(newShape);
-    OCCQueryEngine::instance()->copy_attributes(*theCS, newCS);
+    //OCCQueryEngine::instance()->copy_attributes(*theCS, newCS);
 
     new_body = OCCQueryEngine::instance()->populate_topology_bridge(newCS);
     copy_body_attributes((TopoDS_Shape)(*theCS), api_copy);
@@ -6627,11 +6627,31 @@
     for(int i = 0 ; i < curves.size(); i++)
     {
       TopoDS_Edge new_edge = Ex.Current();
+      Curve* curve = curves.get_and_step();
       Curve* offset_curve = 
         OCCQueryEngine::instance()->populate_topology_bridge(new_edge, CUBIT_TRUE);
+      //double check here to make sure we get the correct offset curve
+      //which is if the offset_distance is positive, the new curve should be
+      //longer than the original curve.
+      if(i == 0)
+      {
+        double d_offset = offset_curve->measure();
+        double d_orig = curve->measure();
+        if((offset_distance > 0 && d_offset < d_orig) ||
+           (offset_distance < 0 && d_offset > d_orig)) 
+        {
+          for(int j = 0; j < curves.size(); j++)
+            Ex.Next();
+          Ex.Next();  
+        }
+        TopoDS_Edge new_edge = Ex.Current();
+        offset_curve = OCCQueryEngine::instance()->
+            populate_topology_bridge(new_edge, CUBIT_TRUE);
+      }    
       new_curves.append(offset_curve);
       Ex.Next();
     }
+
     return CUBIT_SUCCESS;
   }
 








More information about the cgma-dev mailing list