1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Integration of OCCT 6.5.0 from SVN

This commit is contained in:
bugmaster
2011-03-16 07:30:28 +00:00
committed by bugmaster
parent 4903637061
commit 7fd59977df
16375 changed files with 3882564 additions and 0 deletions

130
src/BRepPrimAPI/BRepPrimAPI.cdl Executable file
View File

@@ -0,0 +1,130 @@
-- File: BRepPrimAPI.cdl
-- Created: Tue Jul 6 17:29:03 1993
-- Author: Remi LEQUETTE
-- <rle@phylox>
---Copyright: Matra Datavision 1993
package BRepPrimAPI
---Purpose: The BRepBuilderAPI package provides an Application
-- Programming Interface for the BRep topology data
-- structure.
--
-- The API is a set of classes aiming to provide :
--
-- * High level and simple calls for the most common
-- operations.
--
-- * Keeping an access on the low-level
-- implementation of high-level calls.
--
-- * Examples of programming of high-level operations
-- from low-level operations.
--
-- * A complete coverage of modelling :
--
-- - Creating vertices ,edges, faces, solids.
--
-- - Sweeping operations.
--
-- - Boolean operations.
--
-- - Global properties computation.
--
--
-- The API provides classes to build objects:
--
-- * The constructors of the classes provides the
-- different constructions methods.
--
-- * The class keeps as fields the different tools
-- used to build the object.
--
-- * The class provides a casting method to get
-- automatically the result with a function-like
-- call.
--
-- For example to make a vertex <V> from a point <P>
-- one can writes :
--
-- V = BRepBuilderAPI_MakeVertex(P);
--
-- or
--
-- BRepBuilderAPI_MakeVertex MV(P);
-- V = MV.Vertex();
--
--
-- For tolerances a default precision is used which
-- can be changed by the packahe method
-- BRepBuilderAPI::Precision.
--
-- For error handling the BRepBuilderAPI commands raise only
-- the NotDone error. When Done is false on a command
-- the error description can be asked to the command.
--
-- In theory the comands can be called with any
-- arguments, argument checking is performed by the
-- command.
uses
StdFail,
gp,
TColgp,
Geom2d,
Geom,
GeomAbs,
TopAbs,
TopoDS,
TopTools,
TopLoc,
BRep,
BRepLib,
BRepTools,
BRepPrim,
BRepBuilderAPI,
BRepSweep
is
--
-- Primitives
--
class MakeHalfSpace; --- inherits MakeShape from BRepBuilderAPI
class MakeBox; --- inherits MakeShape from BRepBuilderAPI
class MakeWedge; --- inherits MakeShape from BRepBuilderAPI
deferred class MakeOneAxis; --- inherits MakeShape from BRepBuilderAPI
---Purpose: Root class for rotational primitives.
class MakeCylinder; --- inherits MakeShape from BRepBuilderAPI
class MakeCone; --- inherits MakeShape from BRepBuilderAPI
class MakeSphere; --- inherits MakeOneAxis from BRepPrimAPI
class MakeTorus; --- inherits MakeOneAxis from BRepPrimAPI
class MakeRevolution; --- inherits MakeOneAxis from BRepPrimAPI
--
-- Sweeping
--
deferred class MakeSweep; --- inherits MakeShape from BRepBuilderAPI
class MakePrism; --- inherits MakeSweep from BRepPrimAPI
class MakeRevol; --- inherits MakeSweep from BRepPrimAPI
end BRepPrimAPI;

View File

@@ -0,0 +1,140 @@
-- File: BRepPrimAPI_MakeBox.cdl
-- Created: Wed Jul 21 16:07:07 1993
-- Author: Remi LEQUETTE
-- <rle@nonox>
---Copyright: Matra Datavision 1993
class MakeBox from BRepPrimAPI inherits MakeShape from BRepBuilderAPI
---Purpose: Describes functions to build parallelepiped boxes.
-- A MakeBox object provides a framework for:
-- - defining the construction of a box,
-- - implementing the construction algorithm, and
-- - consulting the result.
uses
Ax2 from gp,
Pnt from gp,
Face from TopoDS,
Shell from TopoDS,
Solid from TopoDS,
Wedge from BRepPrim
raises
DomainError from Standard,
OutOfRange from Standard,
NotDone from StdFail
is
Create(dx, dy, dz : Real)
returns MakeBox from BRepPrimAPI
---Purpose: Make a box with a corner at 0,0,0 and the other dx,dy,dz
---Level: Public
raises
DomainError from Standard; -- if dx,dy,dz <= Precision::Confusion()
Create(P : Pnt from gp; dx, dy, dz : Real)
returns MakeBox from BRepPrimAPI
---Purpose: Make a box with a corner at P and size dx, dy, dz.
---Level: Public
raises
DomainError from Standard; -- if dx,dy,dz <= Precision::Confusion()
Create(P1,P2 : Pnt from gp)
returns MakeBox from BRepPrimAPI
---Purpose: Make a box with corners P1,P2.
---Level: Public
raises
DomainError from Standard; -- if dx,dy,dz <= Precision::Confusion()
Create(Axes : Ax2 from gp; dx, dy, dz : Real)
returns MakeBox from BRepPrimAPI
---Purpose: Ax2 is the left corner and the axis.
---Level: Public
raises
DomainError from Standard; -- if dx,dy,dz <= Precision::Confusion()
---Purpose: Constructs a box such that its sides are parallel to the axes of
-- - the global coordinate system, or
-- - the local coordinate system Axis. and
-- - with a corner at (0, 0, 0) and of size (dx, dy, dz), or
-- - with a corner at point P and of size (dx, dy, dz), or
-- - with corners at points P1 and P2.
-- Exceptions
-- Standard_DomainError if: dx, dy, dz are less than or equal to
-- Precision::Confusion(), or
-- - the vector joining the points P1 and P2 has a
-- component projected onto the global coordinate
-- system less than or equal to Precision::Confusion().
-- In these cases, the box would be flat.
Wedge(me : in out) returns Wedge from BRepPrim
---Purpose: Returns the internal algorithm.
--
---C++: return &
---Level: Public
is static;
----------------------------------------
-- Results
----------------------------------------
Build(me : in out)
---Purpose: Stores the solid in myShape.
---Level: Public
is redefined;
Shell(me : in out) returns Shell from TopoDS
---C++: return const &
---C++: alias "Standard_EXPORT operator TopoDS_Shell();"
---Purpose: Returns the constructed box as a shell.
is static;
Solid(me : in out) returns Solid from TopoDS
---C++: return const &
---C++: alias "Standard_EXPORT operator TopoDS_Solid();"
---Purpose: Returns the constructed box as a solid.
is static;
BottomFace (me : in out) returns Face from TopoDS;
---Purpose : Returns ZMin face
---C++: return const &
BackFace (me : in out) returns Face from TopoDS;
---Purpose : Returns XMin face
---C++: return const &
FrontFace (me : in out) returns Face from TopoDS;
---Purpose : Returns XMax face
---C++: return const &
LeftFace (me : in out) returns Face from TopoDS;
---Purpose : Returns YMin face
---C++: return const &
RightFace (me : in out) returns Face from TopoDS;
---Purpose : Returns YMax face
---C++: return const &
TopFace (me : in out) returns Face from TopoDS;
---Purpose : Returns ZMax face
---C++: return const &
fields
myWedge : Wedge from BRepPrim;
end MakeBox;

View File

@@ -0,0 +1,227 @@
// File: BRepPrimAPI_MakeBox.cxx
// Created: Fri Jul 23 15:51:42 1993
// Author: Remi LEQUETTE
// <rle@nonox>
#include <BRepPrimAPI_MakeBox.ixx>
#include <BRepBuilderAPI.hxx>
#include <TopoDS.hxx>
#include <Primitives_Direction.hxx>
inline gp_Pnt pmin(const gp_Pnt& p,
const Standard_Real dx,
const Standard_Real dy,
const Standard_Real dz)
{
gp_Pnt P = p;
if (dx < 0) P.SetX(P.X()+dx);
if (dy < 0) P.SetY(P.Y()+dy);
if (dz < 0) P.SetZ(P.Z()+dz);
return P;
}
//=======================================================================
//function : BRepPrimAPI_MakeBox
//purpose :
//=======================================================================
BRepPrimAPI_MakeBox::BRepPrimAPI_MakeBox(const Standard_Real dx,
const Standard_Real dy,
const Standard_Real dz) :
myWedge(gp_Ax2(pmin(gp_Pnt(0,0,0),dx,dy,dz),gp_Dir(0,0,1),gp_Dir(1,0,0)),
Abs(dx),Abs(dy),Abs(dz))
{
}
//=======================================================================
//function : BRepPrimAPI_MakeBox
//purpose :
//=======================================================================
BRepPrimAPI_MakeBox::BRepPrimAPI_MakeBox(const gp_Pnt& P,
const Standard_Real dx,
const Standard_Real dy,
const Standard_Real dz) :
myWedge(gp_Ax2(pmin(P,dx,dy,dz),gp_Dir(0,0,1),gp_Dir(1,0,0)),
Abs(dx),Abs(dy),Abs(dz))
{
}
//=======================================================================
//function : BRepPrimAPI_MakeBox
//purpose :
//=======================================================================
inline gp_Pnt pmin(const gp_Pnt& p1, const gp_Pnt& p2)
{
return gp_Pnt(Min(p1.X(),p2.X()),Min(p1.Y(),p2.Y()),Min(p1.Z(),p2.Z()));
}
BRepPrimAPI_MakeBox::BRepPrimAPI_MakeBox(const gp_Pnt& P1, const gp_Pnt& P2) :
myWedge(gp_Ax2(pmin(P1,P2),gp_Dir(0,0,1),gp_Dir(1,0,0)),
Abs(P2.X()-P1.X()),
Abs(P2.Y()-P1.Y()),
Abs(P2.Z()-P1.Z()))
{
}
//=======================================================================
//function : BRepPrimAPI_MakeBox
//purpose :
//=======================================================================
BRepPrimAPI_MakeBox::BRepPrimAPI_MakeBox(const gp_Ax2& Axes,
const Standard_Real dx,
const Standard_Real dy,
const Standard_Real dz) :
myWedge(Axes,dx,dy,dz)
{
}
//=======================================================================
//function : Wedge
//purpose :
//=======================================================================
BRepPrim_Wedge& BRepPrimAPI_MakeBox::Wedge()
{
return myWedge;
}
//=======================================================================
//function : Shell
//purpose :
//=======================================================================
const TopoDS_Shell& BRepPrimAPI_MakeBox::Shell()
{
myShape = myWedge.Shell();
Done();
return TopoDS::Shell(myShape);
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepPrimAPI_MakeBox::Build()
{
Solid();
}
//=======================================================================
//function : Solid
//purpose :
//=======================================================================
const TopoDS_Solid& BRepPrimAPI_MakeBox::Solid()
{
BRep_Builder B;
B.MakeSolid(TopoDS::Solid(myShape));
B.Add(myShape,myWedge.Shell());
Done();
return TopoDS::Solid(myShape);
}
//=======================================================================
//function : operator
//purpose :
//=======================================================================
BRepPrimAPI_MakeBox::operator TopoDS_Shell()
{
return Shell();
}
//=======================================================================
//function : operator
//purpose :
//=======================================================================
BRepPrimAPI_MakeBox::operator TopoDS_Solid()
{
return Solid();
}
//=======================================================================
//function : BottomFace
//purpose :
//=======================================================================
const TopoDS_Face& BRepPrimAPI_MakeBox::BottomFace () {
return myWedge.Face (Primitives_ZMin);
}
//=======================================================================
//function : BackFace
//purpose :
//=======================================================================
const TopoDS_Face& BRepPrimAPI_MakeBox::BackFace () {
return myWedge.Face (Primitives_XMin);
}
//=======================================================================
//function : FrontFace
//purpose :
//=======================================================================
const TopoDS_Face& BRepPrimAPI_MakeBox::FrontFace () {
return myWedge.Face (Primitives_XMax);
}
//=======================================================================
//function : LeftFace
//purpose :
//=======================================================================
const TopoDS_Face& BRepPrimAPI_MakeBox::LeftFace () {
return myWedge.Face (Primitives_YMin);
}
//=======================================================================
//function : RightFace
//purpose :
//=======================================================================
const TopoDS_Face& BRepPrimAPI_MakeBox::RightFace () {
return myWedge.Face (Primitives_YMax);
}
//=======================================================================
//function : TopFace
//purpose :
//=======================================================================
const TopoDS_Face& BRepPrimAPI_MakeBox::TopFace () {
return myWedge.Face (Primitives_ZMax);
}

View File

@@ -0,0 +1,103 @@
-- File: BRepPrimAPI_MakeCone.cdl
-- Created: Wed Jul 21 16:07:30 1993
-- Author: Remi LEQUETTE
-- <rle@nonox>
---Copyright: Matra Datavision 1993
class MakeCone from BRepPrimAPI inherits MakeOneAxis from BRepPrimAPI
---Purpose: Describes functions to build cones or portions of cones.
-- A MakeCone object provides a framework for:
-- - defining the construction of a cone,
-- - implementing the construction algorithm, and
-- - consulting the result.
uses
Ax2 from gp,
Cone from BRepPrim,
OneAxis from BRepPrim
raises
DomainError from Standard
is
Create(R1, R2, H : Real)
returns MakeCone from BRepPrimAPI
---Purpose: Make a cone of height H radius R1 in the plane z =
-- 0, R2 in the plane Z = H. R1 and R2 may be null.
---Level: Public
raises
DomainError from Standard; -- if H <= Precision::Confusion()
Create(R1, R2, H, angle : Real)
returns MakeCone from BRepPrimAPI
---Purpose: Make a cone of height H radius R1 in the plane z =
-- 0, R2 in the plane Z = H. R1 and R2 may be null.
-- Take a section of <angle>
---Level: Public
raises
DomainError from Standard; -- if H <= Precision::Confusion()
Create(Axes : Ax2 from gp; R1, R2, H : Real)
returns MakeCone from BRepPrimAPI
---Purpose: Make a cone of height H radius R1 in the plane z =
-- 0, R2 in the plane Z = H. R1 and R2 may be null.
---Level: Public
raises
DomainError from Standard; -- if H <= Precision::Confusion()
Create(Axes : Ax2 from gp; R1, R2, H, angle : Real)
returns MakeCone from BRepPrimAPI
---Purpose: Make a cone of height H radius R1 in the plane z =
-- 0, R2 in the plane Z = H. R1 and R2 may be null.
-- Take a section of <angle>
---Level: Public
raises
DomainError from Standard; -- if H <= Precision::Confusion()
---Purpose: Constructs a cone, or a portion of a cone, of height H,
-- and radius R1 in the plane z = 0 and R2 in the plane
-- z = H. The result is a sharp cone if R1 or R2 is equal to 0.
-- The cone is constructed about the "Z Axis" of either:
-- - the global coordinate system, or
-- - the local coordinate system Axes.
-- It is limited in these coordinate systems as follows:
-- - in the v parametric direction (the Z coordinate), by
-- the two parameter values 0 and H,
-- - and in the u parametric direction (defined by the
-- angle of rotation around the Z axis), in the case of a
-- portion of a cone, by the two parameter values 0 and
-- angle. Angle is given in radians.
-- The resulting shape is composed of:
-- - a lateral conical face
-- - two planar faces in the planes z = 0 and z = H,
-- or only one planar face in one of these two planes if a
-- radius value is null (in the case of a complete cone,
-- these faces are circles), and
-- - and in the case of a portion of a cone, two planar
-- faces to close the shape. (either two parallelograms or
-- two triangles, in the planes u = 0 and u = angle).
-- Exceptions
-- Standard_DomainError if:
-- - H is less than or equal to Precision::Confusion(), or
-- - the half-angle at the apex of the cone, defined by
-- R1, R2 and H, is less than Precision::Confusion()/H, or greater than
-- (Pi/2)-Precision::Confusion()/H.f
OneAxis(me : in out) returns Address;
---Purpose: Returns the algorithm.
---Level: Public
Cone(me : in out) returns Cone from BRepPrim
---Purpose: Returns the algorithm.
--
---C++: return &
---Level: Public
is static;
fields
myCone : Cone from BRepPrim;
end MakeCone;

View File

@@ -0,0 +1,123 @@
// File: BRepPrimAPI_MakeCone.cxx
// Created: Fri Jul 23 15:51:44 1993
// Author: Remi LEQUETTE
// <rle@nonox>
#include <BRepPrimAPI_MakeCone.ixx>
#include <BRepBuilderAPI.hxx>
#include <gp.hxx>
#include <gp_Dir.hxx>
#include <gp_Ax2.hxx>
//-- lbr le 13 decembre 95
static gp_Ax2 ConeComputeAxes() {
static Standard_Integer firsttime=1;
static Standard_Integer modif=0;
static Standard_Real cosa=cos(0.122);
static Standard_Real sina=sin(0.122);
static Standard_Real ux=1.0;
static Standard_Real uy=0.0;
if(firsttime) {
modif = getenv("PRIM_CONE") != NULL;
firsttime = 0;
}
if(modif) {
Standard_Real nux = cosa*ux+sina*uy;
Standard_Real nuy =-sina*ux+cosa*uy;
ux=nux; uy=nuy;
return(gp_Ax2(gp::Origin(),gp::DZ(),gp_Dir(ux,uy,0.0)));
}
else {
return(gp::XOY());
}
}
//=======================================================================
//function : BRepPrimAPI_MakeCone
//purpose :
//=======================================================================
BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const Standard_Real R1,
const Standard_Real R2,
const Standard_Real H) :
myCone(ConeComputeAxes(),R1, R2, H)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeCone
//purpose :
//=======================================================================
BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const Standard_Real R1,
const Standard_Real R2,
const Standard_Real H,
const Standard_Real angle) :
myCone( R1, R2, H)
{
myCone.Angle(angle);
}
//=======================================================================
//function : BRepPrimAPI_MakeCone
//purpose :
//=======================================================================
BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const gp_Ax2& Axes,
const Standard_Real R1,
const Standard_Real R2,
const Standard_Real H) :
myCone( Axes, R1, R2, H)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeCone
//purpose :
//=======================================================================
BRepPrimAPI_MakeCone::BRepPrimAPI_MakeCone(const gp_Ax2& Axes,
const Standard_Real R1,
const Standard_Real R2,
const Standard_Real H,
const Standard_Real angle) :
myCone( Axes, R1, R2, H)
{
myCone.Angle(angle);
}
//=======================================================================
//function : OneAxis
//purpose :
//=======================================================================
Standard_Address BRepPrimAPI_MakeCone::OneAxis()
{
return &myCone;
}
//=======================================================================
//function : Cone
//purpose :
//=======================================================================
BRepPrim_Cone& BRepPrimAPI_MakeCone::Cone()
{
return myCone;
}

View File

@@ -0,0 +1,96 @@
-- File: BRepPrimAPI_MakeCylinder.cdl
-- Created: Wed Jul 21 16:07:20 1993
-- Author: Remi LEQUETTE
-- <rle@nonox>
---Copyright: Matra Datavision 1993
class MakeCylinder from BRepPrimAPI inherits MakeOneAxis from BRepPrimAPI
---Purpose: Describes functions to build cylinders or portions of cylinders.
-- A MakeCylinder object provides a framework for:
-- - defining the construction of a cylinder,
-- - implementing the construction algorithm, and
-- - consulting the result.
uses
Ax2 from gp,
Cylinder from BRepPrim,
OneAxis from BRepPrim
raises
DomainError from Standard
is
Create(R, H : Real)
returns MakeCylinder from BRepPrimAPI
---Purpose: Make a cylinder of radius R and length H.
---Level: Public
raises
DomainError from Standard; -- if R or H <= Precision::Confusion()
Create(R, H, Angle : Real)
returns MakeCylinder from BRepPrimAPI
---Purpose: Make a cylinder of radius R and length H with
-- angle H.
---Level: Public
raises
DomainError from Standard; -- if R or H <= Precision::Confusion()
Create(Axes : Ax2 from gp; R, H : Real)
returns MakeCylinder from BRepPrimAPI
---Purpose: Make a cylinder of radius R and length H.
---Level: Public
raises
DomainError from Standard; -- if R or H <= Precision::Confusion()
Create(Axes : Ax2 from gp; R, H, Angle : Real)
returns MakeCylinder from BRepPrimAPI
---Purpose: Make a cylinder of radius R and length H with
-- angle H.
---Level: Public
raises
DomainError from Standard; -- if R or H <= Precision::Confusion()
---Purpose: Constructs
-- - a cylinder of radius R and height H, or
-- - a portion of cylinder of radius R and height H, and of
-- the angle Angle defining the missing portion of the cylinder.
-- The cylinder is constructed about the "Z Axis" of either:
-- - the global coordinate system, or
-- - the local coordinate system Axes.
-- It is limited in this coordinate system as follows:
-- - in the v parametric direction (the Z axis), by the two
-- parameter values 0 and H,
-- - and in the u parametric direction (the rotation angle
-- around the Z Axis), in the case of a portion of a
-- cylinder, by the two parameter values 0 and Angle.
-- Angle is given in radians.
-- The resulting shape is composed of:
-- - a lateral cylindrical face,
-- - two planar faces in the planes z = 0 and z = H
-- (in the case of a complete cylinder, these faces are circles), and
-- - in case of a portion of a cylinder, two additional
-- planar faces to close the shape.(two rectangles in the
-- planes u = 0 and u = Angle).
-- Exceptions Standard_DomainError if:
-- - R is less than or equal to Precision::Confusion(), or
-- - H is less than or equal to Precision::Confusion().
OneAxis(me : in out) returns Address;
---Purpose: Returns the algorithm.
---Level: Advanced
Cylinder(me : in out) returns Cylinder from BRepPrim
---Purpose: Returns the algorithm.
--
---C++: return &
---Level: Public
is static;
fields
myCylinder : Cylinder from BRepPrim;
end MakeCylinder;

View File

@@ -0,0 +1,118 @@
// File: BRepPrimAPI_MakeCylinder.cxx
// Created: Fri Jul 23 15:51:45 1993
// Author: Remi LEQUETTE
// <rle@nonox>
#include <BRepPrimAPI_MakeCylinder.ixx>
#include <BRepBuilderAPI.hxx>
#include <gp.hxx>
#include <gp_Dir.hxx>
#include <gp_Ax2.hxx>
//-- lbr le 13 decembre 95
static gp_Ax2 CylinderComputeAxes() {
static Standard_Integer firsttime=1;
static Standard_Integer modif=0;
static Standard_Real cosa=cos(0.1);
static Standard_Real sina=sin(0.1);
static Standard_Real ux=1.0;
static Standard_Real uy=0.0;
if(firsttime) {
modif = getenv("PRIM_CYLINDER") != NULL;
firsttime = 0;
}
if(modif) {
Standard_Real nux = cosa*ux+sina*uy;
Standard_Real nuy =-sina*ux+cosa*uy;
ux=nux; uy=nuy;
return(gp_Ax2(gp::Origin(),gp::DZ(),gp_Dir(ux,uy,0.0)));
}
else {
return(gp::XOY());
}
}
//=======================================================================
//function : BRepPrimAPI_MakeCylinder
//purpose :
//=======================================================================
BRepPrimAPI_MakeCylinder::BRepPrimAPI_MakeCylinder(const Standard_Real R,
const Standard_Real H) :
myCylinder(CylinderComputeAxes(), R , H)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeCylinder
//purpose :
//=======================================================================
BRepPrimAPI_MakeCylinder::BRepPrimAPI_MakeCylinder(const Standard_Real R,
const Standard_Real H,
const Standard_Real Angle) :
myCylinder( R , H)
{
myCylinder.Angle(Angle);
}
//=======================================================================
//function : BRepPrimAPI_MakeCylinder
//purpose :
//=======================================================================
BRepPrimAPI_MakeCylinder::BRepPrimAPI_MakeCylinder(const gp_Ax2& Axes,
const Standard_Real R,
const Standard_Real H) :
myCylinder( Axes, R , H)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeCylinder
//purpose :
//=======================================================================
BRepPrimAPI_MakeCylinder::BRepPrimAPI_MakeCylinder(const gp_Ax2& Axes,
const Standard_Real R,
const Standard_Real H,
const Standard_Real Angle) :
myCylinder( Axes, R , H)
{
myCylinder.Angle(Angle);
}
//=======================================================================
//function : OneAxis
//purpose :
//=======================================================================
Standard_Address BRepPrimAPI_MakeCylinder::OneAxis()
{
return &myCylinder;
}
//=======================================================================
//function : Cylinder
//purpose :
//=======================================================================
BRepPrim_Cylinder& BRepPrimAPI_MakeCylinder::Cylinder()
{
return myCylinder;
}

View File

@@ -0,0 +1,63 @@
-- File: BRepPrimAPI_MakeHalfSpace.cdl
-- Created: Wed Mar 08 10:07:07 1995
-- Author: Bruno DUMORTIER
-- <dub@fuegox>
---Copyright: Matra Datavision 1993
class MakeHalfSpace from BRepPrimAPI inherits MakeShape from BRepBuilderAPI
---Purpose: Describes functions to build half-spaces.
-- A half-space is an infinite solid, limited by a surface. It
-- is built from a face or a shell, which bounds it, and with
-- a reference point, which specifies the side of the
-- surface where the matter of the half-space is located.
-- A half-space is a tool commonly used in topological
-- operations to cut another shape.
-- A MakeHalfSpace object provides a framework for:
-- - defining and implementing the construction of a half-space, and
-- - consulting the result.
uses
Shape from TopoDS,
Vertex from TopoDS,
Face from TopoDS,
Shell from TopoDS,
Solid from TopoDS,
Pnt from gp,
MakeShape from BRepBuilderAPI
raises
NotDone from StdFail
is
Create(Face : Face from TopoDS;
RefPnt : Pnt from gp)
returns MakeHalfSpace from BRepPrimAPI;
---Purpose: Make a HalfSpace defined with a Face and a Point.
---Level: Public
Create(Shell : Shell from TopoDS;
RefPnt : Pnt from gp)
returns MakeHalfSpace from BRepPrimAPI;
---Purpose: Make a HalfSpace defined with a Shell and a Point.
---Level: Public
----------------------------------------------
-- Results
----------------------------------------------
Solid(me) returns Solid from TopoDS
---Purpose: Returns the constructed half-space as a solid.
---C++: return const &
---C++: alias "Standard_EXPORT operator TopoDS_Solid() const;"
raises
NotDone from StdFail
is static;
fields
mySolid : Solid from TopoDS;
end MakeHalfSpace;

View File

@@ -0,0 +1,207 @@
// File: BRepPrimAPI_MakeHalfSpace.cxx
// Created: Wed Mar 8 13:47:15 1995
// Author: Bruno DUMORTIER
// <dub@fuegox>
#include <BRepPrimAPI_MakeHalfSpace.ixx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepExtrema_ExtPF.hxx>
#include <BRepLProp_SLProps.hxx>
#include <gp.hxx>
#include <gp_Dir.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <BRep_Tool.hxx>
//=======================================================================
//function : FindExtrema
//purpose : This finction is called to find the nearest normal projection
// of a point <aPnt> on a face <aFace>.
// 1) return true if extrema are found.
// 2) Set in:
// - Dist : The lower distance found.
// - anOppositePnt : The corresponding point laying on the face
// - U,V : The parameters of <anOppositePnt> on the face <aFace>
//=======================================================================
static Standard_Real FindExtrema(const gp_Pnt& aPnt,
const TopoDS_Face& aFace,
Standard_Real& Dist,
gp_Pnt& anOppositePnt,
Standard_Real& U,
Standard_Real& V)
{
Standard_Integer intvalue=0;
Dist = RealLast();
TopoDS_Vertex RefVertex = BRepBuilderAPI_MakeVertex(aPnt);
BRepExtrema_ExtPF ext(RefVertex,aFace);
if (ext.IsDone() && ext.NbExt() > 0) {
// the point projection exist
Standard_Integer nbext = ext.NbExt();
for (Standard_Integer iext = 1; iext <= nbext; iext++) {
if (ext.SquareDistance(iext) < Dist) {
Dist = ext.SquareDistance(iext);
intvalue = iext;
}
}
Dist = sqrt(Dist);
} else {
// compute the min distance with the face vertices
TopExp_Explorer explo(aFace, TopAbs_VERTEX);
for(; explo.More(); explo.Next()) {
const TopoDS_Vertex& vertex = TopoDS::Vertex(explo.Current());
gp_Pnt2d param = BRep_Tool::Parameters(vertex, aFace);
gp_Pnt Pnt = BRep_Tool::Pnt(vertex);
Standard_Real d2 = Pnt.SquareDistance(aPnt);
if(d2 < Dist) {
Dist = d2;
anOppositePnt = Pnt;
param.Coord(U, V);
}
}
Dist = sqrt(Dist);
return Standard_True;
}
// Final result.
anOppositePnt = ext.Point(intvalue);
ext.Parameter(intvalue,U,V);
return Standard_True;
}
//=======================================================================
//function : BRepPrimAPI_MakeHalfSpace
//purpose :
//=======================================================================
BRepPrimAPI_MakeHalfSpace::BRepPrimAPI_MakeHalfSpace(const TopoDS_Face& Face,
const gp_Pnt& RefPnt)
{
// Set the flag is <IsDone> to False.
NotDone();
TopoDS_Shell Shell;
// gp_Pnt CurPnt, MinPnt;
gp_Pnt MinPnt;
Standard_Real U, V;
Standard_Real MinDist;
if (FindExtrema(RefPnt,Face,MinDist,MinPnt,U,V)) {
BRep_Builder myBuilder;
myBuilder.MakeShell(Shell);
myBuilder.Add(Shell,Face);
// Normale, produit scalaire et sens.
Standard_Real Prec = gp::Resolution();
// BRepLProp_SLProps Props(BRepAdaptor_Surface(Face),U,V,2,Prec);
BRepLProp_SLProps Props = BRepLProp_SLProps(BRepAdaptor_Surface(Face),U,V,2,Prec);
gp_Dir Normale = Props.Normal();
gp_Dir OppRef(RefPnt.XYZ()-MinPnt.XYZ());
Standard_Real Sca = Normale*OppRef;
// Construction du solide ouvert.
myBuilder.MakeSolid(mySolid);
if (Sca > 0.) {
// Directions identiques: cas inverse.
Shell.Reverse();
}
myBuilder.Add(mySolid,Shell);
Done();
}
}
//=======================================================================
//function : BRepPrimAPI_MakeHalfSpace
//purpose :
//=======================================================================
BRepPrimAPI_MakeHalfSpace::BRepPrimAPI_MakeHalfSpace(const TopoDS_Shell& Shell,
const gp_Pnt& RefPnt)
{
// Set the flag is <IsDone> to False.
NotDone();
gp_Pnt CurPnt, MinPnt;
TopoDS_Face CurFace, MinFace;
Standard_Real MinDist = RealLast();
Standard_Real CurDist, U, V, MinU=0, MinV=0;
// Chercher le point de la peau le plus proche du point de reference.
Standard_Boolean YaExt = Standard_False;
TopoDS_Shell aShell = Shell;
TopExp_Explorer Exp(aShell,TopAbs_FACE);
while (Exp.More()) {
CurFace = TopoDS::Face(Exp.Current());
if ( FindExtrema(RefPnt,CurFace,CurDist,CurPnt,U,V)) {
YaExt = Standard_True;
if (CurDist < MinDist) {
MinDist = CurDist;
MinPnt = CurPnt;
MinU = U;
MinV = V;
MinFace = CurFace;
}
}
Exp.Next();
}
if ( YaExt) {
// Normale, produit scalaire et sens.
BRep_Builder myBuilder;
Standard_Real Prec = gp::Resolution();
// BRepLProp_SLProps Props(BRepAdaptor_Surface(MinFace),MinU,MinV,2,Prec);
BRepLProp_SLProps Props = BRepLProp_SLProps(BRepAdaptor_Surface(MinFace),MinU,MinV,2,Prec);
gp_Dir Normale = Props.Normal();
gp_Dir OppRef(RefPnt.XYZ()-MinPnt.XYZ());
Standard_Real Sca = Normale*OppRef;
// Construction du solide ouvert.
myBuilder.MakeSolid(mySolid);
if (Sca > 0.) {
// Directions identiques: cas inverse.
aShell.Reverse();
}
myBuilder.Add(mySolid,aShell);
Done();
}
}
//=======================================================================
//function : Solid
//purpose :
//=======================================================================
const TopoDS_Solid& BRepPrimAPI_MakeHalfSpace::Solid() const
{
StdFail_NotDone_Raise_if( !IsDone(), "BRepPrimAPI_MakeHalfSpace::Solid");
return mySolid;
}
//=======================================================================
//function : TopoDS_Solid
//purpose :
//=======================================================================
BRepPrimAPI_MakeHalfSpace::operator TopoDS_Solid() const
{
return Solid();
}

View File

@@ -0,0 +1,58 @@
-- File: BRepPrimAPI_MakeOneAxis.cdl
-- Created: Thu Jul 22 15:13:07 1993
-- Author: Remi LEQUETTE
-- <rle@nonox>
---Copyright: Matra Datavision 1993
deferred class MakeOneAxis from BRepPrimAPI inherits MakeShape from BRepBuilderAPI
---Purpose: The abstract class MakeOneAxis is the root class of
-- algorithms used to construct rotational primitives.
uses
Address from Standard,
Face from TopoDS,
Shell from TopoDS,
Solid from TopoDS
raises
NotDone from StdFail
is
OneAxis(me : in out) returns Address from Standard
---Purpose: The inherited commands should provide the algorithm.
-- Returned as a pointer.
---Level: Public
is deferred;
Build(me : in out)
---Purpose: Stores the solid in myShape.
---Level: Public
is redefined;
Face(me : in out)
---Purpose: Returns the lateral face of the rotational primitive.
--
---C++: return const &
---C++: alias "Standard_EXPORT operator TopoDS_Face();"
---Level: Public
returns Face from TopoDS
is static;
Shell(me : in out)
---Purpose: Returns the constructed rotational primitive as a shell.
---C++: return const &
---C++: alias "Standard_EXPORT operator TopoDS_Shell();"
returns Shell from TopoDS
is static;
Solid(me : in out)
---Purpose: Returns the constructed rotational primitive as a solid.
---C++: return const &
---C++: alias "Standard_EXPORT operator TopoDS_Solid();"
returns Solid from TopoDS
is static;
end MakeOneAxis;

View File

@@ -0,0 +1,92 @@
// File: BRepPrimAPI_MakeOneAxis.cxx
// Created: Fri Jul 23 15:51:49 1993
// Author: Remi LEQUETTE
// <rle@nonox>
#include <BRepPrimAPI_MakeOneAxis.ixx>
#include <BRepBuilderAPI.hxx>
#include <BRepPrim_OneAxis.hxx>
#include <TopoDS.hxx>
//=======================================================================
//function : Face
//purpose :
//=======================================================================
const TopoDS_Face& BRepPrimAPI_MakeOneAxis::Face()
{
Build();
return ((BRepPrim_OneAxis*) OneAxis())->LateralFace();
}
//=======================================================================
//function : Shell
//purpose :
//=======================================================================
const TopoDS_Shell& BRepPrimAPI_MakeOneAxis::Shell()
{
Build();
return ((BRepPrim_OneAxis*) OneAxis())->Shell();
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepPrimAPI_MakeOneAxis::Build()
{
BRep_Builder B;
B.MakeSolid(TopoDS::Solid(myShape));
B.Add(myShape,((BRepPrim_OneAxis*) OneAxis())->Shell());
myShape.Closed(Standard_True);
Done();
}
//=======================================================================
//function : Solid
//purpose :
//=======================================================================
const TopoDS_Solid& BRepPrimAPI_MakeOneAxis::Solid()
{
Build();
return TopoDS::Solid(myShape);
}
//=======================================================================
//function : operator
//purpose :
//=======================================================================
BRepPrimAPI_MakeOneAxis::operator TopoDS_Face()
{
return Face();
}
//=======================================================================
//function : operator
//purpose :
//=======================================================================
BRepPrimAPI_MakeOneAxis::operator TopoDS_Shell()
{
return Shell();
}
//=======================================================================
//function : operator
//purpose :
//=======================================================================
BRepPrimAPI_MakeOneAxis::operator TopoDS_Solid()
{
return Solid();
}

View File

@@ -0,0 +1,128 @@
-- File: BRepPrimAPI_MakePrism.cdl
-- Created: Tue Oct 12 11:26:48 1993
-- Author: Remi LEQUETTE
-- <rle@phylox>
---Copyright: Matra Datavision 1993
-- Modified by skv - Fri Mar 4 15:50:09 2005
-- Add methods for supporting history.
class MakePrism from BRepPrimAPI inherits MakeSweep from BRepPrimAPI
---Purpose: Describes functions to build linear swept topologies, called prisms.
-- A prism is defined by:
-- - a basis shape, which is swept, and
-- - a sweeping direction, which is:
-- - a vector for finite prisms, or
-- - a direction for infinite or semi-infinite prisms.
-- The basis shape must not contain any solids.
-- The profile generates objects according to the following rules:
-- - Vertices generate Edges
-- - Edges generate Faces.
-- - Wires generate Shells.
-- - Faces generate Solids.
-- - Shells generate Composite Solids
-- A MakePrism object provides a framework for:
-- - defining the construction of a prism,
-- - implementing the construction algorithm, and
-- - consulting the result.
uses
Prism from BRepSweep,
Shape from TopoDS,
ListOfShape from TopTools,
Edge from TopoDS,
Vec from gp,
Dir from gp
is
Create (S : Shape from TopoDS;
V : Vec from gp;
Copy : Boolean from Standard = Standard_False;
Canonize: Boolean from Standard = Standard_True)
---Purpose: Builds the prism of base S and vector V. If C is true,
-- S is copied. If Canonize is true then generated surfaces
-- are attempted to be canonized in simple types
---Level: Public
returns MakePrism from BRepPrimAPI;
Create (S : Shape from TopoDS;
D : Dir from gp;
Inf : Boolean from Standard = Standard_True;
Copy : Boolean from Standard = Standard_False;
Canonize : Boolean from Standard = Standard_True)
---Purpose: Builds a semi-infinite or an infinite prism of base S.
-- If Inf is true the prism is infinite, if Inf is false
-- the prism is semi-infinite (in the direction D). If C
-- is true S is copied (for semi-infinite prisms).
-- If Canonize is true then generated surfaces
-- are attempted to be canonized in simple types
---Level: Public
returns MakePrism from BRepPrimAPI;
Prism(me) returns Prism from BRepSweep
---Purpose: Returns the internal sweeping algorithm.
--
---C++: return const &
---Level: Advanced
is static;
Build(me : in out)
---Purpose: Builds the resulting shape (redefined from MakeShape).
---Level: Public
is redefined;
FirstShape (me : in out)
---Purpose: Returns the TopoDS Shape of the bottom of the prism.
returns Shape from TopoDS;
LastShape (me : in out)
---Purpose: Returns the TopoDS Shape of the top of the prism.
-- In the case of a finite prism, FirstShape returns the
-- basis of the prism, in other words, S if Copy is false;
-- otherwise, the copy of S belonging to the prism.
-- LastShape returns the copy of S translated by V at the
-- time of construction.
returns Shape from TopoDS;
Generated (me: in out; S : Shape from TopoDS)
---Purpose: Returns ListOfShape from TopTools.
---C++: return const &
returns ListOfShape from TopTools
is redefined;
-- Modified by skv - Fri Mar 4 15:50:09 2005 Begin
-- Add methods for supporting history.
FirstShape (me : in out; theShape : Shape from TopoDS)
---Purpose: Returns the TopoDS Shape of the bottom of the prism.
-- generated with theShape (subShape of the generating shape).
returns Shape from TopoDS
is static;
LastShape (me : in out; theShape : Shape from TopoDS)
---Purpose: Returns the TopoDS Shape of the top of the prism.
-- generated with theShape (subShape of the generating shape).
returns Shape from TopoDS
is static;
-- Modified by skv - Fri Mar 4 15:50:09 2005 End
fields
myPrism : Prism from BRepSweep;
end MakePrism;

View File

@@ -0,0 +1,135 @@
// File: BRepPrimAPI_MakePrism.cxx
// Created: Thu Oct 14 14:45:45 1993
// Author: Remi LEQUETTE
// <rle@phylox>
// Modified by skv - Fri Mar 4 15:50:09 2005
// Add methods for supporting history.
#include <BRepPrimAPI_MakePrism.ixx>
#include <BRepLib.hxx>
// perform checks on the argument
static const TopoDS_Shape& check(const TopoDS_Shape& S)
{
BRepLib::BuildCurves3d(S);
return S;
}
//=======================================================================
//function : BRepPrimAPI_MakePrism
//purpose :
//=======================================================================
BRepPrimAPI_MakePrism::BRepPrimAPI_MakePrism(const TopoDS_Shape& S,
const gp_Vec& V,
const Standard_Boolean Copy,
const Standard_Boolean Canonize) :
myPrism(check(S),V,Copy,Canonize)
{
Build();
}
//=======================================================================
//function : BRepPrimAPI_MakePrism
//purpose :
//=======================================================================
BRepPrimAPI_MakePrism::BRepPrimAPI_MakePrism(const TopoDS_Shape& S,
const gp_Dir& D,
const Standard_Boolean Inf,
const Standard_Boolean Copy,
const Standard_Boolean Canonize) :
myPrism(check(S),D,Inf,Copy,Canonize)
{
Build();
}
//=======================================================================
//function : Prism
//purpose :
//=======================================================================
const BRepSweep_Prism& BRepPrimAPI_MakePrism::Prism()const
{
return myPrism;
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepPrimAPI_MakePrism::Build()
{
myShape = myPrism.Shape();
Done();
}
//=======================================================================
//function : FirstShape
//purpose :
//=======================================================================
TopoDS_Shape BRepPrimAPI_MakePrism::FirstShape()
{
return myPrism.FirstShape();
}
//=======================================================================
//function : LastShape
//purpose :
//=======================================================================
TopoDS_Shape BRepPrimAPI_MakePrism::LastShape()
{
return myPrism.LastShape();
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepPrimAPI_MakePrism::Generated (const TopoDS_Shape& S)
{
myGenerated.Clear();
myGenerated.Append(myPrism.Shape (S));
return myGenerated;
}
// Modified by skv - Fri Mar 4 15:50:09 2005 Begin
//=======================================================================
//function : FirstShape
//purpose : This method returns the bottom shape of the prism, generated
// with theShape (subShape of the generating shape)
//=======================================================================
TopoDS_Shape BRepPrimAPI_MakePrism::FirstShape(const TopoDS_Shape &theShape)
{
return myPrism.FirstShape(theShape);
}
//=======================================================================
//function : LastShape
//purpose : This method returns the top shape of the prism, generated
// with theShape (subShape of the generating shape)
//=======================================================================
TopoDS_Shape BRepPrimAPI_MakePrism::LastShape(const TopoDS_Shape &theShape)
{
return myPrism.LastShape(theShape);
}
// Modified by skv - Fri Mar 4 15:50:09 2005 End

View File

@@ -0,0 +1,145 @@
-- File: BRepPrimAPI_MakeRevol.cdl
-- Created: Tue Oct 12 11:45:39 1993
-- Author: Remi LEQUETTE
-- <rle@phylox>
---Copyright: Matra Datavision 1993
-- Modified by skv - Fri Mar 4 15:50:09 2005
-- Add methods for supporting history.
class MakeRevol from BRepPrimAPI inherits MakeSweep from BRepPrimAPI
---Purpose: Class to make revolved sweep topologies.
--
-- a revolved sweep is defined by :
--
-- * A basis topology which is swept.
--
-- The basis topology must not contain solids
-- (neither composite solids.).
--
-- The basis topology may be copied or shared in
-- the result.
--
-- * A rotation axis and angle :
--
-- - The axis is an Ax1 from gp.
--
-- - The angle is in [0, 2*Pi].
--
-- - The angle default value is 2*Pi.
--
--
-- The result is a topology with a higher dimension :
--
-- - Vertex -> Edge.
-- - Edge -> Face.
-- - Wire -> Shell.
-- - Face -> Solid.
-- - Shell -> CompSolid.
--
-- Sweeping a Compound sweeps the elements of the
-- compound and creates a compound with the
-- results.
--
uses
Revol from BRepSweep,
Shape from TopoDS,
ListOfShape from TopTools,
Edge from TopoDS,
Ax1 from gp
is
Create (S : Shape from TopoDS;
A : Ax1 from gp;
D : Real from Standard;
Copy : Boolean from Standard = Standard_False)
---Purpose: Builds the Revol of base S, axis A and angle D. If C
-- is true, S is copied.
---Level: Public
returns MakeRevol from BRepPrimAPI;
Create (S : Shape from TopoDS;
A : Ax1 from gp;
Copy : Boolean from Standard = Standard_False)
---Purpose: Builds the Revol of base S, axis A and angle 2*Pi. If
-- C is true, S is copied.
---Level: Public
returns MakeRevol from BRepPrimAPI;
Revol(me) returns Revol from BRepSweep
---Purpose: Returns the internal sweeping algorithm.
--
---C++: return const &
---Level: Public
is static;
Build(me : in out)
is redefined;
---Purpose: Builds the resulting shape (redefined from MakeShape).
---Level: Public
FirstShape (me : in out)
---Purpose: Returns the first shape of the revol (coinciding with
-- the generating shape).
returns Shape from TopoDS;
LastShape (me : in out)
---Purpose: Returns the TopoDS Shape of the end of the revol.
returns Shape from TopoDS;
Generated (me: in out; S : Shape from TopoDS)
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is redefined;
-- Modified by skv - Fri Mar 4 15:50:09 2005 Begin
-- Add methods for supporting history.
FirstShape (me : in out; theShape : Shape from TopoDS)
---Purpose: Returns the TopoDS Shape of the beginning of the revolution,
-- generated with theShape (subShape of the generating shape).
returns Shape from TopoDS
is static;
LastShape (me : in out; theShape : Shape from TopoDS)
---Purpose: Returns the TopoDS Shape of the end of the revolution,
-- generated with theShape (subShape of the generating shape).
returns Shape from TopoDS
is static;
HasDegenerated(me)
---Purpose: Check if there are degenerated edges in the result.
---Level: Public
returns Boolean from Standard
is static;
Degenerated(me)
---C++: return const &
---Level: Public
returns ListOfShape from TopTools
is static;
-- Modified by skv - Fri Mar 4 15:50:09 2005 End
fields
myRevol : Revol from BRepSweep;
myDegenerated: ListOfShape from TopTools; -- skv
end MakeRevol;

View File

@@ -0,0 +1,169 @@
// File: BRepPrimAPI_MakeRevol.cxx
// Created: Thu Oct 14 14:46:16 1993
// Author: Remi LEQUETTE
// <rle@phylox>
// Modified by skv - Fri Mar 4 15:50:09 2005
// Add methods for supporting history.
#include <BRepPrimAPI_MakeRevol.ixx>
#include <BRepLib.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_TEdge.hxx>
// perform checks on the argument
static const TopoDS_Shape& check(const TopoDS_Shape& S)
{
BRepLib::BuildCurves3d(S);
return S;
}
//=======================================================================
//function : BRepPrimAPI_MakeRevol
//purpose :
//=======================================================================
BRepPrimAPI_MakeRevol::BRepPrimAPI_MakeRevol(const TopoDS_Shape& S,
const gp_Ax1& A,
const Standard_Real D,
const Standard_Boolean Copy) :
myRevol(check(S),A,D,Copy)
{
Build();
}
//=======================================================================
//function : BRepPrimAPI_MakeRevol
//purpose :
//=======================================================================
BRepPrimAPI_MakeRevol::BRepPrimAPI_MakeRevol(const TopoDS_Shape& S,
const gp_Ax1& A,
const Standard_Boolean Copy) :
myRevol(check(S),A,Copy)
{
Build();
}
//=======================================================================
//function : Revol
//purpose :
//=======================================================================
const BRepSweep_Revol& BRepPrimAPI_MakeRevol::Revol() const
{
return myRevol;
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepPrimAPI_MakeRevol::Build()
{
myShape = myRevol.Shape();
Done();
// Modified by skv - Fri Mar 4 15:50:09 2005 Begin
myDegenerated.Clear();
TopExp_Explorer anExp(myShape, TopAbs_EDGE);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Shape &anEdge = anExp.Current();
Handle(BRep_TEdge) aTEdge = Handle(BRep_TEdge)::DownCast(anEdge.TShape());
if (aTEdge->Degenerated())
myDegenerated.Append(anEdge);
}
// Modified by skv - Fri Mar 4 15:50:09 2005 End
}
//=======================================================================
//function : FirstShape
//purpose :
//=======================================================================
TopoDS_Shape BRepPrimAPI_MakeRevol::FirstShape()
{
return myRevol.FirstShape();
}
//=======================================================================
//function : LastShape
//purpose :
//=======================================================================
TopoDS_Shape BRepPrimAPI_MakeRevol::LastShape()
{
return myRevol.LastShape();
}
//=======================================================================
//function : Generated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepPrimAPI_MakeRevol::Generated (const TopoDS_Shape& S)
{
myGenerated.Clear();
if (!myRevol.Shape (S).IsNull())
myGenerated.Append (myRevol.Shape (S));
return myGenerated;
}
// Modified by skv - Fri Mar 4 15:50:09 2005 Begin
//=======================================================================
//function : FirstShape
//purpose : This method returns the shape of the beginning of the revolution,
// generated with theShape (subShape of the generating shape).
//=======================================================================
TopoDS_Shape BRepPrimAPI_MakeRevol::FirstShape(const TopoDS_Shape &theShape)
{
return myRevol.FirstShape(theShape);
}
//=======================================================================
//function : LastShape
//purpose : This method returns the shape of the end of the revolution,
// generated with theShape (subShape of the generating shape).
//=======================================================================
TopoDS_Shape BRepPrimAPI_MakeRevol::LastShape(const TopoDS_Shape &theShape)
{
return myRevol.LastShape(theShape);
}
//=======================================================================
//function : HasDegenerated
//purpose :
//=======================================================================
Standard_Boolean BRepPrimAPI_MakeRevol::HasDegenerated () const
{
return (!myDegenerated.IsEmpty());
}
//=======================================================================
//function : Degenerated
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepPrimAPI_MakeRevol::Degenerated () const
{
return myDegenerated;
}
// Modified by skv - Fri Mar 4 15:50:09 2005 End

View File

@@ -0,0 +1,106 @@
-- File: BRepPrimAPI_MakeRevolution.cdl
-- Created: Thu Jul 22 11:25:59 1993
-- Author: Remi LEQUETTE
-- <rle@nonox>
---Copyright: Matra Datavision 1993
class MakeRevolution from BRepPrimAPI inherits MakeOneAxis from BRepPrimAPI
---Purpose: Describes functions to build revolved shapes.
-- A MakeRevolution object provides a framework for:
-- - defining the construction of a revolved shape,
-- - implementing the construction algorithm, and
-- - consulting the result.
uses
Ax2 from gp,
Curve from Geom,
OneAxis from BRepPrim,
Revolution from BRepPrim
raises
DomainError from Standard
is
Create(Meridian : Curve from Geom)
returns MakeRevolution from BRepPrimAPI
---Purpose: Make a revolution body by rotating a curve around Z.
---Level: Public
raises
DomainError from Standard; -- if M is not in a plane containing Z.
Create(Meridian : Curve from Geom; angle : Real)
returns MakeRevolution from BRepPrimAPI
---Purpose: Make a revolution body by rotating a curve around Z.
---Level: Public
raises
DomainError from Standard; -- if M is not in a plane containing Z.
Create(Meridian : Curve from Geom; VMin, VMax : Real)
returns MakeRevolution from BRepPrimAPI
---Purpose: Make a revolution body by rotating a curve around Z.
---Level: Public
raises
DomainError from Standard; -- if M is not in a plane containing Z.
Create(Meridian : Curve from Geom; VMin, VMax, angle : Real)
returns MakeRevolution from BRepPrimAPI
---Purpose: Make a revolution body by rotating a curve around Z.
---Level: Public
raises
DomainError from Standard; -- if M is not in a plane containing Z.
Create(Axes : Ax2 from gp; Meridian : Curve from Geom)
returns MakeRevolution from BRepPrimAPI
---Purpose: Make a revolution body by rotating a curve around Z.
---Level: Public
raises
DomainError from Standard; -- if M is not in a plane containing Z.
Create(Axes : Ax2 from gp; Meridian : Curve from Geom; angle : Real)
returns MakeRevolution from BRepPrimAPI
---Purpose: Make a revolution body by rotating a curve around Z.
---Level: Public
raises
DomainError from Standard; -- if M is not in a plane containing Z.
Create(Axes : Ax2 from gp; Meridian : Curve from Geom; VMin, VMax : Real)
returns MakeRevolution from BRepPrimAPI
---Purpose: Make a revolution body by rotating a curve around Z.
---Level: Public
raises
DomainError from Standard; -- if M is not in a plane containing Z.
Create(Axes : Ax2 from gp; Meridian : Curve from Geom; VMin, VMax, angle : Real)
returns MakeRevolution from BRepPrimAPI
---Purpose: Make a revolution body by rotating a curve around Z.
---Level: Public
raises
DomainError from Standard; -- if M is not in a plane containing Z.
---Purpose: For all algorithms the resulting shape is composed of
-- - a lateral revolved face,
-- - two planar faces in planes parallel to the plane z =
-- 0, and passing by the extremities of the revolved
-- portion of Meridian, if these points are not on the Z
-- axis (in case of a complete revolved shape, these faces are circles),
-- - and in the case of a portion of a revolved shape, two
-- planar faces to close the shape (in the planes u = 0 and u = angle).
OneAxis(me : in out) returns Address;
---Purpose: Returns the algorithm.
---Level: Advanced
Revolution(me : in out) returns Revolution from BRepPrim
---Purpose: Returns the algorithm.
--
---C++: return &
---Level: Public
is static;
fields
myRevolution : Revolution from BRepPrim;
end MakeRevolution;

View File

@@ -0,0 +1,200 @@
// File: BRepPrimAPI_MakeRevolution.cxx
// Created: Fri Jul 23 15:51:50 1993
// Author: Remi LEQUETTE
// <rle@nonox>
#include <BRepPrimAPI_MakeRevolution.ixx>
#include <BRepBuilderAPI.hxx>
#include <GeomProjLib.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Plane.hxx>
//=======================================================================
//function : Project
//purpose :
//=======================================================================
static Handle(Geom2d_Curve) Project(const Handle(Geom_Curve)& M,
const gp_Ax3 Axis)
{
Handle(Geom2d_Curve) C;
C = GeomProjLib::Curve2d(M,new Geom_Plane(Axis));
return C;
}
static Handle(Geom2d_Curve) Project(const Handle(Geom_Curve)& M)
{
return Project(M,gp_Ax2(gp::Origin(),-gp::DY(),gp::DX()));
}
//=======================================================================
//function : BRepPrimAPI_MakeRevolution
//purpose :
//=======================================================================
BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
(const Handle(Geom_Curve)& Meridian) :
myRevolution(gp::XOY(),
Meridian->FirstParameter(),
Meridian->LastParameter(),
Meridian,
Project(Meridian))
{
}
//=======================================================================
//function : BRepPrimAPI_MakeRevolution
//purpose :
//=======================================================================
BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
(const Handle(Geom_Curve)& Meridian,
const Standard_Real angle) :
myRevolution(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0,0,1),gp_Dir(1,0,0)),
Meridian->FirstParameter(),
Meridian->LastParameter(),
Meridian,
Project(Meridian))
{
myRevolution.Angle(angle);
}
//=======================================================================
//function : BRepPrimAPI_MakeRevolution
//purpose :
//=======================================================================
BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
(const Handle(Geom_Curve)& Meridian,
const Standard_Real VMin,
const Standard_Real VMax) :
myRevolution(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0,0,1),gp_Dir(1,0,0)),
VMin,
VMax,
Meridian,
Project(Meridian))
{
}
//=======================================================================
//function : BRepPrimAPI_MakeRevolution
//purpose :
//=======================================================================
BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
(const Handle(Geom_Curve)& Meridian,
const Standard_Real VMin,
const Standard_Real VMax,
const Standard_Real angle) :
myRevolution(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0,0,1),gp_Dir(1,0,0)),
VMin,
VMax,
Meridian,
Project(Meridian))
{
myRevolution.Angle(angle);
}
//=======================================================================
//function : BRepPrimAPI_MakeRevolution
//purpose :
//=======================================================================
BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
(const gp_Ax2& Axes,
const Handle(Geom_Curve)& Meridian) :
myRevolution(Axes,
Meridian->FirstParameter(),
Meridian->LastParameter(),
Meridian,
Project(Meridian))
{
}
//=======================================================================
//function : BRepPrimAPI_MakeRevolution
//purpose :
//=======================================================================
BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
(const gp_Ax2& Axes,
const Handle(Geom_Curve)& Meridian,
const Standard_Real angle) :
myRevolution(Axes,
Meridian->FirstParameter(),
Meridian->LastParameter(),
Meridian,
Project(Meridian))
{
myRevolution.Angle(angle);
}
//=======================================================================
//function : BRepPrimAPI_MakeRevolution
//purpose :
//=======================================================================
BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
(const gp_Ax2& Axes,
const Handle(Geom_Curve)& Meridian,
const Standard_Real VMin,
const Standard_Real VMax) :
myRevolution(Axes,
VMin,
VMax,
Meridian,
Project(Meridian))
{
}
//=======================================================================
//function : BRepPrimAPI_MakeRevolution
//purpose :
//=======================================================================
BRepPrimAPI_MakeRevolution::BRepPrimAPI_MakeRevolution
(const gp_Ax2& Axes,
const Handle(Geom_Curve)& Meridian,
const Standard_Real VMin,
const Standard_Real VMax,
const Standard_Real angle) :
myRevolution(Axes,
VMin,
VMax,
Meridian,
Project(Meridian))
{
myRevolution.Angle(angle);
}
//=======================================================================
//function : OneAxis
//purpose :
//=======================================================================
Standard_Address BRepPrimAPI_MakeRevolution::OneAxis()
{
return &myRevolution;
}
//=======================================================================
//function : Revolution
//purpose :
//=======================================================================
BRepPrim_Revolution& BRepPrimAPI_MakeRevolution::Revolution()
{
return myRevolution;
}

View File

@@ -0,0 +1,137 @@
-- File: BRepPrimAPI_MakeSphere.cdl
-- Created: Thu Jul 22 19:23:53 1993
-- Author: Remi LEQUETTE
-- <rle@nonox>
---Copyright: Matra Datavision 1993
class MakeSphere from BRepPrimAPI inherits MakeOneAxis from BRepPrimAPI
---Purpose: Describes functions to build spheres or portions of spheres.
-- A MakeSphere object provides a framework for:
-- - defining the construction of a sphere,
-- - implementing the construction algorithm, and
-- - consulting the result.
uses
Pnt from gp,
Ax2 from gp,
Sphere from BRepPrim,
OneAxis from BRepPrim
raises
DomainError from Standard
is
Create(R : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(R, angle : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(R, angle1, angle2 : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(R, angle1, angle2, angle3 : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(Center : Pnt from gp; R : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(Center : Pnt from gp; R, angle : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(Center : Pnt from gp; R, angle1, angle2 : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(Center : Pnt from gp; R, angle1, angle2, angle3 : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(Axis : Ax2 from gp; R : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(Axis : Ax2 from gp; R, angle : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(Axis : Ax2 from gp; R, angle1, angle2 : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(Axis : Ax2 from gp; R, angle1, angle2, angle3 : Real)
returns MakeSphere from BRepPrimAPI
---Purpose: Make a sphere of radius R.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
---Purpose: For all algorithms The resulting shape is composed of
-- - a lateral spherical face,
-- - two planar faces parallel to the plane z = 0 if the
-- sphere is truncated in the v parametric direction, or
-- only one planar face if angle1 is equal to -p/2 or if
-- angle2 is equal to p/2 (these faces are circles in
-- case of a complete truncated sphere),
-- - and in case of a portion of sphere, two planar faces
-- to shut the shape.(in the planes u = 0 and u = angle).
OneAxis(me : in out) returns Address;
---Purpose: Returns the algorithm.
---Level: Advanced
Sphere(me : in out) returns Sphere from BRepPrim
---Purpose: Returns the algorithm.
--
---C++: return &
---Level: Public
is static;
fields
mySphere : Sphere from BRepPrim;
end MakeSphere;

View File

@@ -0,0 +1,243 @@
// File: BRepPrimAPI_MakeSphere.cxx
// Created: Fri Jul 23 15:51:53 1993
// Author: Remi LEQUETTE
// <rle@nonox>
#include <BRepPrimAPI_MakeSphere.ixx>
#include <BRepBuilderAPI.hxx>
#include <gp.hxx>
#include <gp_Dir.hxx>
#include <gp_Ax2.hxx>
//-- lbr le 13 decembre 95
static gp_Ax2 SphereComputeAxes() {
static Standard_Integer firsttime=1;
static Standard_Integer modif=0;
static Standard_Real cosa=cos(0.111);
static Standard_Real sina=sin(0.111);
static Standard_Real ux=1.0;
static Standard_Real uy=0.0;
if(firsttime) {
modif = getenv("PRIM_SPHERE") != NULL;
firsttime = 0;
}
if(modif) {
Standard_Real nux = cosa*ux+sina*uy;
Standard_Real nuy =-sina*ux+cosa*uy;
ux=nux; uy=nuy;
return(gp_Ax2(gp::Origin(),gp::DZ(),gp_Dir(ux,uy,0.0)));
}
else {
return(gp::XOY());
}
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R) :
mySphere(SphereComputeAxes(),R)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R,
const Standard_Real angle) :
mySphere(gp_Ax2(gp::Origin(), (angle<0.?-1:1)*gp::DZ(), gp::DX()),
R)
{
mySphere.Angle(Abs(angle));
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R,
const Standard_Real angle1,
const Standard_Real angle2) :
mySphere(R)
{
mySphere.VMin(angle1);
mySphere.VMax(angle2);
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const Standard_Real R,
const Standard_Real angle1,
const Standard_Real angle2,
const Standard_Real angle3) :
mySphere(R)
{
mySphere.VMin(angle1);
mySphere.VMax(angle2);
mySphere.Angle(angle3);
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center,
const Standard_Real R) :
mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)),
R)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center,
const Standard_Real R,
const Standard_Real angle) :
mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)),
R)
{
mySphere.Angle(angle);
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center,
const Standard_Real R,
const Standard_Real angle1,
const Standard_Real angle2) :
mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)),
R)
{
mySphere.VMin(angle1);
mySphere.VMax(angle2);
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Pnt& Center,
const Standard_Real R,
const Standard_Real angle1,
const Standard_Real angle2,
const Standard_Real angle3) :
mySphere(gp_Ax2(Center, gp_Dir(0,0,1), gp_Dir(1,0,0)),
R)
{
mySphere.VMin(angle1);
mySphere.VMax(angle2);
mySphere.Angle(angle3);
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis,
const Standard_Real R) :
mySphere(Axis, R)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis,
const Standard_Real R,
const Standard_Real angle) :
mySphere( Axis, R)
{
mySphere.Angle(angle);
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis,
const Standard_Real R,
const Standard_Real angle1,
const Standard_Real angle2) :
mySphere(Axis, R)
{
mySphere.VMin(angle1);
mySphere.VMax(angle2);
}
//=======================================================================
//function : BRepPrimAPI_MakeSphere
//purpose :
//=======================================================================
BRepPrimAPI_MakeSphere::BRepPrimAPI_MakeSphere(const gp_Ax2& Axis,
const Standard_Real R,
const Standard_Real angle1,
const Standard_Real angle2,
const Standard_Real angle3) :
mySphere( Axis, R)
{
mySphere.VMin(angle1);
mySphere.VMax(angle2);
mySphere.Angle(angle3);
}
//=======================================================================
//function : OneAxis
//purpose :
//=======================================================================
Standard_Address BRepPrimAPI_MakeSphere::OneAxis()
{
return &mySphere;
}
//=======================================================================
//function : Sphere
//purpose :
//=======================================================================
BRepPrim_Sphere& BRepPrimAPI_MakeSphere::Sphere()
{
return mySphere;
}

View File

@@ -0,0 +1,41 @@
-- File: BRepPrimAPI_MakeSweep.cdl
-- Created: Fri Feb 18 10:32:19 1994
-- Author: Remi LEQUETTE
-- <rle@nonox>
---Copyright: Matra Datavision 1994
deferred class MakeSweep from BRepPrimAPI inherits MakeShape from BRepBuilderAPI
---Purpose: The abstract class MakeSweep is
-- the root class of swept primitives.
-- Sweeps are objects you obtain by sweeping a profile along a path.
-- The profile can be any topology and the path is usually a curve or
-- a wire. The profile generates objects according to the following rules:
-- - Vertices generate Edges
-- - Edges generate Faces.
-- - Wires generate Shells.
-- - Faces generate Solids.
-- - Shells generate Composite Solids.
-- You are not allowed to sweep Solids and Composite Solids.
-- Two kinds of sweeps are implemented in the BRepPrimAPI package:
-- - The linear sweep called a Prism
-- - The rotational sweep called a Revol
-- Swept constructions along complex profiles such as BSpline curves
-- are also available in the BRepOffsetAPI package..
uses Shape from TopoDS
is
FirstShape (me : in out)
---Purpose: Returns the TopoDS Shape of the bottom of the sweep.
returns Shape from TopoDS
is deferred;
LastShape (me : in out)
---Purpose: Returns the TopoDS Shape of the top of the sweep.
returns Shape from TopoDS
is deferred;
end MakeSweep;

View File

@@ -0,0 +1,7 @@
// File: BRepPrimAPI_MakeSweep.cxx
// Created: Fri Feb 18 15:13:04 1994
// Author: Remi LEQUETTE
// <rle@nonox>
#include <BRepPrimAPI_MakeSweep.ixx>

View File

@@ -0,0 +1,120 @@
-- File: BRepPrimAPI_MakeTorus.cdl
-- Created: Wed Jul 21 16:07:53 1993
-- Author: Remi LEQUETTE
-- <rle@nonox>
---Copyright: Matra Datavision 1993
class MakeTorus from BRepPrimAPI inherits MakeOneAxis from BRepPrimAPI
---Purpose: Describes functions to build tori or portions of tori.
-- A MakeTorus object provides a framework for:
-- - defining the construction of a torus,
-- - implementing the construction algorithm, and
-- - consulting the result.
uses
Ax2 from gp,
Torus from BRepPrim,
OneAxis from BRepPrim
raises
DomainError from Standard
is
Create(R1, R2 : Real)
returns MakeTorus from BRepPrimAPI
---Purpose: Make a torus of radii R1 R2.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(R1, R2, angle : Real)
returns MakeTorus from BRepPrimAPI
---Purpose: Make a section of a torus of radii R1 R2.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(R1, R2, angle1,angle2 : Real)
returns MakeTorus from BRepPrimAPI
---Purpose: Make a torus of radii R2, R2 with angles on the
-- small circle.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(R1, R2, angle1,angle2,angle : Real)
returns MakeTorus from BRepPrimAPI
---Purpose: Make a torus of radii R2, R2 with angles on the
-- small circle.
---Level: Public
raises
DomainError from Standard; -- if R <= Precision::Confusion()
Create(Axes : Ax2 from gp; R1, R2 : Real)
returns MakeTorus from BRepPrimAPI
---Purpose: Make a torus of radii R1 R2.
---Level: Public
raises
DomainError from Standard; -- if H <= Precision::Confusion()
Create(Axes : Ax2 from gp; R1, R2, angle : Real)
returns MakeTorus from BRepPrimAPI
---Purpose: Make a section of a torus of radii R1 R2.
---Level: Public
raises
DomainError from Standard; -- if H <= Precision::Confusion()
Create(Axes : Ax2 from gp; R1, R2, angle1, angle2 : Real)
returns MakeTorus from BRepPrimAPI
---Purpose: Make a torus of radii R1 R2.
---Level: Public
raises
DomainError from Standard; -- if H <= Precision::Confusion()
Create(Axes : Ax2 from gp; R1, R2, angle1, angle2, angle : Real)
returns MakeTorus from BRepPrimAPI
---Purpose: Make a section of a torus of radii R1 R2.
---Level: Public
raises
DomainError from Standard; -- if H <= Precision::Confusion()
---Purpose: For all algorithms The resulting shape is composed of
-- - a lateral toroidal face,
-- - two conical faces (defined by the equation v = angle1 and
-- v = angle2) if the sphere is truncated in the v parametric
-- direction (they may be cylindrical faces in some
-- particular conditions), and in case of a portion
-- of torus, two planar faces to close the shape.(in the planes
-- u = 0 and u = angle).
-- Notes:
-- - The u parameter corresponds to a rotation angle around the Z axis.
-- - The circle whose radius is equal to the minor radius,
-- located in the plane defined by the X axis and the Z axis,
-- centered on the X axis, on its positive side, and positioned
-- at a distance from the origin equal to the major radius, is
-- the reference circle of the torus. The rotation around an
-- axis parallel to the Y axis and passing through the center
-- of the reference circle gives the v parameter on the
-- reference circle. The X axis gives the origin of the v
-- parameter. Near 0, as v increases, the Z coordinate decreases.
OneAxis(me : in out) returns Address;
---Purpose: Returns the algorithm.
---Level: Advanced
Torus(me : in out) returns Torus from BRepPrim
---Purpose: Returns the algorithm.
--
---C++: return &
---Level: Public
is static;
fields
myTorus : Torus from BRepPrim;
end MakeTorus;

View File

@@ -0,0 +1,156 @@
// File: BRepPrimAPI_MakeTorus.cxx
// Created: Fri Jul 23 15:51:54 1993
// Author: Remi LEQUETTE
// <rle@nonox>
#include <BRepPrimAPI_MakeTorus.ixx>
#include <BRepBuilderAPI.hxx>
//=======================================================================
//function : BRepPrimAPI_MakeTorus
//purpose :
//=======================================================================
BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const Standard_Real R1,
const Standard_Real R2) :
myTorus(R1, R2)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeTorus
//purpose :
//=======================================================================
BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const Standard_Real R1,
const Standard_Real R2,
const Standard_Real angle) :
myTorus(R1, R2)
{
myTorus.Angle(angle);
}
//=======================================================================
//function : BRepPrimAPI_MakeTorus
//purpose :
//=======================================================================
BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const Standard_Real R1,
const Standard_Real R2,
const Standard_Real angle1,
const Standard_Real angle2) :
myTorus( R1, R2)
{
myTorus.VMin(angle1);
myTorus.VMax(angle2);
}
//=======================================================================
//function : BRepPrimAPI_MakeTorus
//purpose :
//=======================================================================
BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const Standard_Real R1,
const Standard_Real R2,
const Standard_Real angle1,
const Standard_Real angle2,
const Standard_Real angle) :
myTorus( R1, R2)
{
myTorus.VMin(angle1);
myTorus.VMax(angle2);
myTorus.Angle(angle);
}
//=======================================================================
//function : BRepPrimAPI_MakeTorus
//purpose :
//=======================================================================
BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const gp_Ax2& Axes,
const Standard_Real R1,
const Standard_Real R2) :
myTorus(Axes, R1, R2)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeTorus
//purpose :
//=======================================================================
BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const gp_Ax2& Axes,
const Standard_Real R1,
const Standard_Real R2,
const Standard_Real angle) :
myTorus(Axes, R1, R2)
{
myTorus.Angle(angle);
}
//=======================================================================
//function : BRepPrimAPI_MakeTorus
//purpose :
//=======================================================================
BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const gp_Ax2& Axes,
const Standard_Real R1,
const Standard_Real R2,
const Standard_Real angle1,
const Standard_Real angle2) :
myTorus(Axes, R1, R2)
{
myTorus.VMin(angle1);
myTorus.VMax(angle2);
}
//=======================================================================
//function : BRepPrimAPI_MakeTorus
//purpose :
//=======================================================================
BRepPrimAPI_MakeTorus::BRepPrimAPI_MakeTorus(const gp_Ax2& Axes,
const Standard_Real R1,
const Standard_Real R2,
const Standard_Real angle1,
const Standard_Real angle2,
const Standard_Real angle) :
myTorus(Axes, R1, R2)
{
myTorus.VMin(angle1);
myTorus.VMax(angle2);
myTorus.Angle(angle);
}
//=======================================================================
//function : OneAxis
//purpose :
//=======================================================================
Standard_Address BRepPrimAPI_MakeTorus::OneAxis()
{
return &myTorus;
}
//=======================================================================
//function : Torus
//purpose :
//=======================================================================
BRepPrim_Torus& BRepPrimAPI_MakeTorus::Torus()
{
return myTorus;
}

View File

@@ -0,0 +1,102 @@
-- File: BRepPrimAPI_MakeWedge.cdl
-- Created: Thu Jul 22 12:11:57 1993
-- Author: Remi LEQUETTE
-- <rle@nonox>
---Copyright: Matra Datavision 1993
class MakeWedge from BRepPrimAPI inherits MakeShape from BRepBuilderAPI
---Purpose: Describes functions to build wedges, i.e. boxes with inclined faces.
-- A MakeWedge object provides a framework for:
-- - defining the construction of a wedge,
-- - implementing the construction algorithm, and
-- - consulting the result.
uses
Ax2 from gp,
Pnt from gp,
Shell from TopoDS,
Solid from TopoDS,
Wedge from BRepPrim
raises
DomainError from Standard,
NotDone from StdFail
is
Create( dx, dy, dz, ltx : Real)
returns MakeWedge from BRepPrimAPI
---Purpose: Make a STEP right angular wedge. (ltx >= 0)
---Level: Public
raises
DomainError from Standard; -- if dx,dy,dz <= Precision::Confusion()
Create(Axes : Ax2 from gp; dx, dy, dz, ltx : Real)
returns MakeWedge from BRepPrimAPI
---Purpose: Make a STEP right angular wedge. (ltx >= 0)
---Level: Public
raises
DomainError from Standard; -- if dx,dy,dz <= Precision::Confusion()
Create(dx,dy,dz,xmin,zmin,xmax,zmax : Real)
returns MakeWedge from BRepPrimAPI
---Purpose: Make a wedge. The face at dy is xmin,zmin xmax,zmax
---Level: Public
raises
DomainError from Standard; -- if dx,dy,dz <= Precision::Confusion()
Create(Axes : Ax2 from gp; dx,dy,dz,xmin,zmin,xmax,zmax : Real)
returns MakeWedge from BRepPrimAPI
---Purpose: Make a wedge. The face at dy is xmin,zmin xmax,zmax
---Level: Public
raises
DomainError from Standard; -- if dx,dy,dz <= Precision::Confusion()
----------------------------------------
-- Auxiliary methods
----------------------------------------
Wedge(me : in out) returns Wedge from BRepPrim
---Purpose: Returns the internal algorithm.
--
---C++: return &
---Level: Public
is static;
----------------------------------------
-- Results
----------------------------------------
Build(me : in out)
---Purpose: Stores the solid in myShape.
---Level: Public
is redefined;
Shell(me : in out) returns Shell from TopoDS
---C++: return const &
---C++: alias "Standard_EXPORT operator TopoDS_Shell();"
---Purpose: Returns the constructed box in the form of a shell.
is static;
Solid(me : in out) returns Solid from TopoDS
---C++: return const &
---C++: alias "Standard_EXPORT operator TopoDS_Solid();"
---Purpose: Returns the constructed box in the form of a solid.
is static;
fields
myWedge : Wedge from BRepPrim;
end MakeWedge;

View File

@@ -0,0 +1,147 @@
// File: BRepPrimAPI_MakeWedge.cxx
// Created: Fri Jul 23 15:51:56 1993
// Author: Remi LEQUETTE
// <rle@nonox>
#include <BRepPrimAPI_MakeWedge.ixx>
#include <TopoDS.hxx>
//=======================================================================
//function : BRepPrimAPI_MakeWedge
//purpose :
//=======================================================================
BRepPrimAPI_MakeWedge::BRepPrimAPI_MakeWedge(const Standard_Real dx,
const Standard_Real dy,
const Standard_Real dz,
const Standard_Real ltx) :
myWedge(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0,0,1),gp_Dir(1,0,0)),
dx,dy,dz,ltx)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeWedge
//purpose :
//=======================================================================
BRepPrimAPI_MakeWedge::BRepPrimAPI_MakeWedge(const gp_Ax2& Axes,
const Standard_Real dx,
const Standard_Real dy,
const Standard_Real dz,
const Standard_Real ltx) :
myWedge(Axes,
dx,dy,dz,ltx)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeWedge
//purpose :
//=======================================================================
BRepPrimAPI_MakeWedge::BRepPrimAPI_MakeWedge(const Standard_Real dx,
const Standard_Real dy,
const Standard_Real dz,
const Standard_Real xmin,
const Standard_Real zmin,
const Standard_Real xmax,
const Standard_Real zmax) :
myWedge(gp_Ax2(gp_Pnt(0,0,0),gp_Dir(0,0,1),gp_Dir(1,0,0)),
0,0,0,zmin,xmin,dx,dy,dz,zmax,xmax)
{
}
//=======================================================================
//function : BRepPrimAPI_MakeWedge
//purpose :
//=======================================================================
BRepPrimAPI_MakeWedge::BRepPrimAPI_MakeWedge(const gp_Ax2& Axes,
const Standard_Real dx,
const Standard_Real dy,
const Standard_Real dz,
const Standard_Real xmin,
const Standard_Real zmin,
const Standard_Real xmax,
const Standard_Real zmax) :
myWedge(Axes,
0,0,0,zmin,xmin,dx,dy,dz,zmax,xmax)
{
}
//=======================================================================
//function : Wedge
//purpose :
//=======================================================================
BRepPrim_Wedge& BRepPrimAPI_MakeWedge::Wedge()
{
return myWedge;
}
//=======================================================================
//function : Shell
//purpose :
//=======================================================================
const TopoDS_Shell& BRepPrimAPI_MakeWedge::Shell()
{
Build();
return myWedge.Shell();
}
//=======================================================================
//function : Build
//purpose :
//=======================================================================
void BRepPrimAPI_MakeWedge::Build()
{
BRep_Builder B;
B.MakeSolid(TopoDS::Solid(myShape));
B.Add(myShape,myWedge.Shell());
myShape.Closed(Standard_True);
Done();
}
//=======================================================================
//function : Solid
//purpose :
//=======================================================================
const TopoDS_Solid& BRepPrimAPI_MakeWedge::Solid()
{
Build();
return TopoDS::Solid(myShape);
}
//=======================================================================
//function : operator
//purpose :
//=======================================================================
BRepPrimAPI_MakeWedge::operator TopoDS_Shell()
{
return Shell();
}
//=======================================================================
//function : operator
//purpose :
//=======================================================================
BRepPrimAPI_MakeWedge::operator TopoDS_Solid()
{
return Solid();
}