mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Additional corrections.
This commit is contained in:
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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",
|
||||
|
Reference in New Issue
Block a user