mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0025021: New option of BRepOffsetAPI_MakeOffset algorithm: open result for open wire
Test cases for issue CR25021
This commit is contained in:
@@ -39,12 +39,14 @@ is
|
|||||||
Create returns OffsetWire from BRepFill;
|
Create returns OffsetWire from BRepFill;
|
||||||
|
|
||||||
Create ( Spine : Face from TopoDS;
|
Create ( Spine : Face from TopoDS;
|
||||||
Join : JoinType from GeomAbs = GeomAbs_Arc)
|
Join : JoinType from GeomAbs = GeomAbs_Arc;
|
||||||
|
IsOpenResult : Boolean from Standard = Standard_False)
|
||||||
returns OffsetWire from BRepFill;
|
returns OffsetWire from BRepFill;
|
||||||
|
|
||||||
Init ( me : in out;
|
Init ( me : in out;
|
||||||
Spine : Face from TopoDS;
|
Spine : Face from TopoDS;
|
||||||
Join : JoinType from GeomAbs = GeomAbs_Arc)
|
Join : JoinType from GeomAbs = GeomAbs_Arc;
|
||||||
|
IsOpenResult : Boolean from Standard = Standard_False)
|
||||||
---Purpose: Initialize the evaluation of Offseting.
|
---Purpose: Initialize the evaluation of Offseting.
|
||||||
raises
|
raises
|
||||||
ConstructionError from Standard
|
ConstructionError from Standard
|
||||||
@@ -127,6 +129,7 @@ fields
|
|||||||
mySpine : Face from TopoDS;
|
mySpine : Face from TopoDS;
|
||||||
myWorkSpine : Face from TopoDS;
|
myWorkSpine : Face from TopoDS;
|
||||||
myOffset : Real from Standard; -- >0 ;
|
myOffset : Real from Standard; -- >0 ;
|
||||||
|
myIsOpenResult : Boolean from Standard;
|
||||||
myShape : Shape from TopoDS;
|
myShape : Shape from TopoDS;
|
||||||
myIsDone : Boolean from Standard;
|
myIsDone : Boolean from Standard;
|
||||||
myJoinType : JoinType from GeomAbs;
|
myJoinType : JoinType from GeomAbs;
|
||||||
|
@@ -55,6 +55,7 @@
|
|||||||
#include <GeomAPI.hxx>
|
#include <GeomAPI.hxx>
|
||||||
#include <Geom_TrimmedCurve.hxx>
|
#include <Geom_TrimmedCurve.hxx>
|
||||||
#include <Geom_Circle.hxx>
|
#include <Geom_Circle.hxx>
|
||||||
|
#include <Geom_Line.hxx>
|
||||||
#include <Geom_OffsetCurve.hxx>
|
#include <Geom_OffsetCurve.hxx>
|
||||||
#include <MAT_Arc.hxx>
|
#include <MAT_Arc.hxx>
|
||||||
#include <MAT_Node.hxx>
|
#include <MAT_Node.hxx>
|
||||||
@@ -189,10 +190,11 @@ static void StoreInMap (const TopoDS_Shape& V1,
|
|||||||
|
|
||||||
static void TrimEdge (const TopoDS_Edge& CurrentEdge,
|
static void TrimEdge (const TopoDS_Edge& CurrentEdge,
|
||||||
const TopTools_ListOfShape& D,
|
const TopTools_ListOfShape& D,
|
||||||
TopTools_SequenceOfShape& Sv,
|
TopTools_SequenceOfShape& Sv,
|
||||||
TColStd_SequenceOfReal& MapverPar,
|
TColStd_SequenceOfReal& MapverPar,
|
||||||
TopTools_SequenceOfShape& S,
|
TopTools_SequenceOfShape& S,
|
||||||
TopTools_IndexedDataMapOfShapeShape& MapVV);
|
TopTools_IndexedDataMapOfShapeShape& MapVV,
|
||||||
|
const Standard_Integer IndOfE);
|
||||||
|
|
||||||
static Standard_Boolean DoubleOrNotInside (const TopTools_ListOfShape& EC,
|
static Standard_Boolean DoubleOrNotInside (const TopTools_ListOfShape& EC,
|
||||||
const TopoDS_Vertex& V);
|
const TopoDS_Vertex& V);
|
||||||
@@ -213,7 +215,9 @@ static void MakeOffset
|
|||||||
const TopoDS_Face& F,
|
const TopoDS_Face& F,
|
||||||
const Standard_Real Offset,
|
const Standard_Real Offset,
|
||||||
BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
|
BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
|
||||||
const Handle(Geom_Plane)& RefPlane);
|
const Handle(Geom_Plane)& RefPlane,
|
||||||
|
const Standard_Boolean IsOpenResult,
|
||||||
|
const TopoDS_Vertex * Ends);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -258,9 +262,6 @@ static Standard_Boolean KPartCircle
|
|||||||
E = TopoDS::Edge(exp.Current());
|
E = TopoDS::Edge(exp.Current());
|
||||||
if (NbEdges > 1) return Standard_False;
|
if (NbEdges > 1) return Standard_False;
|
||||||
}
|
}
|
||||||
TopoDS_Vertex V1,V2;
|
|
||||||
TopExp::Vertices(E,V1,V2);
|
|
||||||
if (!V1.IsSame(V2)) return Standard_False;
|
|
||||||
|
|
||||||
Standard_Real f,l;
|
Standard_Real f,l;
|
||||||
TopLoc_Location L;
|
TopLoc_Location L;
|
||||||
@@ -271,6 +272,49 @@ static Standard_Boolean KPartCircle
|
|||||||
C = Ct->BasisCurve();
|
C = Ct->BasisCurve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TopoDS_Vertex V1,V2;
|
||||||
|
TopExp::Vertices(E,V1,V2);
|
||||||
|
if (!V1.IsSame(V2)) //may be case of line
|
||||||
|
{
|
||||||
|
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(Geom2dAdaptor_HCurve) AHC = new Geom2dAdaptor_HCurve(aPCurve, f, l);
|
||||||
|
Adaptor3d_OffsetCurve Off(AHC,anOffset);
|
||||||
|
Handle(Geom2d_Line) OLC = new Geom2d_Line(Off.Line());
|
||||||
|
Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurf);
|
||||||
|
myShape = BRepLib_MakeEdge(OLC, aPlane, f, l);
|
||||||
|
BRepLib::BuildCurve3d(TopoDS::Edge(myShape));
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
TopoDS_Edge myEdge = TopoDS::Edge(myShape);
|
||||||
|
myShape = BRepLib_MakeWire(myEdge);
|
||||||
|
|
||||||
|
myIsDone = Standard_True;
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
if (!C->IsKind(STANDARD_TYPE(Geom_Circle))) return Standard_False;
|
if (!C->IsKind(STANDARD_TYPE(Geom_Circle))) return Standard_False;
|
||||||
Handle(Geom_Circle) CE = Handle(Geom_Circle)::DownCast(C);
|
Handle(Geom_Circle) CE = Handle(Geom_Circle)::DownCast(C);
|
||||||
Standard_Real anOffset = myOffset;
|
Standard_Real anOffset = myOffset;
|
||||||
@@ -306,7 +350,8 @@ static Standard_Boolean KPartCircle
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
BRepFill_OffsetWire::BRepFill_OffsetWire()
|
BRepFill_OffsetWire::BRepFill_OffsetWire()
|
||||||
:myIsDone(Standard_False)
|
: myIsOpenResult(Standard_False),
|
||||||
|
myIsDone(Standard_False)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,9 +362,10 @@ BRepFill_OffsetWire::BRepFill_OffsetWire()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
BRepFill_OffsetWire::BRepFill_OffsetWire(const TopoDS_Face& Spine,
|
BRepFill_OffsetWire::BRepFill_OffsetWire(const TopoDS_Face& Spine,
|
||||||
const GeomAbs_JoinType Join )
|
const GeomAbs_JoinType Join,
|
||||||
|
const Standard_Boolean IsOpenResult)
|
||||||
{
|
{
|
||||||
Init(Spine,Join);
|
Init(Spine,Join,IsOpenResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -328,7 +374,8 @@ BRepFill_OffsetWire::BRepFill_OffsetWire(const TopoDS_Face& Spine,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void BRepFill_OffsetWire::Init(const TopoDS_Face& Spine,
|
void BRepFill_OffsetWire::Init(const TopoDS_Face& Spine,
|
||||||
const GeomAbs_JoinType Join )
|
const GeomAbs_JoinType Join,
|
||||||
|
const Standard_Boolean IsOpenResult)
|
||||||
{
|
{
|
||||||
Standard_NotImplemented_Raise_if(Join > GeomAbs_Arc,
|
Standard_NotImplemented_Raise_if(Join > GeomAbs_Arc,
|
||||||
"Only GeomAbs_Arc is implemented");
|
"Only GeomAbs_Arc is implemented");
|
||||||
@@ -338,6 +385,7 @@ void BRepFill_OffsetWire::Init(const TopoDS_Face& Spine,
|
|||||||
mySpine = TopoDS::Face(aLocalShape);
|
mySpine = TopoDS::Face(aLocalShape);
|
||||||
// mySpine = TopoDS::Face(Spine.Oriented(TopAbs_FORWARD));
|
// mySpine = TopoDS::Face(Spine.Oriented(TopAbs_FORWARD));
|
||||||
myJoinType = Join;
|
myJoinType = Join;
|
||||||
|
myIsOpenResult = IsOpenResult;
|
||||||
|
|
||||||
CheckFace(mySpine);
|
CheckFace(mySpine);
|
||||||
|
|
||||||
@@ -372,7 +420,7 @@ void BRepFill_OffsetWire::Init(const TopoDS_Face& Spine,
|
|||||||
// static BRepMAT2d_Explorer Exp;
|
// static BRepMAT2d_Explorer Exp;
|
||||||
// Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 End
|
// Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 End
|
||||||
Exp.Perform(myWorkSpine);
|
Exp.Perform(myWorkSpine);
|
||||||
myBilo.Compute(Exp,1,MAT_Left);
|
myBilo.Compute(Exp,1,MAT_Left,myIsOpenResult);
|
||||||
myLink.Perform(Exp,myBilo);
|
myLink.Perform(Exp,myBilo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,7 +648,7 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset,
|
|||||||
newExp.Perform(myWorkSpine);
|
newExp.Perform(myWorkSpine);
|
||||||
BRepMAT2d_BisectingLocus newBilo;
|
BRepMAT2d_BisectingLocus newBilo;
|
||||||
BRepMAT2d_LinkTopoBilo newLink;
|
BRepMAT2d_LinkTopoBilo newLink;
|
||||||
newBilo.Compute(newExp,1,MAT_Left);
|
newBilo.Compute(newExp,1,MAT_Left,myIsOpenResult);
|
||||||
|
|
||||||
if(!newBilo.IsDone())
|
if(!newBilo.IsDone())
|
||||||
{
|
{
|
||||||
@@ -635,15 +683,18 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset,
|
|||||||
|
|
||||||
// Modified by skv - Fri Jul 8 11:21:38 2005 OCC9145 End
|
// Modified by skv - Fri Jul 8 11:21:38 2005 OCC9145 End
|
||||||
// Modified by Sergey KHROMOV - Thu Mar 14 10:48:15 2002 Begin
|
// Modified by Sergey KHROMOV - Thu Mar 14 10:48:15 2002 Begin
|
||||||
TopExp_Explorer anExp(myShape, TopAbs_WIRE);
|
if (!myIsOpenResult)
|
||||||
|
{
|
||||||
|
TopExp_Explorer anExp(myShape, TopAbs_WIRE);
|
||||||
|
|
||||||
for (; anExp.More(); anExp.Next()) {
|
for (; anExp.More(); anExp.Next()) {
|
||||||
const TopoDS_Shape &aWire = anExp.Current();
|
const TopoDS_Shape &aWire = anExp.Current();
|
||||||
|
|
||||||
if (!aWire.Closed()) {
|
if (!aWire.Closed()) {
|
||||||
myShape.Nullify();
|
myShape.Nullify();
|
||||||
myIsDone = Standard_False;
|
myIsDone = Standard_False;
|
||||||
Standard_ConstructionError::Raise("Offset wire is not closed.");
|
Standard_ConstructionError::Raise("Offset wire is not closed.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Modified by Sergey KHROMOV - Thu Mar 14 10:48:16 2002 End
|
// Modified by Sergey KHROMOV - Thu Mar 14 10:48:16 2002 End
|
||||||
@@ -762,6 +813,15 @@ void BRepFill_OffsetWire::PerformWithBiLo
|
|||||||
// Construction of Circles and OffsetCurves
|
// Construction of Circles and OffsetCurves
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
|
|
||||||
|
TopoDS_Vertex Ends [2];
|
||||||
|
if (myIsOpenResult)
|
||||||
|
{
|
||||||
|
TopoDS_Wire theWire;
|
||||||
|
TopoDS_Iterator iter(mySpine);
|
||||||
|
theWire = TopoDS::Wire(iter.Value());
|
||||||
|
TopExp::Vertices(theWire, Ends[0], Ends[1]);
|
||||||
|
}
|
||||||
|
|
||||||
for (Standard_Integer ic = 1; ic <= Locus.NumberOfContours(); ic++) {
|
for (Standard_Integer ic = 1; ic <= Locus.NumberOfContours(); ic++) {
|
||||||
TopoDS_Shape PEE = Link.GeneratingShape(Locus.BasicElt(ic,Locus.NumberOfElts(ic)));
|
TopoDS_Shape PEE = Link.GeneratingShape(Locus.BasicElt(ic,Locus.NumberOfElts(ic)));
|
||||||
TopoDS_Shape& PE = PEE ;
|
TopoDS_Shape& PE = PEE ;
|
||||||
@@ -772,7 +832,8 @@ void BRepFill_OffsetWire::PerformWithBiLo
|
|||||||
myWorkSpine,myOffset,myMap,RefPlane);
|
myWorkSpine,myOffset,myMap,RefPlane);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MakeOffset (TopoDS::Edge(SE),myWorkSpine,myOffset,myMap,RefPlane);
|
MakeOffset (TopoDS::Edge(SE),myWorkSpine,myOffset,myMap,RefPlane,
|
||||||
|
myIsOpenResult, Ends);
|
||||||
PE = SE;
|
PE = SE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -982,11 +1043,19 @@ void BRepFill_OffsetWire::PerformWithBiLo
|
|||||||
if (MapBis.IsBound(CurrentEdge)) {
|
if (MapBis.IsBound(CurrentEdge)) {
|
||||||
TopTools_SequenceOfShape S;
|
TopTools_SequenceOfShape S;
|
||||||
if (!MapBis(CurrentEdge).IsEmpty()) {
|
if (!MapBis(CurrentEdge).IsEmpty()) {
|
||||||
|
Standard_Integer IndOfE = 0;
|
||||||
|
if (myIsOpenResult)
|
||||||
|
{
|
||||||
|
if (j == 1)
|
||||||
|
IndOfE = 1;
|
||||||
|
else if (j == myMap.Extent())
|
||||||
|
IndOfE = -1;
|
||||||
|
}
|
||||||
TrimEdge (CurrentEdge,
|
TrimEdge (CurrentEdge,
|
||||||
Detromp (CurrentSpine),
|
Detromp (CurrentSpine),
|
||||||
MapBis (CurrentEdge) ,
|
MapBis (CurrentEdge) ,
|
||||||
MapVerPar(CurrentEdge) ,
|
MapVerPar(CurrentEdge) ,
|
||||||
S, MapVV);
|
S, MapVV, IndOfE);
|
||||||
for ( k = 1; k <= S.Length(); k++) {
|
for ( k = 1; k <= S.Length(); k++) {
|
||||||
myMap(j).Append(S.Value(k));
|
myMap(j).Append(S.Value(k));
|
||||||
}
|
}
|
||||||
@@ -1135,7 +1204,7 @@ void BRepFill_OffsetWire::PrepareSpine()
|
|||||||
TopExp::MapShapes(IteF.Value(), TopAbs_EDGE, EdgeMap);
|
TopExp::MapShapes(IteF.Value(), TopAbs_EDGE, EdgeMap);
|
||||||
Standard_Integer nbEdges = EdgeMap.Extent();
|
Standard_Integer nbEdges = EdgeMap.Extent();
|
||||||
|
|
||||||
if (nbEdges == 1)
|
if (nbEdges == 1 && !myIsOpenResult) //in case of open wire there's no need to do it
|
||||||
ForcedCut = 2;
|
ForcedCut = 2;
|
||||||
// Modified by Sergey KHROMOV - Thu Nov 16 17:29:48 2000 End
|
// Modified by Sergey KHROMOV - Thu Nov 16 17:29:48 2000 End
|
||||||
|
|
||||||
@@ -1832,7 +1901,9 @@ void MakeOffset (const TopoDS_Edge& E,
|
|||||||
const TopoDS_Face& F,
|
const TopoDS_Face& F,
|
||||||
const Standard_Real Offset,
|
const Standard_Real Offset,
|
||||||
BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
|
BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
|
||||||
const Handle(Geom_Plane)& RefPlane)
|
const Handle(Geom_Plane)& RefPlane,
|
||||||
|
const Standard_Boolean IsOpenResult,
|
||||||
|
const TopoDS_Vertex * Ends)
|
||||||
{
|
{
|
||||||
Standard_Real f,l;
|
Standard_Real f,l;
|
||||||
Standard_Real anOffset = Offset;
|
Standard_Real anOffset = Offset;
|
||||||
@@ -1842,6 +1913,20 @@ void MakeOffset (const TopoDS_Edge& E,
|
|||||||
Handle(Geom2d_Curve) G2d = BRep_Tool::CurveOnSurface(E,F,f,l);
|
Handle(Geom2d_Curve) G2d = BRep_Tool::CurveOnSurface(E,F,f,l);
|
||||||
Handle(Geom2d_Curve) G2dOC;
|
Handle(Geom2d_Curve) G2dOC;
|
||||||
|
|
||||||
|
Standard_Boolean ToExtendFirstPar = Standard_True;
|
||||||
|
Standard_Boolean ToExtendLastPar = Standard_True;
|
||||||
|
if (IsOpenResult)
|
||||||
|
{
|
||||||
|
TopoDS_Vertex V1, V2;
|
||||||
|
TopExp::Vertices(E, V1, V2);
|
||||||
|
if (V1.IsSame(Ends[0]) ||
|
||||||
|
V1.IsSame(Ends[1]))
|
||||||
|
ToExtendFirstPar = Standard_False;
|
||||||
|
if (V2.IsSame(Ends[0]) ||
|
||||||
|
V2.IsSame(Ends[1]))
|
||||||
|
ToExtendLastPar = Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
Geom2dAdaptor_Curve AC(G2d,f,l);
|
Geom2dAdaptor_Curve AC(G2d,f,l);
|
||||||
if ( AC.GetType() == GeomAbs_Circle) {
|
if ( AC.GetType() == GeomAbs_Circle) {
|
||||||
// if the offset is greater otr equal to the radius and the side of the
|
// if the offset is greater otr equal to the radius and the side of the
|
||||||
@@ -1861,7 +1946,10 @@ void MakeOffset (const TopoDS_Edge& E,
|
|||||||
Handle(Geom2d_Circle) CC = new Geom2d_Circle(Off.Circle());
|
Handle(Geom2d_Circle) CC = new Geom2d_Circle(Off.Circle());
|
||||||
|
|
||||||
Standard_Real Delta = 2*M_PI - l + f;
|
Standard_Real Delta = 2*M_PI - l + f;
|
||||||
f -= 0.2*Delta; l += 0.2*Delta;
|
if (ToExtendFirstPar)
|
||||||
|
f -= 0.2*Delta;
|
||||||
|
if (ToExtendLastPar)
|
||||||
|
l += 0.2*Delta;
|
||||||
|
|
||||||
G2dOC = new Geom2d_TrimmedCurve(CC,f,l);
|
G2dOC = new Geom2d_TrimmedCurve(CC,f,l);
|
||||||
}
|
}
|
||||||
@@ -1872,7 +1960,10 @@ void MakeOffset (const TopoDS_Edge& E,
|
|||||||
Adaptor3d_OffsetCurve Off(AHC,anOffset);
|
Adaptor3d_OffsetCurve Off(AHC,anOffset);
|
||||||
Handle(Geom2d_Line) CC = new Geom2d_Line(Off.Line());
|
Handle(Geom2d_Line) CC = new Geom2d_Line(Off.Line());
|
||||||
Standard_Real Delta = (l - f);
|
Standard_Real Delta = (l - f);
|
||||||
f -= Delta; l += Delta;
|
if (ToExtendFirstPar)
|
||||||
|
f -= Delta;
|
||||||
|
if (ToExtendLastPar)
|
||||||
|
l += Delta;
|
||||||
G2dOC = new Geom2d_TrimmedCurve(CC,f,l);
|
G2dOC = new Geom2d_TrimmedCurve(CC,f,l);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2043,10 +2134,11 @@ void StoreInMap (const TopoDS_Shape& V1,
|
|||||||
|
|
||||||
void TrimEdge (const TopoDS_Edge& E,
|
void TrimEdge (const TopoDS_Edge& E,
|
||||||
const TopTools_ListOfShape& Detromp,
|
const TopTools_ListOfShape& Detromp,
|
||||||
TopTools_SequenceOfShape& TheVer,
|
TopTools_SequenceOfShape& TheVer,
|
||||||
TColStd_SequenceOfReal& ThePar,
|
TColStd_SequenceOfReal& ThePar,
|
||||||
TopTools_SequenceOfShape& S,
|
TopTools_SequenceOfShape& S,
|
||||||
TopTools_IndexedDataMapOfShapeShape& MapVV)
|
TopTools_IndexedDataMapOfShapeShape& MapVV,
|
||||||
|
const Standard_Integer IndOfE)
|
||||||
{
|
{
|
||||||
Standard_Boolean Change = Standard_True;
|
Standard_Boolean Change = Standard_True;
|
||||||
BRep_Builder TheBuilder;
|
BRep_Builder TheBuilder;
|
||||||
@@ -2117,46 +2209,93 @@ void TrimEdge (const TopoDS_Edge& E,
|
|||||||
// the number of vertices should be even. The created edges
|
// the number of vertices should be even. The created edges
|
||||||
// go from a vertex with uneven index i to vertex i+1;
|
// go from a vertex with uneven index i to vertex i+1;
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
for (Standard_Integer k = 1; k < TheVer.Length(); k = k+2) {
|
if (IndOfE == 1 || IndOfE == -1) //open result and extreme edges of result
|
||||||
|
{
|
||||||
TopoDS_Shape aLocalShape = E.EmptyCopied();
|
TopoDS_Shape aLocalShape = E.EmptyCopied();
|
||||||
TopoDS_Edge NewEdge = TopoDS::Edge(aLocalShape);
|
TopoDS_Edge NewEdge = TopoDS::Edge(aLocalShape);
|
||||||
// TopoDS_Edge NewEdge = TopoDS::Edge(E.EmptyCopied());
|
TopoDS_Vertex V1, V2;
|
||||||
|
TopExp::Vertices(E, V1, V2);
|
||||||
if (NewEdge.Orientation() == TopAbs_REVERSED) {
|
Standard_Real fpar, lpar;
|
||||||
TheBuilder.Add (NewEdge,TheVer.Value(k) .Oriented(TopAbs_REVERSED));
|
BRep_Tool::Range(E, fpar, lpar);
|
||||||
TheBuilder.Add (NewEdge,TheVer.Value(k+1).Oriented(TopAbs_FORWARD));
|
if (IndOfE == 1) //first edge of open wire
|
||||||
|
{
|
||||||
|
if (NewEdge.Orientation() == TopAbs_FORWARD)
|
||||||
|
{
|
||||||
|
TheBuilder.Add(NewEdge, V1.Oriented(TopAbs_FORWARD));
|
||||||
|
TheBuilder.Add(NewEdge, TheVer.First().Oriented(TopAbs_REVERSED));
|
||||||
|
TheBuilder.Range(NewEdge, fpar, ThePar.First());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//TheBuilder.Add(NewEdge, V1.Oriented(TopAbs_REVERSED));
|
||||||
|
//TheBuilder.Add(NewEdge, TheVer.First().Oriented(TopAbs_FORWARD));
|
||||||
|
TheBuilder.Add(NewEdge, TheVer.First().Oriented(TopAbs_REVERSED));
|
||||||
|
TheBuilder.Add(NewEdge, V2.Oriented(TopAbs_FORWARD));
|
||||||
|
TheBuilder.Range(NewEdge, ThePar.First(), lpar);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else //last edge of open wire
|
||||||
TheBuilder.Add (NewEdge,TheVer.Value(k) .Oriented(TopAbs_FORWARD));
|
{
|
||||||
TheBuilder.Add (NewEdge,TheVer.Value(k+1).Oriented(TopAbs_REVERSED));
|
if (NewEdge.Orientation() == TopAbs_FORWARD)
|
||||||
|
{
|
||||||
|
TheBuilder.Add(NewEdge, TheVer.First().Oriented(TopAbs_FORWARD));
|
||||||
|
TheBuilder.Add(NewEdge, V2.Oriented(TopAbs_REVERSED));
|
||||||
|
TheBuilder.Range(NewEdge, ThePar.First(), lpar);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//TheBuilder.Add(NewEdge, TheVer.First().Oriented(TopAbs_REVERSED));
|
||||||
|
//TheBuilder.Add(NewEdge, V2.Oriented(TopAbs_FORWARD));
|
||||||
|
TheBuilder.Add(NewEdge, V1.Oriented(TopAbs_REVERSED));
|
||||||
|
TheBuilder.Add(NewEdge, TheVer.First().Oriented(TopAbs_FORWARD));
|
||||||
|
TheBuilder.Range(NewEdge, fpar, ThePar.First());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
S.Append(NewEdge);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (Standard_Integer k = 1; k < TheVer.Length(); k = k+2) {
|
||||||
|
TopoDS_Shape aLocalShape = E.EmptyCopied();
|
||||||
|
TopoDS_Edge NewEdge = TopoDS::Edge(aLocalShape);
|
||||||
|
// TopoDS_Edge NewEdge = TopoDS::Edge(E.EmptyCopied());
|
||||||
|
|
||||||
|
if (NewEdge.Orientation() == TopAbs_REVERSED) {
|
||||||
|
TheBuilder.Add (NewEdge,TheVer.Value(k) .Oriented(TopAbs_REVERSED));
|
||||||
|
TheBuilder.Add (NewEdge,TheVer.Value(k+1).Oriented(TopAbs_FORWARD));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TheBuilder.Add (NewEdge,TheVer.Value(k) .Oriented(TopAbs_FORWARD));
|
||||||
|
TheBuilder.Add (NewEdge,TheVer.Value(k+1).Oriented(TopAbs_REVERSED));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TheBuilder.Range(NewEdge,ThePar.Value(k),ThePar.Value(k+1));
|
TheBuilder.Range(NewEdge,ThePar.Value(k),ThePar.Value(k+1));
|
||||||
|
|
||||||
#ifdef DRAW
|
#ifdef DRAW
|
||||||
if ( AffichEdge) {
|
if ( AffichEdge) {
|
||||||
char name[256];
|
char name[256];
|
||||||
sprintf(name,"TRIMEDGE_%d",NbTRIMEDGES);
|
sprintf(name,"TRIMEDGE_%d",NbTRIMEDGES);
|
||||||
DBRep::Set(name,NewEdge);
|
DBRep::Set(name,NewEdge);
|
||||||
}
|
}
|
||||||
if (Affich2d) {
|
if (Affich2d) {
|
||||||
TopLoc_Location L;
|
TopLoc_Location L;
|
||||||
Standard_Real f,l;
|
Standard_Real f,l;
|
||||||
Handle(Geom_Surface) Surf;
|
Handle(Geom_Surface) Surf;
|
||||||
Handle(Geom2d_Curve) C;
|
Handle(Geom2d_Curve) C;
|
||||||
BRep_Tool::CurveOnSurface(NewEdge,C,Surf,L,f,l);
|
BRep_Tool::CurveOnSurface(NewEdge,C,Surf,L,f,l);
|
||||||
char name[256];
|
char name[256];
|
||||||
sprintf(name,"OFFSET2d_%d",NbTRIMEDGES++);
|
sprintf(name,"OFFSET2d_%d",NbTRIMEDGES++);
|
||||||
Handle(Geom2d_TrimmedCurve) C2d = new Geom2d_TrimmedCurve(C,f,l);
|
Handle(Geom2d_TrimmedCurve) C2d = new Geom2d_TrimmedCurve(C,f,l);
|
||||||
Handle(DrawTrSurf_Curve2d) dr =
|
Handle(DrawTrSurf_Curve2d) dr =
|
||||||
new DrawTrSurf_Curve2d(C2d,Standard_False);
|
new DrawTrSurf_Curve2d(C2d,Standard_False);
|
||||||
dr->SetColor(Draw_bleu);
|
dr->SetColor(Draw_bleu);
|
||||||
Draw::Set(name,dr);
|
Draw::Set(name,dr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
S.Append(NewEdge);
|
S.Append(NewEdge);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,7 +73,8 @@ is
|
|||||||
Compute (me : in out ;
|
Compute (me : in out ;
|
||||||
anExplo : in out Explorer from BRepMAT2d;
|
anExplo : in out Explorer from BRepMAT2d;
|
||||||
LineIndex : Integer = 1;
|
LineIndex : Integer = 1;
|
||||||
aSide : Side from MAT = MAT_Left )
|
aSide : Side from MAT = MAT_Left;
|
||||||
|
IsOpenResult : Boolean = Standard_False)
|
||||||
--- Purpose : Computation of the Bisector_Locus in a set of Lines
|
--- Purpose : Computation of the Bisector_Locus in a set of Lines
|
||||||
-- defined in <anExplo>.
|
-- defined in <anExplo>.
|
||||||
-- The bisecting locus are computed on the side <aSide>
|
-- The bisecting locus are computed on the side <aSide>
|
||||||
|
@@ -55,9 +55,10 @@ BRepMAT2d_BisectingLocus::BRepMAT2d_BisectingLocus()
|
|||||||
//purpose : Calcul de la carte des lieux bisecteurs sur le contour defini par
|
//purpose : Calcul de la carte des lieux bisecteurs sur le contour defini par
|
||||||
// <anExplo>.
|
// <anExplo>.
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
void BRepMAT2d_BisectingLocus::Compute( BRepMAT2d_Explorer& anExplo,
|
void BRepMAT2d_BisectingLocus::Compute(BRepMAT2d_Explorer& anExplo,
|
||||||
const Standard_Integer IndexLine,
|
const Standard_Integer IndexLine,
|
||||||
const MAT_Side aSide )
|
const MAT_Side aSide,
|
||||||
|
const Standard_Boolean IsOpenResult)
|
||||||
{
|
{
|
||||||
MAT2d_Mat2d TheMAT;
|
MAT2d_Mat2d TheMAT;
|
||||||
Handle(MAT_ListOfBisector) TheRoots = new MAT_ListOfBisector();
|
Handle(MAT_ListOfBisector) TheRoots = new MAT_ListOfBisector();
|
||||||
@@ -86,7 +87,7 @@ void BRepMAT2d_BisectingLocus::Compute( BRepMAT2d_Explorer& anExplo,
|
|||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
// Construction du circuit sur lequel est calcule la carte.
|
// Construction du circuit sur lequel est calcule la carte.
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
Handle(MAT2d_Circuit) ACircuit = new MAT2d_Circuit();
|
Handle(MAT2d_Circuit) ACircuit = new MAT2d_Circuit(IsOpenResult);
|
||||||
// Modified by Sergey KHROMOV - Wed Mar 6 17:43:47 2002 Begin
|
// Modified by Sergey KHROMOV - Wed Mar 6 17:43:47 2002 Begin
|
||||||
// ACircuit->Perform(Figure,IndexLine,(aSide == MAT_Left));
|
// ACircuit->Perform(Figure,IndexLine,(aSide == MAT_Left));
|
||||||
ACircuit->Perform(Figure,anExplo.GetIsClosed(), IndexLine,(aSide == MAT_Left));
|
ACircuit->Perform(Figure,anExplo.GetIsClosed(), IndexLine,(aSide == MAT_Left));
|
||||||
|
@@ -40,13 +40,15 @@ is
|
|||||||
Create returns MakeOffset from BRepOffsetAPI;
|
Create returns MakeOffset from BRepOffsetAPI;
|
||||||
---Purpose: Constructs an algorithm for creating an empty offset
|
---Purpose: Constructs an algorithm for creating an empty offset
|
||||||
Create( Spine : Face from TopoDS;
|
Create( Spine : Face from TopoDS;
|
||||||
Join : JoinType from GeomAbs = GeomAbs_Arc)
|
Join : JoinType from GeomAbs = GeomAbs_Arc;
|
||||||
|
IsOpenResult : Boolean from Standard = Standard_False)
|
||||||
returns MakeOffset from BRepOffsetAPI;
|
returns MakeOffset from BRepOffsetAPI;
|
||||||
---Purpose: Constructs an algorithm for creating an algorithm
|
---Purpose: Constructs an algorithm for creating an algorithm
|
||||||
-- to build parallels to the spine Spine
|
-- to build parallels to the spine Spine
|
||||||
Init( me : in out;
|
Init( me : in out;
|
||||||
Spine : Face from TopoDS;
|
Spine : Face from TopoDS;
|
||||||
Join : JoinType from GeomAbs = GeomAbs_Arc)
|
Join : JoinType from GeomAbs = GeomAbs_Arc;
|
||||||
|
IsOpenResult : Boolean from Standard = Standard_False)
|
||||||
---Purpose: Initializes the algorithm to construct parallels to the spine Spine.
|
---Purpose: Initializes the algorithm to construct parallels to the spine Spine.
|
||||||
-- Join defines the type of parallel generated by the
|
-- Join defines the type of parallel generated by the
|
||||||
-- salient vertices of the spine. The default type is
|
-- salient vertices of the spine. The default type is
|
||||||
@@ -55,11 +57,13 @@ is
|
|||||||
is static;
|
is static;
|
||||||
|
|
||||||
Create( Spine : Wire from TopoDS;
|
Create( Spine : Wire from TopoDS;
|
||||||
Join : JoinType from GeomAbs = GeomAbs_Arc)
|
Join : JoinType from GeomAbs = GeomAbs_Arc;
|
||||||
|
IsOpenResult : Boolean from Standard = Standard_False)
|
||||||
returns MakeOffset from BRepOffsetAPI;
|
returns MakeOffset from BRepOffsetAPI;
|
||||||
|
|
||||||
Init( me : in out;
|
Init( me : in out;
|
||||||
Join : JoinType from GeomAbs = GeomAbs_Arc)
|
Join : JoinType from GeomAbs = GeomAbs_Arc;
|
||||||
|
IsOpenResult : Boolean from Standard = Standard_False)
|
||||||
---Purpose: Initialize the evaluation of Offseting.
|
---Purpose: Initialize the evaluation of Offseting.
|
||||||
is static;
|
is static;
|
||||||
|
|
||||||
@@ -99,6 +103,7 @@ fields
|
|||||||
myIsInitialized : Boolean from Standard;
|
myIsInitialized : Boolean from Standard;
|
||||||
myLastIsLeft : Boolean from Standard;
|
myLastIsLeft : Boolean from Standard;
|
||||||
myJoin : JoinType from GeomAbs;
|
myJoin : JoinType from GeomAbs;
|
||||||
|
myIsOpenResult : Boolean from Standard;
|
||||||
myFace : Face from TopoDS;
|
myFace : Face from TopoDS;
|
||||||
myWires : ListOfShape from TopTools;
|
myWires : ListOfShape from TopTools;
|
||||||
myLeft : ListOfOffsetWire from BRepFill;
|
myLeft : ListOfOffsetWire from BRepFill;
|
||||||
|
@@ -54,9 +54,10 @@ BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Face& Spine,
|
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Face& Spine,
|
||||||
const GeomAbs_JoinType Join)
|
const GeomAbs_JoinType Join,
|
||||||
|
const Standard_Boolean IsOpenResult)
|
||||||
{
|
{
|
||||||
Init(Spine, Join);
|
Init(Spine, Join, IsOpenResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,11 +67,13 @@ BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Face& Spine,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void BRepOffsetAPI_MakeOffset::Init(const TopoDS_Face& Spine,
|
void BRepOffsetAPI_MakeOffset::Init(const TopoDS_Face& Spine,
|
||||||
const GeomAbs_JoinType Join)
|
const GeomAbs_JoinType Join,
|
||||||
|
const Standard_Boolean IsOpenResult)
|
||||||
{
|
{
|
||||||
myFace = Spine;
|
myFace = Spine;
|
||||||
myIsInitialized = Standard_True;
|
myIsInitialized = Standard_True;
|
||||||
myJoin = Join;
|
myJoin = Join;
|
||||||
|
myIsOpenResult = IsOpenResult;
|
||||||
TopExp_Explorer exp;
|
TopExp_Explorer exp;
|
||||||
for (exp.Init(myFace,TopAbs_WIRE); exp.More();exp.Next()) {
|
for (exp.Init(myFace,TopAbs_WIRE); exp.More();exp.Next()) {
|
||||||
myWires.Append(exp.Current());
|
myWires.Append(exp.Current());
|
||||||
@@ -83,11 +86,13 @@ void BRepOffsetAPI_MakeOffset::Init(const TopoDS_Face& Spine,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Wire& Spine,
|
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Wire& Spine,
|
||||||
const GeomAbs_JoinType Join)
|
const GeomAbs_JoinType Join,
|
||||||
|
const Standard_Boolean IsOpenResult)
|
||||||
{
|
{
|
||||||
myWires.Append(Spine);
|
myWires.Append(Spine);
|
||||||
myIsInitialized = Standard_True;
|
myIsInitialized = Standard_True;
|
||||||
myJoin = Join;
|
myJoin = Join;
|
||||||
|
myIsOpenResult = IsOpenResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -95,9 +100,11 @@ BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Wire& Spine,
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void BRepOffsetAPI_MakeOffset::Init(const GeomAbs_JoinType Join)
|
void BRepOffsetAPI_MakeOffset::Init(const GeomAbs_JoinType Join,
|
||||||
|
const Standard_Boolean IsOpenResult)
|
||||||
{
|
{
|
||||||
myJoin = Join;
|
myJoin = Join;
|
||||||
|
myIsOpenResult = IsOpenResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -118,10 +125,11 @@ void BRepOffsetAPI_MakeOffset::AddWire(const TopoDS_Wire& Spine)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
static void BuildDomains(TopoDS_Face& myFace,
|
static void BuildDomains(TopoDS_Face& myFace,
|
||||||
TopTools_ListOfShape& WorkWires,
|
TopTools_ListOfShape& WorkWires,
|
||||||
BRepFill_ListOfOffsetWire& myAlgos,
|
BRepFill_ListOfOffsetWire& myAlgos,
|
||||||
GeomAbs_JoinType myJoin,
|
GeomAbs_JoinType myJoin,
|
||||||
Standard_Boolean isPositive)
|
Standard_Boolean myIsOpenResult,
|
||||||
|
Standard_Boolean isPositive)
|
||||||
{
|
{
|
||||||
BRepAlgo_FaceRestrictor FR;
|
BRepAlgo_FaceRestrictor FR;
|
||||||
TopoDS_Vertex VF,VL;
|
TopoDS_Vertex VF,VL;
|
||||||
@@ -190,7 +198,7 @@ static void BuildDomains(TopoDS_Face& myFace,
|
|||||||
for ( ; itW.More(); itW.Next()) {
|
for ( ; itW.More(); itW.Next()) {
|
||||||
B.Add(F,itW.Value());
|
B.Add(F,itW.Value());
|
||||||
}
|
}
|
||||||
BRepFill_OffsetWire Algo(F, myJoin);
|
BRepFill_OffsetWire Algo(F, myJoin, myIsOpenResult);
|
||||||
myAlgos.Append(Algo);
|
myAlgos.Append(Algo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -243,7 +251,7 @@ static void BuildDomains(TopoDS_Face& myFace,
|
|||||||
// Creation of algorithms on each domain.
|
// Creation of algorithms on each domain.
|
||||||
//========================================
|
//========================================
|
||||||
for (itF.Initialize(Faces); itF.More(); itF.Next()) {
|
for (itF.Initialize(Faces); itF.More(); itF.Next()) {
|
||||||
BRepFill_OffsetWire Algo(TopoDS::Face(itF.Value()), myJoin);
|
BRepFill_OffsetWire Algo(TopoDS::Face(itF.Value()), myJoin, myIsOpenResult);
|
||||||
myAlgos.Append(Algo);
|
myAlgos.Append(Algo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -253,8 +261,8 @@ static void BuildDomains(TopoDS_Face& myFace,
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void BRepOffsetAPI_MakeOffset::Perform( const Standard_Real Offset,
|
void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset,
|
||||||
const Standard_Real Alt)
|
const Standard_Real Alt)
|
||||||
{
|
{
|
||||||
StdFail_NotDone_Raise_if ( !myIsInitialized,
|
StdFail_NotDone_Raise_if ( !myIsInitialized,
|
||||||
"BRepOffsetAPI_MakeOffset : Perform without Init");
|
"BRepOffsetAPI_MakeOffset : Perform without Init");
|
||||||
@@ -273,7 +281,7 @@ void BRepOffsetAPI_MakeOffset::Perform( const Standard_Real Offset,
|
|||||||
if( myLeft.IsEmpty() )
|
if( myLeft.IsEmpty() )
|
||||||
{
|
{
|
||||||
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 Begin
|
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 Begin
|
||||||
BuildDomains(myFace,myWires,myLeft,myJoin, Standard_False);
|
BuildDomains(myFace,myWires,myLeft,myJoin,myIsOpenResult, Standard_False);
|
||||||
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 End
|
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 End
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,7 +304,7 @@ void BRepOffsetAPI_MakeOffset::Perform( const Standard_Real Offset,
|
|||||||
if (myRight.IsEmpty())
|
if (myRight.IsEmpty())
|
||||||
{
|
{
|
||||||
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:28 2001 Begin
|
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:28 2001 Begin
|
||||||
BuildDomains(myFace,myWires,myRight,myJoin, Standard_True);
|
BuildDomains(myFace,myWires,myRight,myJoin,myIsOpenResult, Standard_True);
|
||||||
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:35 2001 End
|
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:35 2001 End
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1502,6 +1502,7 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
|
|||||||
char name[100];
|
char name[100];
|
||||||
|
|
||||||
BRepOffsetAPI_MakeOffset Paral;
|
BRepOffsetAPI_MakeOffset Paral;
|
||||||
|
Paral.Init(GeomAbs_Arc);
|
||||||
TopoDS_Shape Base = DBRep::Get(a[2],TopAbs_FACE);
|
TopoDS_Shape Base = DBRep::Get(a[2],TopAbs_FACE);
|
||||||
|
|
||||||
if ( Base.IsNull())
|
if ( Base.IsNull())
|
||||||
@@ -1554,6 +1555,50 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : openoffset
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Integer openoffset(Draw_Interpretor& di,
|
||||||
|
Standard_Integer n, const char** a)
|
||||||
|
{
|
||||||
|
if (n < 5) return 1;
|
||||||
|
char name[100];
|
||||||
|
|
||||||
|
TopoDS_Shape Base = DBRep::Get(a[2], TopAbs_WIRE);
|
||||||
|
|
||||||
|
BRepOffsetAPI_MakeOffset Paral(TopoDS::Wire(Base), GeomAbs_Arc, 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.;
|
||||||
|
for ( Standard_Integer i = 1; i <= Nb; i++)
|
||||||
|
{
|
||||||
|
U = i * dU;
|
||||||
|
Paral.Perform(U,Alt);
|
||||||
|
|
||||||
|
if ( !Paral.IsDone())
|
||||||
|
{
|
||||||
|
di << " Error: Offset is not done." << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Sprintf(name,"%s_%d", a[1], Compt++);
|
||||||
|
char* temp = name; // portage WNT
|
||||||
|
DBRep::Set(temp,Paral.Shape());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : pickface
|
//function : pickface
|
||||||
//purpose :
|
//purpose :
|
||||||
@@ -1819,6 +1864,9 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
|
|||||||
"mkoffset result face/compound of wires nboffset stepoffset [alt]",__FILE__,
|
"mkoffset result face/compound of wires nboffset stepoffset [alt]",__FILE__,
|
||||||
mkoffset);
|
mkoffset);
|
||||||
|
|
||||||
|
theCommands.Add("openoffset",
|
||||||
|
"openoffset result wire nboffset stepoffset",__FILE__,
|
||||||
|
openoffset);
|
||||||
|
|
||||||
theCommands.Add("mkedge",
|
theCommands.Add("mkedge",
|
||||||
"mkedge edge curve [surface] [pfirst plast] [vfirst [pfirst] vlast [plast]] ",__FILE__,
|
"mkedge edge curve [surface] [pfirst plast] [vfirst [pfirst] vlast [plast]] ",__FILE__,
|
||||||
|
@@ -41,7 +41,8 @@ uses
|
|||||||
|
|
||||||
is
|
is
|
||||||
|
|
||||||
Create returns Circuit from MAT2d;
|
Create(IsOpenResult : Boolean from Standard = Standard_False)
|
||||||
|
returns Circuit from MAT2d;
|
||||||
|
|
||||||
---Category: Computation
|
---Category: Computation
|
||||||
|
|
||||||
@@ -129,6 +130,7 @@ fields
|
|||||||
connexionMap : DataMapOfIntegerConnexion from MAT2d;
|
connexionMap : DataMapOfIntegerConnexion from MAT2d;
|
||||||
linkRefEqui : DataMapOfBiIntSequenceOfInteger from MAT2d;
|
linkRefEqui : DataMapOfBiIntSequenceOfInteger from MAT2d;
|
||||||
linesLength : SequenceOfInteger from TColStd;
|
linesLength : SequenceOfInteger from TColStd;
|
||||||
|
myIsOpenResult : Boolean from Standard;
|
||||||
|
|
||||||
end Circuit;
|
end Circuit;
|
||||||
|
|
||||||
|
@@ -75,8 +75,9 @@ static Standard_Boolean IsSharpCorner (const Handle(Geom2d_Geometry)& Geom1,
|
|||||||
//function : Constructor
|
//function : Constructor
|
||||||
//purpose :
|
//purpose :
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
MAT2d_Circuit::MAT2d_Circuit()
|
MAT2d_Circuit::MAT2d_Circuit(const Standard_Boolean IsOpenResult)
|
||||||
{
|
{
|
||||||
|
myIsOpenResult = IsOpenResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@@ -353,12 +354,16 @@ void MAT2d_Circuit::InitOpen (TColGeom2d_SequenceOfGeometry& Line) const
|
|||||||
Handle(Geom2d_TrimmedCurve) Curve;
|
Handle(Geom2d_TrimmedCurve) Curve;
|
||||||
Standard_Real DotProd;
|
Standard_Real DotProd;
|
||||||
|
|
||||||
Curve = Handle(Geom2d_TrimmedCurve)::DownCast(Line.First());
|
if (!myIsOpenResult)
|
||||||
Line.InsertBefore(1,new Geom2d_CartesianPoint(Curve->StartPoint()));
|
{
|
||||||
Curve = Handle(Geom2d_TrimmedCurve)::DownCast(Line.Last());
|
Curve = Handle(Geom2d_TrimmedCurve)::DownCast(Line.First());
|
||||||
Line.Append(new Geom2d_CartesianPoint(Curve->EndPoint()));
|
Line.InsertBefore(1,new Geom2d_CartesianPoint(Curve->StartPoint()));
|
||||||
|
Curve = Handle(Geom2d_TrimmedCurve)::DownCast(Line.Last());
|
||||||
|
Line.Append(new Geom2d_CartesianPoint(Curve->EndPoint()));
|
||||||
|
}
|
||||||
|
|
||||||
for ( Standard_Integer i = 2; i <= Line.Length() - 2; i++) {
|
Standard_Integer addition = (myIsOpenResult)? 1 : 2;
|
||||||
|
for ( Standard_Integer i = addition; i <= Line.Length() - addition; i++) {
|
||||||
if ( Abs(CrossProd(Line.Value(i),Line.Value(i+1),DotProd)) > 1.E-8 ||
|
if ( Abs(CrossProd(Line.Value(i),Line.Value(i+1),DotProd)) > 1.E-8 ||
|
||||||
DotProd < 0. ) {
|
DotProd < 0. ) {
|
||||||
Curve = Handle(Geom2d_TrimmedCurve)::DownCast(Line.Value(i));
|
Curve = Handle(Geom2d_TrimmedCurve)::DownCast(Line.Value(i));
|
||||||
@@ -389,15 +394,18 @@ const
|
|||||||
//--------------------------
|
//--------------------------
|
||||||
// Completion de la ligne.
|
// Completion de la ligne.
|
||||||
//--------------------------
|
//--------------------------
|
||||||
for ( i = NbItems - 1; i > 1; i--){
|
if (!myIsOpenResult)
|
||||||
Type = Line.Value(i)->DynamicType();
|
{
|
||||||
if ( Type == STANDARD_TYPE(Geom2d_CartesianPoint) ){
|
for ( i = NbItems - 1; i > 1; i--){
|
||||||
Line.Append(Line.Value(i));
|
Type = Line.Value(i)->DynamicType();
|
||||||
}
|
if ( Type == STANDARD_TYPE(Geom2d_CartesianPoint) ){
|
||||||
else {
|
Line.Append(Line.Value(i));
|
||||||
Curve = Handle(Geom2d_TrimmedCurve)::DownCast(Line.Value(i)->Copy());
|
}
|
||||||
Curve->Reverse();
|
else {
|
||||||
Line.Append(Curve);
|
Curve = Handle(Geom2d_TrimmedCurve)::DownCast(Line.Value(i)->Copy());
|
||||||
|
Curve->Reverse();
|
||||||
|
Line.Append(Curve);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,29 +494,33 @@ const
|
|||||||
}
|
}
|
||||||
Corres(ICorres) = IndLine;
|
Corres(ICorres) = IndLine;
|
||||||
|
|
||||||
for (i = 1; i < 2*NbItems - 2; i++) {
|
if (!myIsOpenResult)
|
||||||
if (Corres(i) == 0) Corres(i) = Corres(2*NbItems - i);
|
{
|
||||||
}
|
for (i = 1; i < 2*NbItems - 2; i++) {
|
||||||
|
if (Corres(i) == 0)
|
||||||
|
Corres(i) = Corres(2*NbItems - i);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEB
|
#ifdef DEB
|
||||||
if (AffichCircuit) {
|
if (AffichCircuit) {
|
||||||
for (i = 1; i <= 2*NbItems - 2; i++) {
|
for (i = 1; i <= 2*NbItems - 2; i++) {
|
||||||
cout<< "Correspondance "<< i<<" -> "<<Corres(i)<<endl;
|
cout<< "Correspondance "<< i<<" -> "<<Corres(i)<<endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------
|
//----------------------------
|
||||||
// Mise a jour des Connexions.
|
// Mise a jour des Connexions.
|
||||||
//----------------------------
|
//----------------------------
|
||||||
for ( i = 1; i <= NbConnexions; i++){
|
for ( i = 1; i <= NbConnexions; i++){
|
||||||
CC = ConnexionFrom.ChangeValue(i);
|
CC = ConnexionFrom.ChangeValue(i);
|
||||||
CC->IndexItemOnFirst(Corres(CC->IndexItemOnFirst()));
|
CC->IndexItemOnFirst(Corres(CC->IndexItemOnFirst()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ConnexionFather.IsNull()) {
|
if (!ConnexionFather.IsNull()) {
|
||||||
ConnexionFather
|
ConnexionFather
|
||||||
->IndexItemOnSecond(Corres(ConnexionFather->IndexItemOnSecond()));
|
->IndexItemOnSecond(Corres(ConnexionFather->IndexItemOnSecond()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
tests/bugs/modalg_5/bug25021
Normal file
17
tests/bugs/modalg_5/bug25021
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
puts "========================"
|
||||||
|
puts "OCC25021"
|
||||||
|
puts "========================"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# New option of BRepOffsetAPI_MakeOffset algorithm: open result for open wire
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug24573_Wire.brep] ww
|
||||||
|
|
||||||
|
openoffset res1 ww 1 12.5
|
||||||
|
openoffset res2 ww 1 -12.5
|
||||||
|
|
||||||
|
smallview
|
||||||
|
fit
|
||||||
|
|
||||||
|
set only_screen_axo 1
|
Reference in New Issue
Block a user