1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0031336: Modeling data - extend BRepPrimAPI_MakeBox with planar shape creation

-Create a new package BRepPreviewAPI, inherited from BRepPrimAPI to create both, valid and degenerative shapes
-Create a new class BRepPreviewAPI_MakeBox for working with a box
    Preview can be vertex, edge, rectangle or box
-BRepPrim_GWedge: in the case of non-valid data, the exception does not happen in the constructor, but at the moment of access to the shape
-BRepPrimAPI_MakeBox: myWedge is now not private, but protected, because used in  BRepPreviewAPI_MakeBox which inherits from BRepPrimAPI_MakeBox
-Add tests for checking of a creation a preview in tests/geometry/preview (vertex, edge, rectangle, box)
-Update a command "box": add new parameters
This commit is contained in:
sshutina
2020-02-10 16:32:56 +03:00
committed by bugmaster
parent 7e1c1e4869
commit 10ac040338
16 changed files with 584 additions and 51 deletions

View File

@@ -134,6 +134,27 @@ static void BRepPrim_Wedge_Init(Standard_Boolean& S,
F[i] = Standard_False;
}
BRepPrim_GWedge::BRepPrim_GWedge() :
XMin (0),
XMax (0),
YMin (0),
YMax (0),
ZMin (0),
ZMax (0),
Z2Min (0),
Z2Max (0),
X2Min (0),
X2Max (0)
{
for (Standard_Integer i = 0; i < NBFACES; i++)
{
myInfinite[i]=Standard_False;
}
BRepPrim_Wedge_Init (ShellBuilt,VerticesBuilt,EdgesBuilt,
WiresBuilt,FacesBuilt);
}
//=======================================================================
//function : BRepPrim_GWedge
//purpose : build a box
@@ -158,10 +179,7 @@ BRepPrim_GWedge::BRepPrim_GWedge (const BRepPrim_Builder& B,
X2Max(dx)
{
for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; }
if ( ( dx <= Precision::Confusion() ) ||
( dy <= Precision::Confusion() ) ||
( dz <= Precision::Confusion() ) )
throw Standard_DomainError();
BRepPrim_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt,
WiresBuilt,FacesBuilt);
}
@@ -191,11 +209,7 @@ BRepPrim_GWedge::BRepPrim_GWedge (const BRepPrim_Builder& B,
X2Max(ltx)
{
for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; }
if ( ( dx <= Precision::Confusion() ) ||
( dy <= Precision::Confusion() ) ||
( dz <= Precision::Confusion() ) ||
( ltx < 0 ) )
throw Standard_DomainError();
BRepPrim_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt,
WiresBuilt,FacesBuilt);
}
@@ -231,12 +245,7 @@ BRepPrim_GWedge::BRepPrim_GWedge (const BRepPrim_Builder& B,
X2Max(x2max)
{
for (Standard_Integer i = 0; i < NBFACES; i++) { myInfinite[i]=Standard_False; }
if ( ( XMax-XMin <= Precision::Confusion() ) ||
( YMax-YMin <= Precision::Confusion() ) ||
( ZMax-ZMin <= Precision::Confusion() ) ||
( Z2Max-Z2Min < 0 ) ||
( X2Max-X2Min < 0 ) )
throw Standard_DomainError();
BRepPrim_Wedge_Init(ShellBuilt,VerticesBuilt,EdgesBuilt,
WiresBuilt,FacesBuilt);
}
@@ -296,6 +305,9 @@ Standard_Boolean BRepPrim_GWedge::IsInfinite (const BRepPrim_Direction d1) const
//=======================================================================
const TopoDS_Shell& BRepPrim_GWedge::Shell() {
if (IsDegeneratedShape())
throw Standard_DomainError();
if (!ShellBuilt) {
myBuilder.MakeShell(myShell);
@@ -1020,3 +1032,19 @@ const TopoDS_Vertex& BRepPrim_GWedge::Vertex
}
//=======================================================================
//function : IsDegeneratedShape
//purpose :
//=======================================================================
Standard_Boolean BRepPrim_GWedge::IsDegeneratedShape()
{
if ( ( XMax-XMin <= Precision::Confusion() ) ||
( YMax-YMin <= Precision::Confusion() ) ||
( ZMax-ZMin <= Precision::Confusion() ) ||
( Z2Max-Z2Min < 0 ) ||
( X2Max-X2Min < 0 ) )
return Standard_True;
else
return Standard_False;
}

View File

@@ -70,6 +70,8 @@ public:
DEFINE_STANDARD_ALLOC
//! Default constructor
Standard_EXPORT BRepPrim_GWedge();
//! Creates a GWedge algorithm. <Axes> is the axis
//! system for the primitive.
@@ -191,7 +193,9 @@ public:
//! <d1><d2><d3> direction.
Standard_EXPORT gp_Pnt Point (const BRepPrim_Direction d1, const BRepPrim_Direction d2, const BRepPrim_Direction d3);
//! Checkes a shape on degeneracy
//! @return TRUE if a shape is degenerated
Standard_EXPORT Standard_Boolean IsDegeneratedShape();
protected:

View File

@@ -34,7 +34,9 @@ public:
DEFINE_STANDARD_ALLOC
//! Default constructor
BRepPrim_Wedge() {}
//! Creates a Wedge algorithm. <Axes> is the axis
//! system for the primitive.
//!