]> OCCT Git - occt.git/commitdiff
0022968: RebuildShape exchanges 2d-curves
authorGKA <>
Fri, 17 Feb 2012 11:25:29 +0000 (11:25 +0000)
committerbugmaster <bugmaster@opencascade.com>
Mon, 5 Mar 2012 15:32:45 +0000 (19:32 +0400)
src/SWDRAW/SWDRAW_ShapeUpgrade.cxx
src/ShapeUpgrade/ShapeUpgrade_RemoveLocations.cxx

index 893d4f0d3212660e7f22a6af599de7a68999e6dd..07d81f4cf7c035ac87264f2f590ba354eb73faa2 100755 (executable)
@@ -65,6 +65,9 @@
 #include <ShapeCustom.hxx>
 #include <ShapeUpgrade_ShapeDivideClosed.hxx>
 #include <ShapeUpgrade_RemoveInternalWires.hxx>
+#include <ShapeUpgrade_RemoveLocations.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
+
 // the plane (equation z=0) shared by PlaneDividedFaceContinuity and PlaneGridShell
 //static Handle(Geom_Plane) ThePlane= new Geom_Plane(0,0,1,0);
 
@@ -447,7 +450,7 @@ static Standard_Integer DT_SplitAngle(Draw_Interpretor& di,
     if ( maxangle <1 ) maxangle = 1;
   }
   
-  ShapeUpgrade_ShapeDivideAngle tool(maxangle*M_PI/180,inputShape);
+  ShapeUpgrade_ShapeDivideAngle tool(maxangle * M_PI/180,inputShape);
   tool.Perform();
   TopoDS_Shape res = tool.Result();
 
@@ -1403,6 +1406,49 @@ static Standard_Integer removeinternalwires (Draw_Interpretor& di,
   return 0;
 }
 
+static Standard_Integer removeloc (Draw_Interpretor& di, 
+                                   Standard_Integer argc, 
+                                   const char** argv)
+{
+  if (argc<3) {
+    di << "bad number of arguments. Should be:  removeloc res shape" <<"\n";
+    return 1;
+  }
+  
+  TopoDS_Shape aShape = DBRep::Get(argv[2]);
+  if(aShape.IsNull())
+    return 1;
+  ShapeUpgrade_RemoveLocations aRemLoc;
+  aRemLoc.Remove(aShape);
+  TopoDS_Shape aNewShape = aRemLoc.GetResult();
+  
+  DBRep::Set(argv[1],aNewShape);
+  return 0;
+}
+static Standard_Integer copytranslate(Draw_Interpretor& di, 
+                                   Standard_Integer argc, 
+                                   const char** argv)
+{
+  if (argc<6) {
+    di << "bad number of arguments. Should be:  removeloc res shape dx dyy dz" <<"\n";
+    return 1;
+  }
+  TopoDS_Shape aShape = DBRep::Get(argv[2]);
+  if(aShape.IsNull())
+    return 1;
+  Standard_Real aDx = atof(argv[3]);
+  Standard_Real aDy = atof(argv[4]);
+  Standard_Real aDz = atof(argv[5]);
+  gp_Trsf aTrsf;
+  aTrsf.SetTranslation(gp_Vec(aDx, aDy, aDz));
+  BRepBuilderAPI_Transform builderTransform(aTrsf);
+  builderTransform.Perform (aShape, true); 
+  TopoDS_Shape aNewShape = builderTransform.Shape();
+  DBRep::Set(argv[1],aNewShape);
+  return 0;
+  
+}
+
 //=======================================================================
 //function : InitCommands
 //purpose  : 
@@ -1497,4 +1543,7 @@ static Standard_Integer removeinternalwires (Draw_Interpretor& di,
   
   theCommands.Add ("RemoveIntWires","result minarea wholeshape [faces or wires] [moderemoveface ]",
                    __FILE__,removeinternalwires,g);
+  
+  theCommands.Add ("removeloc","result shape",__FILE__,removeloc,g);
+  theCommands.Add ("copytranslate","result shape dx dy dz",__FILE__,copytranslate,g);
 }
index 33c16f7209a607f74653d6ad2fcb1316ec89381a..210f11a98314a2dfeb3bab00f320f8c1a838ba8b 100755 (executable)
@@ -118,7 +118,7 @@ static Standard_Boolean RebuildShape(const TopoDS_Edge& theEdge, TopoDS_Edge& th
           c2d1= BRep_Tool::CurveOnSurface(tmpE,theFace,First2d,Last2d);
           TopAbs_Orientation OrEdge = theNewEdge.Orientation();
           
-          if(theNewFace.Orientation() == TopAbs_REVERSED)
+          if(theFace.Orientation() == TopAbs_REVERSED)
             OrEdge = ( OrEdge == TopAbs_FORWARD ? TopAbs_REVERSED : TopAbs_FORWARD);
           
           if(OrEdge == TopAbs_FORWARD)