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());
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;
}
//=======================================================================
{
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;
//********************************
// 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;
else
{
Base.Orientation(TopAbs_FORWARD);
- Paral.Init(TopoDS::Face(Base));
+ Paral.Init(TopoDS::Face(Base)), theJoinType);
}
Standard_Real U, dU;
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;
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",