[cgma-dev] r1551 - in cgm/trunk: geom/OCC test

janehu at mcs.anl.gov janehu at mcs.anl.gov
Tue Jan 22 13:23:44 CST 2008


Author: janehu
Date: 2008-01-22 13:23:44 -0600 (Tue, 22 Jan 2008)
New Revision: 1551

Modified:
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCSurface.cpp
   cgm/trunk/test/makept.cpp
Log:
Added copy curve for OCCModifyEngine and updated this function and edge-edge angle test in test file, corrected a mistake in OCCSurface.cpp

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-01-22 17:18:28 UTC (rev 1550)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-01-22 19:23:44 UTC (rev 1551)
@@ -16,6 +16,7 @@
 #include "config.h"
 #include "gp_Pnt.hxx"
 #include "TopoDS_Shape.hxx"
+#include "TopoDS.hxx"
 #include "TopologyBridge.hpp"
 #include "OCCModifyEngine.hpp"
 #include "OCCQueryEngine.hpp"
@@ -110,15 +111,29 @@
 
 //===============================================================================
 // Function   : make_Curve
+//              This function creates a curve given an existing curve, copy. 
 // Member Type: PUBLIC
 // Description: make a curve
-// Author     : John Fowler
-// Date       : 10/02
+// Author     : Jane Hu
+// Date       : 01/08
 //===============================================================================
-Curve* OCCModifyEngine::make_Curve(Curve * /*curve_ptr*/) const
+Curve* OCCModifyEngine::make_Curve(Curve * curve_ptr) const
 {
-  PRINT_ERROR("Option not supported for mesh based geometry.\n");
-  return (Curve*) NULL;
+  OCCCurve* occ_curve = CAST_TO(curve_ptr, OCCCurve);
+  if (!occ_curve)
+  {
+     PRINT_ERROR("Cannot create an OCC curve from the given curve.\n"
+                 "Possible incompatible geometry engines.\n");
+     return (Curve *)NULL;
+  }
+ 
+  TopoDS_Edge *theEdge = occ_curve->get_TopoDS_Edge();  
+ 
+  TopoDS_Shape newShape = theEdge->EmptyCopied();
+ 
+  TopoDS_Edge newEdge = TopoDS::Edge(newShape);
+
+  return OCCQueryEngine::instance()->populate_topology_bridge(newEdge);
 }
 
 //===============================================================================

Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp	2008-01-22 17:18:28 UTC (rev 1550)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp	2008-01-22 19:23:44 UTC (rev 1551)
@@ -227,7 +227,7 @@
 CubitStatus OCCSurface::get_point_normal( CubitVector& location,
                                             CubitVector& normal )
 {
-  return closest_point( bounding_box().center_point(), &location, &normal );
+  return closest_point( bounding_box().center(), &location, &normal );
 }   
 
 CubitStatus OCCSurface::closest_point_uv_guess(  

Modified: cgm/trunk/test/makept.cpp
===================================================================
--- cgm/trunk/test/makept.cpp	2008-01-22 17:18:28 UTC (rev 1550)
+++ cgm/trunk/test/makept.cpp	2008-01-22 19:23:44 UTC (rev 1551)
@@ -149,8 +149,8 @@
   //check for vertex
   DLIList<Body*> bodies;
   gti->bodies(bodies);
-  free_entities.clean_out(); //currently there's bug in that it created
-  //new entities after translating, debug next week.
+  free_entities.clean_out();// get_free_ref_entities directly append
+  //without checking for duplicates, so clean_out first. 
   gti->get_free_ref_entities(free_entities);
  
   RefVertex* vertex1 = CAST_TO(free_entities.get_and_step(),RefVertex);
@@ -280,15 +280,42 @@
   CubitPointContainment pc2 = ref_face->point_containment(3,-20000);
   // this (u,v) location should be inside of the surface.
 
+  DLIList<DLIList<RefEdge*>*> ref_edge_loops;
+  int num_loops = ref_face->ref_edge_loops(ref_edge_loops);
+  DLIList<RefEdge*> *ref_edges1;
+  ref_edges1 = ref_edge_loops.get();
+  RefEdge* edge1 = ref_edges1->get();
+  RefEdge* edge2 = ref_edges1->step_and_get();
+  double angle = edge1->angle_between(edge2, ref_face);
+
   //test for curve
   DLIList<RefEdge *> ref_edges;
   gti->ref_edges(ref_edges);
+
+  //make a new refedge out of existing refedge.
   RefEdge* ref_edge = ref_edges.step_and_get();
 
+  RefEdge* new_edge = gmti->make_RefEdge(ref_edge);
+
+  free_entities.clean_out();
+  gti->get_free_ref_entities(free_entities);
+  //translate the new curve by (30,30,30)
+  for(int i = 1; i <= free_entities.size(); i++)
+  {
+     if( i != 3)
+        continue;
+     RefEntity * entity = free_entities.get_and_step();
+     gti->translate((BasicTopologyEntity*)entity, i*vector1);
+  }
+
+  box = new_edge->get_curve_ptr()->bounding_box();
+  // test free curve translation
+
   DLIList<OCCCurve*> curves;
   CAST_TO(body, OCCBody)->get_all_curves(curves);
 
   OCCCurve *curve = curves.step_and_get();
+
   type = curve->geometry_type();
   // ARC_CURVE_TYPE
 




More information about the cgma-dev mailing list