]> OCCT Git - occt-copy.git/commitdiff
Additional corrections.
authorjgv <jgv@opencascade.com>
Thu, 9 Oct 2014 12:39:12 +0000 (16:39 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 9 Oct 2014 13:05:26 +0000 (17:05 +0400)
src/BRepFill/BRepFill_OffsetWire.cxx
src/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cdl
src/BRepTest/BRepTest_CurveCommands.cxx

index 6d3af0ed0b2ab4773e3e23dd5a17cb44156f6194..7b6e90fc293cb1c7dec11ca17d68bd828cc4cfe8 100755 (executable)
@@ -265,22 +265,34 @@ static Standard_Boolean KPartCircle
 
   TopoDS_Vertex V1,V2;
   TopExp::Vertices(E,V1,V2);
-  if (!V1.IsSame(V2)) //may be case of line
+  if (!V1.IsSame(V2) || //open result or closed circle
+      C->IsKind(STANDARD_TYPE(Geom_Circle))) 
   {
-    if (!C->IsKind(STANDARD_TYPE(Geom_Line))) return Standard_False;
-    Handle(Geom_Line) LE = Handle(Geom_Line)::DownCast(C);
     Standard_Real anOffset = myOffset;
     if (E.Orientation() == TopAbs_REVERSED) anOffset *= -1;
     
-    Handle(Geom2d_Curve) aPCurve;
-    Handle(Geom_Surface) aSurf;
-    TopLoc_Location aLoc;
-    BRep_Tool::CurveOnSurface(E, aPCurve, aSurf, aLoc, f, l);
+    Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(E, mySpine, f, l);
     Handle(Geom2dAdaptor_HCurve) AHC = new Geom2dAdaptor_HCurve(aPCurve, f, l);
-    Adaptor3d_OffsetCurve Off(AHC,anOffset);
-    Handle(Geom2d_Line) OLC = new Geom2d_Line(Off.Line());
+    Handle(Geom2d_Curve) OC;
+    if (AHC->GetType() == GeomAbs_Line)
+    {
+      Adaptor3d_OffsetCurve Off(AHC,anOffset);
+      OC = new Geom2d_Line(Off.Line());
+    }
+    else if (AHC->GetType() == GeomAbs_Circle)
+    {
+      gp_Circ2d theCirc = AHC->Circle();
+      if (anOffset < 0. || Abs(anOffset) < theCirc.Radius())
+        OC = new Geom2d_Circle (theCirc.Position(), theCirc.Radius() - anOffset);
+    }
+    else
+    {
+      Handle(Geom2d_TrimmedCurve) G2dT = new Geom2d_TrimmedCurve(aPCurve, f, l);
+      OC = new Geom2d_OffsetCurve( G2dT, anOffset);
+    }
+    Handle(Geom_Surface) aSurf = BRep_Tool::Surface(mySpine);
     Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurf);
-    myShape = BRepLib_MakeEdge(OLC, aPlane, f, l);
+    myShape = BRepLib_MakeEdge(OC, aPlane, f, l);
     BRepLib::BuildCurve3d(TopoDS::Edge(myShape));
     
     myShape.Orientation(E.Orientation());
@@ -305,34 +317,8 @@ static Standard_Boolean KPartCircle
     myIsDone = Standard_True;
     return Standard_True;
   }
-  
-  if (!C->IsKind(STANDARD_TYPE(Geom_Circle))) return Standard_False;
-  Handle(Geom_Circle) CE = Handle(Geom_Circle)::DownCast(C);
-  Standard_Real anOffset = myOffset;
-  if (E.Orientation() == TopAbs_REVERSED) anOffset *= -1;
-  
-  if (anOffset < 0. || Abs(anOffset) < CE->Radius()) {
-    Handle(Geom_Circle) OC = new Geom_Circle (CE->Position(),CE->Radius() - anOffset);
-    myShape = BRepLib_MakeEdge(OC,f,l);
 
-    myShape.Orientation(E.Orientation());
-    myShape.Location(L);
-    if (Alt != 0.) {
-      BRepAdaptor_Surface S(mySpine,0);
-      gp_Ax1 Nor = S.Plane().Axis();
-      gp_Trsf T;
-      gp_Vec Trans(Nor.Direction());
-      Trans = Alt*Trans;
-      T.SetTranslation(Trans);
-      myShape.Move(TopLoc_Location(T));
-    }
-    
-    TopTools_ListOfShape LL;
-    LL.Append(myShape);
-    myMap.Add(E,LL);
-  }
-  myIsDone = Standard_True;
-  return Standard_True;
+  return Standard_False;
 }
 
 //=======================================================================
@@ -529,7 +515,7 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset,
   {
     OCC_CATCH_SIGNALS
       myCallGen = Standard_False;
-    if (KPartCircle(mySpine,Offset,Alt,myShape,myMap,myIsDone)) return;
+    if (KPartCircle(myWorkSpine,Offset,Alt,myShape,myMap,myIsDone)) return;
 
     TopoDS_Face oldWorkSpain = myWorkSpine;
 
@@ -761,7 +747,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
   //********************************
   // Calculate for a non null offset 
   //********************************
-  if (KPartCircle(mySpine,Offset,Alt,myShape,myMap,myIsDone))
+  if (KPartCircle(myWorkSpine,Offset,Alt,myShape,myMap,myIsDone))
     return;
 
   BRep_Builder myBuilder;
index 2d7a5ab221fe1bee941d0534c649cfe6413e2d93..861ea2aff2036a7df8ec5b117882120aeed8a96f 100755 (executable)
@@ -51,9 +51,12 @@ is
          IsOpenResult : Boolean from Standard = Standard_False)
        ---Purpose: Initializes the algorithm to construct parallels to the spine Spine.
        -- Join defines the type of parallel generated by the
-       -- salient vertices of the spine. The default type is
-       -- GeomAbs_Arc where the vertices generate sections
-       -- of a circle. At present, this is the only construction type implemented.
+       -- salient vertices of the spine.
+       -- The default type is GeomAbs_Arc where the vertices generate
+       -- sections of a circle.
+       -- If join type is GeomAbs_Intersection, the edges that
+       -- intersect in a salient vertex generate the edges
+       -- prolonged until intersection.
     is static;
     
     Create( Spine : Wire from TopoDS;
index 1ea06b718e00f9a7187425808ed41e7cd9799a9f..3da1f57a67f1bfca9ec76cba02c946ed2cf9e546 100755 (executable)
@@ -1504,7 +1504,7 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
   else
   {
     Base.Orientation(TopAbs_FORWARD);
-    Paral.Init(TopoDS::Face(Base));
+    Paral.Init(TopoDS::Face(Base)), theJoinType);
   }
 
   Standard_Real U, dU;
@@ -1550,22 +1550,34 @@ Standard_Integer openoffset(Draw_Interpretor& di,
   if (n < 5) return 1;
   char name[100];
 
-  TopoDS_Shape Base = DBRep::Get(a[2], TopAbs_WIRE);
-
+  BRepOffsetAPI_MakeOffset Paral;
   GeomAbs_JoinType theJoinType = GeomAbs_Arc;
   if (n == 6 && strcmp(a[5], "i") == 0)
     theJoinType = GeomAbs_Intersection;
-  
-  BRepOffsetAPI_MakeOffset Paral(TopoDS::Wire(Base), theJoinType, Standard_True);
+  Paral.Init(theJoinType, Standard_True);
+  TopoDS_Shape Base = DBRep::Get(a[2] ,TopAbs_FACE);
+
+  if ( Base.IsNull())
+  {
+    Base = DBRep::Get(a[2], TopAbs_WIRE);
+    if (Base.IsNull()) return 1;
+    Paral.AddWire(TopoDS::Wire(Base));
+  }
+  else
+  {
+    Base.Orientation(TopAbs_FORWARD);
+    Paral.Init(TopoDS::Face(Base), theJoinType, Standard_True);
+  }
 
   Standard_Real U, dU;
   Standard_Integer Nb;
   dU = Draw::Atof(a[4]);
   Nb = Draw::Atoi(a[3]);
 
-  Standard_Integer Compt = 1;
-  
   Standard_Real Alt = 0.;
+
+  Standard_Integer Compt = 1;
+
   for ( Standard_Integer i = 1; i <= Nb; i++)
   {
     U = i * dU;
@@ -1855,7 +1867,7 @@ void  BRepTest::CurveCommands(Draw_Interpretor& theCommands)
     mkoffset);
 
   theCommands.Add("openoffset",
-    "openoffset result wire nboffset stepoffset [jointype(a/i)]",__FILE__,
+    "openoffset result face/wire nboffset stepoffset [jointype(a/i)]",__FILE__,
     openoffset);
 
   theCommands.Add("mkedge",