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:
95
src/BRepTest/BRepTest.cdl
Executable file
95
src/BRepTest/BRepTest.cdl
Executable file
@@ -0,0 +1,95 @@
|
||||
|
||||
-- -- File: BRepTest.cdl
|
||||
-- Created: Tue Jun 25 16:20:06 1991
|
||||
-- Author: Christophe MARION
|
||||
-- <cma@phobox>
|
||||
---Copyright: Matra Datavision 1991, 1992
|
||||
|
||||
|
||||
package BRepTest
|
||||
|
||||
---Purpose: Provides commands to test BRep.
|
||||
--
|
||||
uses
|
||||
Draw,
|
||||
TCollection
|
||||
|
||||
is
|
||||
|
||||
AllCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines all the topology commands.
|
||||
|
||||
BasicCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the basic commands.
|
||||
|
||||
CurveCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to build edges and wires.
|
||||
|
||||
Fillet2DCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to perform add fillets on
|
||||
-- wires and edges.
|
||||
|
||||
SurfaceCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to build faces and shells.
|
||||
|
||||
PrimitiveCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to build primitives.
|
||||
|
||||
FillingCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to build primitives.
|
||||
|
||||
SweepCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to sweep shapes.
|
||||
|
||||
TopologyCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to perform topological
|
||||
-- operations.
|
||||
|
||||
FilletCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to perform add fillets on
|
||||
-- shells.
|
||||
|
||||
ChamferCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to perform add chamfers on
|
||||
-- shells.
|
||||
|
||||
GPropCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines commands to compute global properties.
|
||||
|
||||
MatCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines commands to compute and to explore the map of the
|
||||
-- Bisecting locus.
|
||||
|
||||
|
||||
DraftAngleCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to modify draft angles of the
|
||||
-- faces of a shape.
|
||||
|
||||
|
||||
FeatureCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to create features on a shape.
|
||||
|
||||
|
||||
OtherCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the auxiliary topology commands.
|
||||
|
||||
|
||||
ExtremaCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the extrema commands.
|
||||
|
||||
|
||||
CheckCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the checkshape command.
|
||||
|
||||
PlacementCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the placement command.
|
||||
--
|
||||
|
||||
ProjectionCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to project a wire on a shape.
|
||||
--
|
||||
ShellCommands(DI : in out Interpretor from Draw);
|
||||
---Purpose: Defines the commands to prepare shell commands.
|
||||
|
||||
end BRepTest;
|
||||
|
50
src/BRepTest/BRepTest.cxx
Executable file
50
src/BRepTest/BRepTest.cxx
Executable file
@@ -0,0 +1,50 @@
|
||||
// File: BRepTest.cxx
|
||||
// Created: Mon Jul 25 14:05:42 1994
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@bravox>
|
||||
|
||||
|
||||
#include <BRepTest.ixx>
|
||||
#include <DBRep.hxx>
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : AllCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::AllCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
BRepTest::BasicCommands(theCommands);
|
||||
BRepTest::CurveCommands(theCommands);
|
||||
BRepTest::Fillet2DCommands(theCommands);
|
||||
BRepTest::SurfaceCommands(theCommands);
|
||||
BRepTest::FillingCommands(theCommands) ;
|
||||
BRepTest::PrimitiveCommands(theCommands);
|
||||
BRepTest::SweepCommands(theCommands);
|
||||
BRepTest::TopologyCommands(theCommands);
|
||||
BRepTest::FilletCommands(theCommands);
|
||||
BRepTest::ChamferCommands(theCommands);
|
||||
BRepTest::GPropCommands(theCommands);
|
||||
BRepTest::MatCommands(theCommands);
|
||||
BRepTest::DraftAngleCommands(theCommands);
|
||||
BRepTest::FeatureCommands(theCommands);
|
||||
BRepTest::OtherCommands(theCommands);
|
||||
BRepTest::ExtremaCommands(theCommands);
|
||||
BRepTest::CheckCommands(theCommands);
|
||||
// BRepTest::PlacementCommands(theCommands) ;
|
||||
BRepTest::ProjectionCommands(theCommands) ;
|
||||
BRepTest::ShellCommands(theCommands);
|
||||
|
||||
// define the TCL variable Draw_TOPOLOGY
|
||||
const char* com = "set Draw_TOPOLOGY 1";
|
||||
theCommands.Eval(com);
|
||||
}
|
||||
|
||||
|
892
src/BRepTest/BRepTest_BasicCommands.cxx
Executable file
892
src/BRepTest/BRepTest_BasicCommands.cxx
Executable file
@@ -0,0 +1,892 @@
|
||||
// File: BRepTest_BasicCommands.cxx
|
||||
// Created: Tue Dec 13 09:48:16 1994
|
||||
// Author: Jacques GOUSSARD
|
||||
// <jag@phobox>
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
|
||||
#include <BRepTest.hxx>
|
||||
|
||||
#include <DBRep.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Box.hxx>
|
||||
|
||||
#include <BRepBuilderAPI.hxx>
|
||||
#include <BRepBuilderAPI_FindPlane.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
#include <BRepBuilderAPI_GTransform.hxx>
|
||||
#include <BRepBuilderAPI_NurbsConvert.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Mat.hxx>
|
||||
#include <gp_GTrsf.hxx>
|
||||
#include <BRepOffsetAPI_NormalProjection.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
|
||||
#include <GCPnts_QuasiUniformAbscissa.hxx>
|
||||
#include <Geom2dAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <ProjLib_ComputeApproxOnPolarSurface.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
|
||||
|
||||
#include <Draw_Segment3D.hxx>
|
||||
#include <Draw_Marker3D.hxx>
|
||||
#include <Draw_MarkerShape.hxx>
|
||||
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
Standard_IMPORT Draw_Viewer dout;
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// addpcurve
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer addpcurve(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if(n < 4) return 1;
|
||||
TopoDS_Shape E = DBRep::Get(a[1]);
|
||||
if (E.IsNull()) return 1;
|
||||
Handle(Geom2d_Curve) PC = DrawTrSurf::GetCurve2d(a[2]);
|
||||
TopoDS_Shape F = DBRep::Get(a[3]);
|
||||
Standard_Real tol = 1.e-7;
|
||||
if (n > 4) {
|
||||
tol = atof(a[4]);
|
||||
}
|
||||
BRep_Builder BB;
|
||||
BB.UpdateEdge(TopoDS::Edge(E), PC, TopoDS::Face(F),tol);
|
||||
DBRep::Set(a[1], E);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// transform
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer transform(Draw_Interpretor& di,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n <= 1) return 1;
|
||||
|
||||
gp_Trsf T;
|
||||
Standard_Integer last = n;
|
||||
|
||||
if (!strcmp(a[0],"reset")) {
|
||||
}
|
||||
else if (!strcmp(a[0],"tmove")) {
|
||||
if (n < 3) return 1;
|
||||
TopoDS_Shape SL = DBRep::Get(a[n-1]);
|
||||
if (SL.IsNull()) return 0;
|
||||
T = SL.Location().Transformation();
|
||||
last = n-1;
|
||||
}
|
||||
else if (!strcmp(a[0],"ttranslate")) {
|
||||
if (n < 5) return 1;
|
||||
T.SetTranslation(gp_Vec(atof(a[n-3]),atof(a[n-2]),atof(a[n-1])));
|
||||
last = n-3;
|
||||
}
|
||||
else if (!strcmp(a[0],"trotate")) {
|
||||
if (n < 9) return 1;
|
||||
T.SetRotation(gp_Ax1(gp_Pnt(atof(a[n-7]),atof(a[n-6]),atof(a[n-5])),
|
||||
gp_Vec(atof(a[n-4]),atof(a[n-3]),atof(a[n-2]))),
|
||||
atof(a[n-1])* PI180);
|
||||
last = n-7;
|
||||
}
|
||||
else if (!strcmp(a[0],"tmirror")) {
|
||||
if (n < 8) return 1;
|
||||
T.SetMirror(gp_Ax2(gp_Pnt(atof(a[n-6]),atof(a[n-5]),atof(a[n-4])),
|
||||
gp_Vec(atof(a[n-3]),atof(a[n-2]),atof(a[n-1]))));
|
||||
last = n-6;
|
||||
}
|
||||
else if (!strcmp(a[0],"tscale")) {
|
||||
if (n < 6) return 1;
|
||||
T.SetScale(gp_Pnt(atof(a[n-4]),atof(a[n-3]),atof(a[n-2])),atof(a[n-1]));
|
||||
last = n-4;
|
||||
|
||||
}
|
||||
|
||||
if (T.Form() == gp_Identity) {
|
||||
TopLoc_Location L;
|
||||
for (Standard_Integer i = 1; i < last; i++) {
|
||||
TopoDS_Shape S = DBRep::Get(a[i]);
|
||||
if (S.IsNull()) {
|
||||
//cout << a[i] << " is not a valid shape" << endl;
|
||||
di << a[i] << " is not a valid shape" << "\n";
|
||||
}
|
||||
else {
|
||||
DBRep::Set(a[i],S.Located(L));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
BRepBuilderAPI_Transform trf(T);
|
||||
for (Standard_Integer i = 1; i < last; i++) {
|
||||
TopoDS_Shape S = DBRep::Get(a[i]);
|
||||
if (S.IsNull()) {
|
||||
//cout << a[i] << " is not a valid shape" << endl;
|
||||
di << a[i] << " is not a valid shape" << "\n";
|
||||
}
|
||||
else {
|
||||
trf.Perform(S);
|
||||
if (trf.IsDone()){
|
||||
DBRep::Set(a[i],trf.Shape());
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
///=======================================================================
|
||||
// gtransform
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer deform(Draw_Interpretor& di,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n <= 1) return 1;
|
||||
|
||||
Standard_Integer last = n;
|
||||
|
||||
gp_Trsf T;
|
||||
gp_GTrsf GT(T);
|
||||
|
||||
// gp_Mat rot(atof(a[last-3]),0,0,0,atof(a[last-2]),0,0,0,atof(a[last-1]));
|
||||
gp_Mat rot(atof(a[3]),0,0,0,atof(a[4]),0,0,0,atof(a[5]));
|
||||
GT.SetVectorialPart(rot);
|
||||
last -= 3;
|
||||
BRepBuilderAPI_GTransform gtrf(GT);
|
||||
BRepBuilderAPI_NurbsConvert nbscv;
|
||||
// for (Standard_Integer i = 1; i < last; i++) {
|
||||
// TopoDS_Shape S = DBRep::Get(a[i]);
|
||||
TopoDS_Shape S = DBRep::Get(a[2]);
|
||||
if (S.IsNull()) {
|
||||
//cout << a[2] << " is not a valid shape" << endl;
|
||||
di << a[2] << " is not a valid shape" << "\n";
|
||||
}
|
||||
else {
|
||||
gtrf.Perform(S);
|
||||
if (gtrf.IsDone()){
|
||||
DBRep::Set(a[1],gtrf.Shape());
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// tcopy
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer tcopy(Draw_Interpretor& di,Standard_Integer n,const char** a)
|
||||
{
|
||||
Standard_Boolean copyGeom = Standard_True;
|
||||
Standard_Integer iFirst = 1; // index of first shape argument
|
||||
|
||||
if (n > 1 && a[1][0] == '-' && a[1][1] == 'n' )
|
||||
{
|
||||
copyGeom = Standard_False;
|
||||
iFirst = 2;
|
||||
}
|
||||
|
||||
if (n < 3 || (n - iFirst) % 2) {
|
||||
cout << "Use: " << a[0] << " [-n(ogeom)] shape1 copy1 [shape2 copy2 [...]]" << endl;
|
||||
cout << "Option -n forbids copying of geometry (it will be shared)" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
BRepBuilderAPI_Copy cop;
|
||||
Standard_Integer nbPairs = (n - iFirst) / 2;
|
||||
for (Standard_Integer i=0; i < nbPairs; i++) {
|
||||
cop.Perform(DBRep::Get(a[i+iFirst]), copyGeom);
|
||||
DBRep::Set(a[i+iFirst+1],cop.Shape());
|
||||
di << a[i+iFirst+1] << " ";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// NurbsConvert
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer nurbsconvert(Draw_Interpretor& di,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
if ((n-1)%2 != 0) return 1;
|
||||
BRepBuilderAPI_NurbsConvert nbscv;
|
||||
for (Standard_Integer i=0; i<(n-1)/2; i++) {
|
||||
TopoDS_Shape S = DBRep::Get(a[2*i+2]);
|
||||
if (S.IsNull()) {
|
||||
//cout << a[2*i+2] << " is not a valid shape" << endl;
|
||||
di << a[2*i+2] << " is not a valid shape" << "\n";
|
||||
}
|
||||
else {
|
||||
nbscv.Perform(S);
|
||||
if (nbscv.IsDone()){
|
||||
DBRep::Set(a[2*i+1],nbscv.Shape());
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// make a 3D edge curve
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer mkedgecurve (Draw_Interpretor& ,Standard_Integer n,const char** a)
|
||||
{
|
||||
|
||||
Standard_Boolean CurveDone ;
|
||||
|
||||
if (n < 3) return 1;
|
||||
Standard_Real Tolerance = atof(a[2]) ;
|
||||
|
||||
TopoDS_Shape S = DBRep::Get(a[1]);
|
||||
|
||||
if (S.IsNull()) return 1;
|
||||
|
||||
CurveDone =
|
||||
BRepLib::BuildCurves3d(S,
|
||||
Tolerance) ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// sameparameter
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer sameparameter(Draw_Interpretor& ,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 2) return 1;
|
||||
Standard_Real tol = 1.e-7;
|
||||
TopoDS_Shape S = DBRep::Get(a[1]);
|
||||
if (S.IsNull()) return 1;
|
||||
Standard_Boolean force = !strcmp(a[0],"fsameparameter");
|
||||
if (n == 3) tol = atof(a[2]);
|
||||
|
||||
BRepLib::SameParameter(S,tol,force);
|
||||
|
||||
DBRep::Set(a[1],S);
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : updatetol
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer updatetol(Draw_Interpretor& ,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 2) return 1;
|
||||
|
||||
TopoDS_Shape S = DBRep::Get(a[1]);
|
||||
if (S.IsNull()) return 1;
|
||||
|
||||
if (n==2) BRepLib::UpdateTolerances(S);
|
||||
else BRepLib::UpdateTolerances(S,Standard_True);
|
||||
DBRep::Set(a[1],S);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OrienSolid
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer orientsolid(Draw_Interpretor& ,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 2) return 1;
|
||||
|
||||
TopoDS_Shape S = DBRep::Get(a[1]);
|
||||
if (S.IsNull()) return 1;
|
||||
if (S.ShapeType()!=TopAbs_SOLID) return 1;
|
||||
|
||||
BRepLib::OrientClosedSolid(TopoDS::Solid(S));
|
||||
|
||||
DBRep::Set(a[1],S);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : boundingstr
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer boundingstr(Draw_Interpretor& di,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 2) return 1;
|
||||
TopoDS_Shape S = DBRep::Get(a[1]);
|
||||
if (S.IsNull()) return 1;
|
||||
Bnd_Box B;
|
||||
BRepBndLib::Add(S,B);
|
||||
Standard_Real axmin,aymin,azmin,axmax,aymax,azmax;
|
||||
B.Get(axmin,aymin,azmin,axmax,aymax,azmax);
|
||||
di << axmin<<" "<< aymin<<" "<< azmin<<" "<< axmax<<" "<< aymax<<" "<< azmax;
|
||||
if (n >= 8) {
|
||||
Draw::Set(a[2],axmin) ;
|
||||
Draw::Set(a[3],aymin) ;
|
||||
Draw::Set(a[4],azmin) ;
|
||||
Draw::Set(a[5],axmax) ;
|
||||
Draw::Set(a[6],aymax) ;
|
||||
Draw::Set(a[7],azmax) ;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : bounding
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer bounding(Draw_Interpretor& di,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 2) return 1;
|
||||
Standard_Real axmin,aymin,azmin,axmax,aymax,azmax;
|
||||
Bnd_Box B; Handle(Draw_Box) DB;
|
||||
|
||||
if (n == 2) {
|
||||
TopoDS_Shape S = DBRep::Get(a[1]);
|
||||
if (S.IsNull()) return 1;
|
||||
BRepBndLib::Add(S,B);
|
||||
B.Get(axmin,aymin,azmin,axmax,aymax,azmax);
|
||||
DB = new Draw_Box(gp_Pnt(axmin,aymin,azmin),gp_Pnt(axmax,aymax,azmax),Draw_orange);
|
||||
dout<<DB;
|
||||
di << axmin<<" "<< aymin<<" "<< azmin<<" "<< axmax<<" "<< aymax<<" "<< azmax;
|
||||
}
|
||||
else if (n == 7) {
|
||||
axmin=atof(a[1]);
|
||||
aymin=atof(a[2]);
|
||||
azmin=atof(a[3]);
|
||||
axmax=atof(a[4]);
|
||||
aymax=atof(a[5]);
|
||||
azmax=atof(a[6]);
|
||||
DB = new Draw_Box(gp_Pnt(axmin,aymin,azmin),gp_Pnt(axmax,aymax,azmax),Draw_orange);
|
||||
dout<<DB;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : findplane
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static Standard_Integer findplane(Draw_Interpretor& di,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
TopoDS_Shape S = DBRep::Get(a[1]);
|
||||
if (S.IsNull()) return 1;
|
||||
Standard_Real tolerance = 1.0e-5 ;
|
||||
BRepBuilderAPI_FindPlane a_plane_finder(S,
|
||||
tolerance) ;
|
||||
if (a_plane_finder.Found()) {
|
||||
//cout << " a plane is found " ;
|
||||
di << " a plane is found \n";
|
||||
DrawTrSurf::Set(a[2],a_plane_finder.Plane()) ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : precision
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer precision(Draw_Interpretor& di,Standard_Integer n,const char** a)
|
||||
{
|
||||
n--;
|
||||
|
||||
if ( n == 0) {
|
||||
//cout << " Current Precision = " << BRepBuilderAPI::Precision() << endl;
|
||||
di << " Current Precision = " << BRepBuilderAPI::Precision() << "\n";
|
||||
}
|
||||
else {
|
||||
BRepBuilderAPI::Precision(atof(a[1]));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : reperage shape (Int lin Shape) + pointe double click + maxtol
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
#include <IntCurvesFace_ShapeIntersector.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
|
||||
static Standard_Integer reperageshape(Draw_Interpretor& di, Standard_Integer narg , const char** a)
|
||||
{
|
||||
Standard_Integer details=0;
|
||||
if(narg<2) return 1;
|
||||
if(narg==3) details=1;
|
||||
const char *id1 = a[1];
|
||||
TopoDS_Shape TheShape1 = DBRep::Get(id1);
|
||||
|
||||
//cout << "Pick positions with button "<<endl;
|
||||
di << "Pick positions with button "<< "\n";
|
||||
Standard_Integer id,X,Y,b;
|
||||
gp_Trsf T;
|
||||
gp_Pnt P1,P2;
|
||||
dout.Select(id,X,Y,b);
|
||||
|
||||
dout.GetTrsf(id,T);
|
||||
T.Invert();
|
||||
Standard_Real z = dout.Zoom(id);
|
||||
P2.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z, 0.0);
|
||||
P2.Transform(T);
|
||||
P1.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,-1.0);
|
||||
P1.Transform(T);
|
||||
|
||||
|
||||
gp_Ax1 Axe(P1,gp_Vec(P1,P2));
|
||||
IntCurvesFace_ShapeIntersector Inter;
|
||||
Inter.Load(TheShape1,1e-7);
|
||||
|
||||
Inter.Perform(Axe,-RealLast(),RealLast());
|
||||
|
||||
//cout<<"\n --> ";
|
||||
di <<"\n --> ";
|
||||
if(Inter.NbPnt()) {
|
||||
for(Standard_Integer i=1; i<=Inter.NbPnt(); i++) {
|
||||
Standard_Integer numface=1;
|
||||
TopExp_Explorer ExF;
|
||||
for(ExF.Init(TheShape1,TopAbs_FACE);
|
||||
ExF.More();
|
||||
ExF.Next(),numface++) {
|
||||
TopoDS_Face Face=TopoDS::Face(ExF.Current());
|
||||
if(Face.IsEqual(Inter.Face(i))) {
|
||||
//cout<<" "<<a[1]<<"_"<<numface;
|
||||
di<<" "<<a[1]<<"_"<<numface;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
const gp_Pnt& P = Inter.Pnt(i);
|
||||
Standard_Real PMin = Inter.WParameter(i);
|
||||
if(details) {
|
||||
//cout<<" w:"<<PMin<<endl;
|
||||
di<<" w:"<<PMin<< "\n";
|
||||
}
|
||||
if(Inter.Transition(i) == IntCurveSurface_In) {
|
||||
if(Inter.State(i) == TopAbs_IN) {
|
||||
Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_Square, Draw_rouge,2);
|
||||
dout << p; dout.Flush();
|
||||
}
|
||||
else if(Inter.State(i) == TopAbs_ON) {
|
||||
Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_Square, Draw_vert,2);
|
||||
dout << p; dout.Flush();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(Inter.Transition(i) == IntCurveSurface_Out) {
|
||||
if(Inter.State(i) == TopAbs_IN) {
|
||||
Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_X, Draw_rouge,2);
|
||||
dout << p; dout.Flush();
|
||||
}
|
||||
else if(Inter.State(i) == TopAbs_ON) {
|
||||
Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_X, Draw_vert,2);
|
||||
dout << p; dout.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//cout<<endl;
|
||||
di << "\n";
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static Standard_Integer maxtolerance(Draw_Interpretor& theCommands,
|
||||
Standard_Integer n, const char** a) {
|
||||
if(n<2) return(1);
|
||||
TopoDS_Shape TheShape = DBRep::Get(a[1]);
|
||||
if(TheShape.IsNull()) return(1);
|
||||
|
||||
Standard_Real T,TMF,TME,TMV,TmF,TmE,TmV;
|
||||
Standard_Integer nbF,nbE,nbV;
|
||||
TMF=TME=TMV=-RealLast();
|
||||
TmF=TmE=TmV=RealLast();
|
||||
nbF=nbE=nbV=0;
|
||||
|
||||
TopExp_Explorer ExF;
|
||||
for(ExF.Init(TheShape,TopAbs_FACE);
|
||||
ExF.More();
|
||||
ExF.Next()) {
|
||||
TopoDS_Face Face=TopoDS::Face(ExF.Current());
|
||||
T=BRep_Tool::Tolerance(Face);
|
||||
if(T>TMF) TMF=T;
|
||||
if(T<TmF) TmF=T;
|
||||
nbF++;
|
||||
}
|
||||
TopExp_Explorer ExE;
|
||||
for(ExE.Init(TheShape,TopAbs_EDGE);
|
||||
ExE.More();
|
||||
ExE.Next()) {
|
||||
TopoDS_Edge Edge=TopoDS::Edge(ExE.Current());
|
||||
T=BRep_Tool::Tolerance(Edge);
|
||||
if(T>TME) TME=T;
|
||||
if(T<TmE) TmE=T;
|
||||
nbE++;
|
||||
}
|
||||
TopExp_Explorer ExV;
|
||||
for(ExV.Init(TheShape,TopAbs_VERTEX);
|
||||
ExV.More();
|
||||
ExV.Next()) {
|
||||
TopoDS_Vertex Vertex=TopoDS::Vertex(ExV.Current());
|
||||
T=BRep_Tool::Tolerance(Vertex);
|
||||
if(T>TMV) TMV=T;
|
||||
if(T<TmV) TmV=T;
|
||||
nbV++;
|
||||
}
|
||||
|
||||
// printf("\n## Tolerances sur le shape %s (nbFaces:%3d nbEdges:%3d nbVtx:%3d)\n",a[1],nbF,nbE,nbV);
|
||||
// if(TmF<=TMF) printf("\n Face : Min %+5.8e Max %+5.8e \n ",TmF,TMF);
|
||||
// if(TmE<=TME) printf("\n Edge : Min %+5.8e Max %+5.8e \n ",TmE,TME);
|
||||
// if(TmV<=TMV) printf("\n Vertex : Min %+5.8e Max %+5.8e \n\n ",TmV,TMV);
|
||||
|
||||
#ifndef WNT
|
||||
Standard_SStream sss;
|
||||
sss << "\n## Tolerances on the shape " << a[1] << " (nbFaces:" << nbF
|
||||
<< " nbEdges:" << nbE << " nbVtx:" << nbV << ")\n" ;
|
||||
sss.precision(5);
|
||||
sss.setf(ios::scientific);
|
||||
if(TmF<=TMF) sss << "\n Face : Min " << setw(8) << TmF <<" Max " << setw(8) << TMF << " \n ";
|
||||
if(TmE<=TME) sss << "\n Edge : Min " << setw(8) << TmE <<" Max " << setw(8) << TME << " \n ";
|
||||
if(TmV<=TMV) sss << "\n Vertex : Min " << setw(8) << TmV <<" Max " << setw(8) << TMV << " \n ";
|
||||
theCommands << sss;
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static Standard_Integer vecdc(Draw_Interpretor& di,Standard_Integer ,const char** ) {
|
||||
//cout << "Pick positions with button "<<endl;
|
||||
di << "Pick positions with button "<< "\n";
|
||||
|
||||
Standard_Integer id,X,Y,b;
|
||||
gp_Trsf T;
|
||||
gp_Pnt P1,P2,PP1,PP2;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
dout.Select(id,X,Y,b); dout.GetTrsf(id,T);
|
||||
T.Invert();
|
||||
Standard_Real z = dout.Zoom(id);
|
||||
P1.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0);
|
||||
P1.Transform(T);
|
||||
|
||||
dout.Select(id,X,Y,b); dout.GetTrsf(id,T);
|
||||
T.Invert(); z = dout.Zoom(id);
|
||||
|
||||
P2.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0);
|
||||
P2.Transform(T);
|
||||
Standard_Real xa,ya,za;
|
||||
if(Abs(P1.X())>Abs(P2.X())) xa = P1.X(); else xa = P2.X();
|
||||
if(Abs(P1.Y())>Abs(P2.Y())) ya = P1.Y(); else ya = P2.Y();
|
||||
if(Abs(P1.Z())>Abs(P2.Z())) za = P1.Z(); else za = P2.Z();
|
||||
P1.SetCoord(xa,ya,za);
|
||||
Handle(Draw_Marker3D) D0 = new Draw_Marker3D(gp_Pnt(P1.X(),
|
||||
P1.Y(),
|
||||
P1.Z()),
|
||||
Draw_Square,Draw_blanc,1);
|
||||
|
||||
dout << D0;
|
||||
dout.Flush();
|
||||
//-----------------------------------------------------------
|
||||
dout.Select(id,X,Y,b);
|
||||
dout.GetTrsf(id,T);
|
||||
T.Invert();
|
||||
z = dout.Zoom(id);
|
||||
PP1.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0);
|
||||
PP1.Transform(T);
|
||||
dout.Select(id,X,Y,b);
|
||||
dout.GetTrsf(id,T);
|
||||
T.Invert();
|
||||
z = dout.Zoom(id);
|
||||
PP2.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0);
|
||||
PP2.Transform(T);
|
||||
if(Abs(PP1.X())>Abs(PP2.X())) xa = PP1.X(); else xa = PP2.X();
|
||||
if(Abs(PP1.Y())>Abs(PP2.Y())) ya = PP1.Y(); else ya = PP2.Y();
|
||||
if(Abs(PP1.Z())>Abs(PP2.Z())) za = PP1.Z(); else za = PP2.Z();
|
||||
PP1.SetCoord(xa,ya,za);
|
||||
Handle(Draw_Segment3D) d = new Draw_Segment3D(P1,PP1,Draw_blanc);
|
||||
dout << d;
|
||||
dout.Flush();
|
||||
//cout<<"\nttran "<<PP1.X()-P1.X()<<" "<<PP1.Y()-P1.Y()<<" "<<PP1.Z()-P1.Z()<<endl;
|
||||
di <<"\nttran "<<PP1.X()-P1.X()<<" "<<PP1.Y()-P1.Y()<<" "<<PP1.Z()-P1.Z()<< "\n";
|
||||
|
||||
static Standard_Integer nboxvecdp=0;
|
||||
//cout<<"\nbox b"<<++nboxvecdp<<" "<<Min(P1.X(),PP1.X())<<" "<<Min(P1.Y(),PP1.Y())<<" "<<Min(PP1.Z(),P1.Z());
|
||||
//cout<<" "<<Abs(PP1.X()-P1.X())<<" "<<Abs(PP1.Y()-P1.Y())<<" "<<Abs(PP1.Z()-P1.Z())<<endl;
|
||||
|
||||
//cout<<"\nDistance :"<<sqrt( (PP1.X()-P1.X())*(PP1.X()-P1.X())
|
||||
// +(PP1.Y()-P1.Y())*(PP1.Y()-P1.Y())
|
||||
// +(PP1.Z()-P1.Z())*(PP1.Z()-P1.Z()))<<endl;
|
||||
|
||||
di <<"\nbox b"<<++nboxvecdp<<" "<<Min(P1.X(),PP1.X())<<" "<<Min(P1.Y(),PP1.Y())<<" "<<Min(PP1.Z(),P1.Z());
|
||||
di <<" "<<Abs(PP1.X()-P1.X())<<" "<<Abs(PP1.Y()-P1.Y())<<" "<<Abs(PP1.Z()-P1.Z())<< "\n";
|
||||
|
||||
di <<"\nDistance :"<<sqrt( (PP1.X()-P1.X())*(PP1.X()-P1.X())
|
||||
+(PP1.Y()-P1.Y())*(PP1.Y()-P1.Y())
|
||||
+(PP1.Z()-P1.Z())*(PP1.Z()-P1.Z()))<< "\n";
|
||||
return(0);
|
||||
}
|
||||
//=======================================================================
|
||||
// nproject
|
||||
//=======================================================================
|
||||
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
static Standard_Integer nproject(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n < 4) return 1;
|
||||
TopoDS_Shape InpShape;
|
||||
Standard_Integer arg = 2, i;
|
||||
TopTools_SequenceOfShape Args;
|
||||
|
||||
Standard_Real Tol = 1.e-4;
|
||||
Standard_Real Tol2d;
|
||||
Standard_Real MaxDistance = 1.e-3;
|
||||
GeomAbs_Shape Continuity = GeomAbs_C2;
|
||||
Standard_Integer MaxDeg = 14;
|
||||
Standard_Integer MaxSeg = 16;
|
||||
|
||||
while((n > arg) && !(InpShape = DBRep::Get(a[arg])).IsNull()){
|
||||
Args.Append(InpShape);
|
||||
arg++;
|
||||
}
|
||||
if(Args.Length() < 2) return 1;
|
||||
|
||||
BRepOffsetAPI_NormalProjection OrtProj(Args.Last());
|
||||
|
||||
for(i = 1; i < Args.Length(); i++)
|
||||
OrtProj.Add(Args(i));
|
||||
|
||||
if(n > arg)
|
||||
if (!strcmp(a[arg],"-g")) {
|
||||
OrtProj.SetLimit(Standard_False);
|
||||
arg++;
|
||||
}
|
||||
|
||||
if(n > arg)
|
||||
if (!strcmp(a[arg],"-d")) {
|
||||
arg++;
|
||||
if(n > arg)
|
||||
MaxDistance = atof(a[arg++]);
|
||||
OrtProj.SetMaxDistance(MaxDistance);
|
||||
}
|
||||
if(n > arg) {
|
||||
Tol = Max(atof(a[arg++]),1.e-10);
|
||||
}
|
||||
|
||||
if(n > arg) {
|
||||
if (atoi(a[arg]) == 0) Continuity = GeomAbs_C0;
|
||||
else if (atoi(a[arg]) == 1) Continuity = GeomAbs_C1;
|
||||
arg++;
|
||||
}
|
||||
|
||||
|
||||
if(n > arg) {
|
||||
MaxDeg = atoi(a[arg++]);
|
||||
if (MaxDeg<1 || MaxDeg>14) MaxDeg = 14;
|
||||
}
|
||||
|
||||
if(n > arg) MaxSeg = atoi(a[arg]);
|
||||
|
||||
Tol2d = Pow(Tol, 2./3);
|
||||
|
||||
OrtProj.SetParams(Tol, Tol2d, Continuity, MaxDeg, MaxSeg);
|
||||
OrtProj.Build();
|
||||
TopTools_ListOfShape Wire;
|
||||
Standard_Boolean IsWire=OrtProj.BuildWire(Wire);
|
||||
if (IsWire) {
|
||||
//cout << " BuildWire OK " << endl;
|
||||
di << " BuildWire OK " << "\n";
|
||||
}
|
||||
DBRep::Set(a[1], OrtProj.Shape());
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//function : wexplo
|
||||
// exploration d un wire
|
||||
//==========================================================================
|
||||
static Standard_Integer wexplo (Draw_Interpretor&,
|
||||
Standard_Integer argc, const char** argv)
|
||||
{
|
||||
char name[100];
|
||||
if (argc < 2) return 1;
|
||||
|
||||
TopoDS_Shape C1 = DBRep::Get (argv[1],TopAbs_WIRE);
|
||||
TopoDS_Shape C2 ;
|
||||
|
||||
if (argc > 2) C2 = DBRep::Get (argv[2],TopAbs_FACE);
|
||||
|
||||
if (C1.IsNull()) return 1;
|
||||
|
||||
BRepTools_WireExplorer we;
|
||||
if (C2.IsNull()) we.Init(TopoDS::Wire(C1));
|
||||
else we.Init(TopoDS::Wire(C1),TopoDS::Face(C2));
|
||||
|
||||
Standard_Integer k = 1;
|
||||
while (we.More()) {
|
||||
TopoDS_Edge E = we.Current();
|
||||
sprintf(name,"WEDGE_%d",k);
|
||||
DBRep::Set(name,E);
|
||||
we.Next();
|
||||
k++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
|
||||
const char* g = "TOPOLOGY Basic shape commands";
|
||||
|
||||
theCommands.Add("addpcurve",
|
||||
"addpcurve edge 2dcurve face [tol (default 1.e-7)]",
|
||||
__FILE__,
|
||||
addpcurve,g);
|
||||
|
||||
theCommands.Add("reset",
|
||||
"reset name1 name2..., remove location",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tmove",
|
||||
"tmove name1 name2 ... name(location)",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("ttranslate",
|
||||
"tmove name1 name2 ... dx dy dz",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("trotate","trotate name1 name2 ... x y z dx dy dz angle",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tmirror",
|
||||
"tmirror name x y z dx dy dz",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tscale",
|
||||
"tscale name x y z scale",
|
||||
__FILE__,
|
||||
transform,g);
|
||||
|
||||
theCommands.Add("tcopy",
|
||||
"tcopy [-n(ogeom)] name1 result1 [name2 result2 ...]",
|
||||
__FILE__,
|
||||
tcopy,g);
|
||||
|
||||
theCommands.Add("precision",
|
||||
"precision [preci]",
|
||||
__FILE__,
|
||||
precision,g);
|
||||
|
||||
theCommands.Add("mkedgecurve",
|
||||
"mkedgecurve name tolerance",
|
||||
__FILE__,
|
||||
mkedgecurve,g);
|
||||
|
||||
theCommands.Add("fsameparameter",
|
||||
"fsameparameter shapename [tol (default 1.e-7)], \nforce le sameparameter sur toutes les aretes du shape",
|
||||
__FILE__,
|
||||
sameparameter,g);
|
||||
|
||||
theCommands.Add("sameparameter",
|
||||
"sameparameter shapename [tol (default 1.e-7)]",
|
||||
__FILE__,
|
||||
sameparameter,g);
|
||||
|
||||
theCommands.Add("updatetolerance",
|
||||
"updatetolerance myShape [param] \n if [param] is absent - not verify of face tolerance, else - perform it",
|
||||
__FILE__,
|
||||
updatetol,g);
|
||||
|
||||
theCommands.Add("solidorientation",
|
||||
"orientsolid myClosedSolid",
|
||||
__FILE__,
|
||||
orientsolid,g);
|
||||
|
||||
theCommands.Add("bounding",
|
||||
"bounding shape [ xmin ymin zmin xmax ymax zmax] ; draw bounds",
|
||||
__FILE__,
|
||||
bounding,g);
|
||||
|
||||
theCommands.Add("boundingstr",
|
||||
"boundingstr shape [ xmin ymin zmin xmax ymax zmax] ; print bounding box",
|
||||
__FILE__,
|
||||
boundingstr,g);
|
||||
|
||||
theCommands.Add("nurbsconvert",
|
||||
"nurbsconvert result name [result name]",
|
||||
__FILE__,
|
||||
nurbsconvert,g);
|
||||
|
||||
theCommands.Add("deform",
|
||||
"deform newname name CoeffX CoeffY CoeffZ",
|
||||
__FILE__,
|
||||
deform,g);
|
||||
|
||||
theCommands.Add("findplane",
|
||||
"findplane name planename ",
|
||||
__FILE__,
|
||||
findplane,g) ;
|
||||
|
||||
theCommands.Add("maxtolerance",
|
||||
"maxtolerance shape ",
|
||||
__FILE__,
|
||||
maxtolerance,g) ;
|
||||
|
||||
theCommands.Add("reperageshape",
|
||||
"reperage shape -> list of shape (result of interstion shape , line)",
|
||||
__FILE__,
|
||||
reperageshape,g) ;
|
||||
|
||||
theCommands.Add("vecdc",
|
||||
"vecdc + Pointe double click ",
|
||||
__FILE__,
|
||||
vecdc,g) ;
|
||||
|
||||
theCommands.Add("nproject","nproject pj e1 e2 e3 ... surf -g -d [dmax] [Tol [continuity [maxdeg [maxseg]]]",
|
||||
__FILE__,
|
||||
nproject,g);
|
||||
|
||||
theCommands.Add("wexplo","wexplo wire [face] create WEDGE_i",
|
||||
__FILE__,
|
||||
wexplo,g);
|
||||
}
|
177
src/BRepTest/BRepTest_ChamferCommands.cxx
Executable file
177
src/BRepTest/BRepTest_ChamferCommands.cxx
Executable file
@@ -0,0 +1,177 @@
|
||||
// File: BRepTest_ChamferCommands.cxx
|
||||
// Created: Mon Sep 25 14:07:55 1995
|
||||
// Author: Stagiaire Flore Lautheanne
|
||||
// <fla@phylox>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <BRepTest.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <BRepFilletAPI_MakeChamfer.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//=========================================================================
|
||||
// function : chamfer
|
||||
// purpose : command to construct chamfers on several edges
|
||||
// Here the chamfer is propagated on tangential edges to the
|
||||
// required edge
|
||||
//=========================================================================
|
||||
|
||||
static Standard_Integer chamfer(Draw_Interpretor& di,
|
||||
Standard_Integer narg,
|
||||
const char** a)
|
||||
|
||||
{
|
||||
// check the argument number of the command
|
||||
if (narg == 1) {
|
||||
//cout <<" help for chamf : "<< endl;
|
||||
//cout <<" Construction by equal distances from edge : chamf newname shape edge face S dist"<< endl;
|
||||
//cout <<" Construction by two distances from edge : chamf newname shape edge face dist1 dist2"<< endl;
|
||||
//cout <<" Construction by distance from edge and given angle : chamf newname shape edge face A dist angle"<< endl;
|
||||
di <<" help for chamf : "<< "\n";
|
||||
di <<" Construction by equal distances from edge : chamf newname shape edge face S dist"<< "\n";
|
||||
di <<" Construction by two distances from edge : chamf newname shape edge face dist1 dist2"<< "\n";
|
||||
di <<" Construction by distance from edge and given angle : chamf newname shape edge face A dist angle"<< "\n";
|
||||
}
|
||||
else {
|
||||
if (narg < 7) return 1;
|
||||
|
||||
TopoDS_Shape S = DBRep::Get(a[2]);
|
||||
if (S.IsNull()) return 1;
|
||||
|
||||
TopoDS_Edge E;
|
||||
TopoDS_Face F;
|
||||
Standard_Real d1,d2, angle;
|
||||
Standard_Integer i = 3;
|
||||
Standard_Integer Method = 1;
|
||||
Standard_Integer NbArg = 3;
|
||||
|
||||
BRepFilletAPI_MakeChamfer aMCh(S);
|
||||
|
||||
if (!strcasecmp(a[i + 2], "S") ) Method = 0;
|
||||
|
||||
if (Method != 0) {
|
||||
if (!strcasecmp(a[i + 2], "A")) {
|
||||
Method = 2;
|
||||
NbArg++;
|
||||
}
|
||||
}
|
||||
|
||||
while (i + NbArg < narg) {
|
||||
TopoDS_Shape aLocalEdge(DBRep::Get(a[i], TopAbs_EDGE));
|
||||
E = TopoDS::Edge(aLocalEdge);
|
||||
TopoDS_Shape aLocalFace(DBRep::Get(a[i + 1], TopAbs_FACE));
|
||||
F = TopoDS::Face(aLocalFace);
|
||||
// E = TopoDS::Edge(DBRep::Get(a[i], TopAbs_EDGE));
|
||||
// F = TopoDS::Face(DBRep::Get(a[i + 1], TopAbs_FACE));
|
||||
if (Method == 0) {
|
||||
if (!E.IsNull() && !F.IsNull() && (aMCh.Contour(E) == 0) ) {
|
||||
d1 = atof(a[i + 3]);
|
||||
|
||||
if ( d1 > Precision::Confusion())
|
||||
aMCh.Add(d1,E ,F);
|
||||
}
|
||||
i += 4;
|
||||
}
|
||||
else if (Method == 1) {
|
||||
if (!E.IsNull() && !F.IsNull() && (aMCh.Contour(E) == 0) ) {
|
||||
d1 = atof(a[i + 2]);
|
||||
d2 = atof(a[i + 3]);
|
||||
|
||||
if ( (d1 > Precision::Confusion())
|
||||
&& (d2 > Precision::Confusion()) )
|
||||
aMCh.Add(d1,d2,E,F);
|
||||
}
|
||||
i += 4;
|
||||
}
|
||||
else {
|
||||
if (!E.IsNull() && !F.IsNull() && (aMCh.Contour(E) == 0) ) {
|
||||
d1 = atof(a[i + 3]);
|
||||
angle = atof(a[i + 4]);
|
||||
angle *= PI / 180.;
|
||||
|
||||
if ( (d1 > Precision::Confusion())
|
||||
&& (angle > Precision::Confusion())
|
||||
&& (PI / 2.- angle > Precision::Confusion()) )
|
||||
aMCh.AddDA(d1, angle, E, F);
|
||||
}
|
||||
i += 5;
|
||||
}
|
||||
|
||||
if ( i < narg) {
|
||||
Method = 1;
|
||||
NbArg = 3;
|
||||
if (!strcasecmp(a[i + 2], "S") ) Method = 0;
|
||||
|
||||
if (Method != 0) {
|
||||
if (!strcasecmp(a[i + 2], "A")) {
|
||||
Method = 2;
|
||||
NbArg++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// compute the chamfer and display the result
|
||||
if (aMCh.NbContours() == 0 )
|
||||
{
|
||||
//cout<<"No suitable edges to chamfer"<<endl;
|
||||
di<<"No suitable edges to chamfer"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
else aMCh.Build();
|
||||
|
||||
if (aMCh.IsDone()){
|
||||
DBRep::Set(a[1],aMCh);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
//cout<<"compute of chamfer failed"<<endl;
|
||||
di<<"compute of chamfer failed"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ChamferCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::ChamferCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
|
||||
const char* g = "TOPOLOGY Fillet construction commands";
|
||||
|
||||
// theCommands.Add("chamf",
|
||||
// "chamf newname shape edge1 face1 dist1_1 dist1_2 edge2 face2 dist2_1 dist2_2 ... ",__FILE__,chamfer,g);
|
||||
|
||||
theCommands.Add("chamf",
|
||||
"for help call chamf without arguments",__FILE__,chamfer,g);
|
||||
|
||||
}
|
1676
src/BRepTest/BRepTest_CheckCommands.cxx
Executable file
1676
src/BRepTest/BRepTest_CheckCommands.cxx
Executable file
File diff suppressed because it is too large
Load Diff
1796
src/BRepTest/BRepTest_CurveCommands.cxx
Executable file
1796
src/BRepTest/BRepTest_CurveCommands.cxx
Executable file
File diff suppressed because it is too large
Load Diff
261
src/BRepTest/BRepTest_DraftAngleCommands.cxx
Executable file
261
src/BRepTest/BRepTest_DraftAngleCommands.cxx
Executable file
@@ -0,0 +1,261 @@
|
||||
// File: BRepTest_DraftAngleCommands.cxx
|
||||
// Created: Wed Feb 22 15:46:48 1995
|
||||
// Author: Jacques GOUSSARD
|
||||
// <jag@topsn2>
|
||||
|
||||
|
||||
#include <BRepTest.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
|
||||
#include <BRepOffsetAPI_DraftAngle.hxx>
|
||||
#include <BRepOffsetAPI_MakeDraft.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
static void Print(Draw_Interpretor& di,
|
||||
const Draft_ErrorStatus St)
|
||||
{
|
||||
di << " Error Status : ";
|
||||
switch (St) {
|
||||
case Draft_NoError:
|
||||
di << "No error";
|
||||
break;
|
||||
|
||||
case Draft_FaceRecomputation:
|
||||
di << "Impossible face recomputation";
|
||||
break;
|
||||
|
||||
case Draft_EdgeRecomputation:
|
||||
di << "Impossible edge recomputation";
|
||||
break;
|
||||
|
||||
case Draft_VertexRecomputation:
|
||||
di << "Impossible vertex recomputation";
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static Standard_Integer DEP(Draw_Interpretor& theCommands,
|
||||
Standard_Integer narg, const char** a)
|
||||
{
|
||||
if ((narg<14)||(narg%8 != 6)) return 1;
|
||||
TopoDS_Shape V = DBRep::Get(a[2]);
|
||||
BRepOffsetAPI_DraftAngle drft(V);
|
||||
|
||||
gp_Dir Dirextract(atof(a[3]),atof(a[4]),atof(a[5]));
|
||||
|
||||
TopoDS_Face F;
|
||||
Standard_Real Angle;
|
||||
gp_Pnt Pax;
|
||||
gp_Dir Dax;
|
||||
for (Standard_Integer ii = 0; ii < (narg-6)/8; ii++){
|
||||
TopoDS_Shape aLocalShape(DBRep::Get(a[8*ii+6],TopAbs_FACE));
|
||||
F = TopoDS::Face(aLocalShape);
|
||||
// F = TopoDS::Face(DBRep::Get(a[8*ii+6],TopAbs_FACE));
|
||||
Angle = atof(a[8*ii+7])*PI/180.;
|
||||
Pax.SetCoord(atof(a[8*ii+8]),atof(a[8*ii+9]),atof(a[8*ii+10]));
|
||||
Dax.SetCoord(atof(a[8*ii+11]),atof(a[8*ii+12]),atof(a[8*ii+13]));
|
||||
drft.Add(F,Dirextract,Angle,gp_Pln(Pax,Dax));
|
||||
if (!drft.AddDone()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!drft.AddDone()) {
|
||||
DBRep::Set("bugdep",drft.ProblematicShape());
|
||||
theCommands << "Bad shape in variable bugdep ";
|
||||
Print(theCommands,drft.Status());
|
||||
return 1;
|
||||
}
|
||||
drft.Build();
|
||||
if (drft.IsDone()) {
|
||||
DBRep::Set(a[1],drft);
|
||||
return 0;
|
||||
}
|
||||
DBRep::Set("bugdep",drft.ProblematicShape());
|
||||
theCommands << "Problem encountered during the reconstruction : ";
|
||||
theCommands << "bad shape in variable bugdep; ";
|
||||
Print(theCommands,drft.Status());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static Standard_Integer NDEP(Draw_Interpretor& theCommands,
|
||||
Standard_Integer narg, const char** a)
|
||||
{
|
||||
if ((narg<15)||((narg)%9 != 6)) return 1;
|
||||
TopoDS_Shape V = DBRep::Get(a[2]);
|
||||
if ( V.IsNull()) {
|
||||
//cout << a[2] << " is not a Shape" << endl;
|
||||
theCommands << a[2] << " is not a Shape" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
BRepOffsetAPI_DraftAngle drft(V);
|
||||
|
||||
gp_Dir Dirextract(atof(a[3]),atof(a[4]),atof(a[5]));
|
||||
|
||||
TopoDS_Face F;
|
||||
Standard_Real Angle;
|
||||
gp_Pnt Pax;
|
||||
gp_Dir Dax;
|
||||
Standard_Boolean Flag;
|
||||
for (Standard_Integer ii = 0; ii < (narg-6)/9; ii++){
|
||||
TopoDS_Shape aLocalFace(DBRep::Get(a[9*ii+6],TopAbs_FACE));
|
||||
F = TopoDS::Face(aLocalFace);
|
||||
// F = TopoDS::Face(DBRep::Get(a[9*ii+6],TopAbs_FACE));
|
||||
|
||||
if ( F.IsNull()) {
|
||||
//cout << a[9*ii+6] << " is not a face" << endl;
|
||||
theCommands << a[9*ii+6] << " is not a face" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
//#ifdef DEB
|
||||
// Flag = atof(a[9*ii+7]); // BUG?? Real -> Boolean ???
|
||||
//#else
|
||||
Flag = (Standard_Boolean ) atof(a[9*ii+7]);
|
||||
//#endif
|
||||
Angle = atof(a[9*ii+8])*PI/180.;
|
||||
Pax.SetCoord(atof(a[9*ii+9]),atof(a[9*ii+10]),atof(a[9*ii+11]));
|
||||
Dax.SetCoord(atof(a[9*ii+12]),atof(a[9*ii+13]),atof(a[9*ii+14]));
|
||||
drft.Add(F,Dirextract,Angle,gp_Pln(Pax,Dax), Flag);
|
||||
if (!drft.AddDone()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!drft.AddDone()) {
|
||||
DBRep::Set("bugdep",drft.ProblematicShape());
|
||||
theCommands << "Bad shape in variable bugdep ";
|
||||
Print(theCommands,drft.Status());
|
||||
return 1;
|
||||
}
|
||||
drft.Build();
|
||||
if (drft.IsDone()) {
|
||||
DBRep::Set(a[1],drft);
|
||||
return 0;
|
||||
}
|
||||
DBRep::Set("bugdep",drft.ProblematicShape());
|
||||
theCommands << "Problem encountered during the reconstruction : ";
|
||||
theCommands << "bad shape in variable bugdep; ";
|
||||
Print(theCommands,drft.Status());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Standard_Integer draft (Draw_Interpretor& di,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
Standard_Integer Inside = -1;
|
||||
Standard_Boolean Internal = Standard_False;
|
||||
if (n < 8) return 1;
|
||||
|
||||
Standard_Real x, y ,z, teta;
|
||||
TopoDS_Shape SInit = DBRep::Get(a[2]);//shape d'arret
|
||||
|
||||
x = atof(a[3]);
|
||||
y = atof(a[4]); // direction de depouille
|
||||
z = atof(a[5]);
|
||||
teta = atof(a[6]); //angle de depouille (teta)
|
||||
|
||||
gp_Dir D(x,y,z);
|
||||
|
||||
|
||||
|
||||
BRepOffsetAPI_MakeDraft MkDraft(SInit, D, teta);
|
||||
|
||||
if (n>8) {
|
||||
Standard_Integer cur = 8;
|
||||
if (!strcmp(a[cur],"-IN")) {
|
||||
Inside = 1;
|
||||
cur++;
|
||||
}
|
||||
else if (!strcmp(a[cur],"-OUT")) {
|
||||
Inside = 0;
|
||||
cur++;
|
||||
}
|
||||
|
||||
if (cur<n) {
|
||||
if (!strcmp(a[cur],"-Ri")) {
|
||||
MkDraft.SetOptions(BRepBuilderAPI_RightCorner);
|
||||
cur++;
|
||||
}
|
||||
else if (!strcmp(a[cur],"-Ro")) {
|
||||
MkDraft.SetOptions(BRepBuilderAPI_RoundCorner);
|
||||
cur++;
|
||||
}
|
||||
}
|
||||
if (cur<n) {
|
||||
if (!strcmp(a[cur],"-Internal")) {
|
||||
Internal = Standard_True;
|
||||
cur++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Internal) {
|
||||
MkDraft.SetDraft(Internal);
|
||||
di << "Internal Draft : " << "\n";
|
||||
//cout << "Internal Draft : " << endl;
|
||||
}
|
||||
else
|
||||
di << "External Draft : " << "\n";
|
||||
//cout << "External Draft : " << endl;
|
||||
|
||||
TopoDS_Shape Stop = DBRep::Get(a[7]);//shape d'arret
|
||||
if (!Stop.IsNull()) {
|
||||
Standard_Boolean KeepOutside = Standard_True;
|
||||
if (Inside==0) KeepOutside = Standard_False;
|
||||
MkDraft.Perform(Stop, KeepOutside);
|
||||
}
|
||||
else {
|
||||
Handle(Geom_Surface) Surf = DrawTrSurf::GetSurface(a[7]);
|
||||
if (! Surf.IsNull()) { // surface d'arret
|
||||
Standard_Boolean KeepInside = Standard_True;
|
||||
if (Inside==1) KeepInside = Standard_False;
|
||||
MkDraft.Perform(Surf, KeepInside);
|
||||
}
|
||||
else { // by Lenght
|
||||
Standard_Real L = atof(a[7]);
|
||||
if (L > 1.e-7) {
|
||||
MkDraft.Perform(L);
|
||||
}
|
||||
else return 1;
|
||||
}
|
||||
}
|
||||
|
||||
DBRep::Set(a[1], MkDraft.Shape());
|
||||
DBRep::Set("DraftShell", MkDraft.Shell());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : DraftAngleCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::DraftAngleCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
|
||||
const char* g = "Draft angle modification commands";
|
||||
|
||||
theCommands.Add("depouille", " Inclines faces of a shape, dep result shape dirx diry dirz face angle x y x dx dy dz [face angle...]",__FILE__,DEP,g);
|
||||
|
||||
theCommands.Add("ndepouille", " Inclines faces of a shape, dep result shape dirx diry dirz face 0/1 angle x y x dx dy dz [face 0/1 angle...]",__FILE__,NDEP,g);
|
||||
|
||||
theCommands.Add("draft"," Compute a draft surface along a shape, \n draft result shape dirx diry dirz angle shape/surf/length [-IN/-OUT] [Ri/Ro] [-Internal]",
|
||||
__FILE__,draft,g);
|
||||
}
|
143
src/BRepTest/BRepTest_ExtremaCommands.cxx
Executable file
143
src/BRepTest/BRepTest_ExtremaCommands.cxx
Executable file
@@ -0,0 +1,143 @@
|
||||
// File: BRepTest_ExtremaCommands.cxx
|
||||
// Created: Fri Sep 8 11:37:46 1995
|
||||
// Author: Modelistation
|
||||
// <model@ecolox>
|
||||
//
|
||||
// modified by mps (juillet 96) : ajout de la commande distmini
|
||||
|
||||
#include <DBRep.hxx>
|
||||
#include <BRepTest.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <BRepExtrema_Poly.hxx>
|
||||
#include <BRepExtrema_DistShapeShape.hxx>
|
||||
#include <BRepLib_MakeEdge.hxx>
|
||||
#include <BRepLib_MakeEdge.hxx>
|
||||
#include <BRepLib_MakeVertex.hxx>
|
||||
#include <Draw.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
//#ifdef WNT
|
||||
#include <stdio.h>
|
||||
//#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : distance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer distance (Draw_Interpretor& di,
|
||||
Standard_Integer n,
|
||||
const char** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
|
||||
const char *name1 = a[1];
|
||||
const char *name2 = a[2];
|
||||
|
||||
TopoDS_Shape S1 = DBRep::Get(name1);
|
||||
TopoDS_Shape S2 = DBRep::Get(name2);
|
||||
if (S1.IsNull() || S2.IsNull()) return 1;
|
||||
gp_Pnt P1,P2;
|
||||
Standard_Real D;
|
||||
if (!BRepExtrema_Poly::Distance(S1,S2,P1,P2,D)) return 1;
|
||||
//cout << " distance : " << D << endl;
|
||||
di << " distance : " << D << "\n";
|
||||
TopoDS_Edge E = BRepLib_MakeEdge(P1,P2);
|
||||
DBRep::Set("distance",E);
|
||||
return 0;
|
||||
}
|
||||
static Standard_Integer distmini(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
Standard_Integer i1;
|
||||
// gp_Pnt P;
|
||||
|
||||
if (n != 4) return 1;
|
||||
|
||||
const char *ns1 = (a[2]), *ns2 = (a[3]), *ns0 = (a[1]);
|
||||
TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2)) ;
|
||||
BRepExtrema_DistShapeShape dst(S1 ,S2 );
|
||||
|
||||
|
||||
if (dst.IsDone())
|
||||
{
|
||||
#ifdef DEB
|
||||
//dst.Dump(cout);
|
||||
Standard_SStream aSStream;
|
||||
dst.Dump(aSStream);
|
||||
di << aSStream;
|
||||
#endif
|
||||
|
||||
char named[100];
|
||||
sprintf(named, "%s%s" ,ns0,"_val");
|
||||
char* tempd = named;
|
||||
Draw::Set(tempd,dst.Value());
|
||||
di << named << " ";
|
||||
|
||||
for (i1=1; i1<= dst.NbSolution(); i1++)
|
||||
{
|
||||
gp_Pnt P1,P2;
|
||||
P1 = (dst.PointOnShape1(i1));
|
||||
P2 = (dst.PointOnShape2(i1));
|
||||
if (dst.Value()<=1.e-9)
|
||||
{
|
||||
TopoDS_Vertex V =BRepLib_MakeVertex(P1);
|
||||
char namev[100];
|
||||
if (i1==1)
|
||||
sprintf(namev, "%s" ,ns0);
|
||||
else sprintf(namev, "%s%d" ,ns0,i1);
|
||||
char* tempv = namev;
|
||||
DBRep::Set(tempv,V);
|
||||
di << namev << " ";
|
||||
}
|
||||
else
|
||||
{char name[100];
|
||||
TopoDS_Edge E = BRepLib_MakeEdge (P1, P2);
|
||||
if (i1==1)
|
||||
{sprintf(name,"%s",ns0);}
|
||||
else {sprintf(name,"%s%d",ns0,i1);}
|
||||
char* temp = name;
|
||||
DBRep::Set(temp,E);
|
||||
di << name << " " ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else di << "probleme"<< "\n";
|
||||
//else cout << "probleme"<< endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ExtremaCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::ExtremaCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
const char* g = "TOPOLOGY Extrema commands";
|
||||
|
||||
theCommands.Add("dist","dist Shape1 Shape2" ,__FILE__,distance,g);
|
||||
|
||||
|
||||
theCommands.Add("distmini",
|
||||
"distmini name Shape1 Shape2",
|
||||
__FILE__,
|
||||
distmini,g);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
2333
src/BRepTest/BRepTest_FeatureCommands.cxx
Executable file
2333
src/BRepTest/BRepTest_FeatureCommands.cxx
Executable file
File diff suppressed because it is too large
Load Diff
175
src/BRepTest/BRepTest_Fillet2DCommands.cxx
Executable file
175
src/BRepTest/BRepTest_Fillet2DCommands.cxx
Executable file
@@ -0,0 +1,175 @@
|
||||
// Modified: Tue Oct 15 10:12:02 1996
|
||||
// Author: Joelle CHAUVET
|
||||
// <jct@sgi38>
|
||||
// Add ChFi2d_TangencyError (PRO3529)
|
||||
// Modified: Fri Sep 25 09:38:04 1998
|
||||
// Author: Joelle CHAUVET
|
||||
// <jct@sgi64>
|
||||
// status = ChFi2d_NotAuthorized if edges are not
|
||||
// lines or circles (BUC60288) + partial_result
|
||||
|
||||
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <BRepTest.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <BRepFilletAPI_MakeFillet2d.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopExp.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : chfi2d
|
||||
//purpose : 2d fillets and chamfers
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer chfi2d(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3) {
|
||||
di << "chfi2d : not enough args";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// set up the algorithm
|
||||
TopoDS_Shape F = DBRep::Get(a[2],TopAbs_FACE);
|
||||
if (F.IsNull()) {
|
||||
di << "chfi2d : "<< a[2] << " not a face";
|
||||
return 1;
|
||||
}
|
||||
|
||||
BRepFilletAPI_MakeFillet2d MF(TopoDS::Face(F));
|
||||
if (MF.Status() == ChFi2d_NotPlanar) {
|
||||
di << "chfi2d : not a planar face";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopoDS_Shape res;
|
||||
Standard_Boolean partial_result = Standard_False;
|
||||
Standard_Integer i = 3;
|
||||
while (i+1 < n) {
|
||||
|
||||
TopoDS_Shape aLocalEdge(DBRep::Get(a[i],TopAbs_EDGE));
|
||||
TopoDS_Edge E1 = TopoDS::Edge(aLocalEdge);
|
||||
aLocalEdge = DBRep::Get(a[i+1],TopAbs_EDGE);
|
||||
TopoDS_Edge E2 = TopoDS::Edge(aLocalEdge);
|
||||
// TopoDS_Edge E1 = TopoDS::Edge(DBRep::Get(a[i],TopAbs_EDGE));
|
||||
// TopoDS_Edge E2 = TopoDS::Edge(DBRep::Get(a[i+1],TopAbs_EDGE));
|
||||
|
||||
if (E1.IsNull() || E2.IsNull()) {
|
||||
di << "chfi2d : " << a[i] << " or " << a[i+1] << " not an edge";
|
||||
if (partial_result) {
|
||||
di <<" WARNING : this is a partial result ";
|
||||
DBRep::Set(a[1],res);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopoDS_Vertex V;
|
||||
if (!TopExp::CommonVertex(E1,E2,V)) {
|
||||
di << "chfi2d " << a[i] << " and " << a[i+1] << " does not share a vertex";
|
||||
if (partial_result) {
|
||||
di <<" WARNING : this is a partial result ";
|
||||
DBRep::Set(a[1],res);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
i += 2;
|
||||
if (i+1 >= n) {
|
||||
di << "chfi2d : not enough args";
|
||||
if (partial_result) {
|
||||
di <<" WARNING : this is a partial result ";
|
||||
DBRep::Set(a[1],res);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Real p1 = atof(a[i+1]);
|
||||
if (*a[i] == 'F') {
|
||||
MF.AddFillet(V,p1);
|
||||
}
|
||||
else {
|
||||
if (i+2 >= n) {
|
||||
di << "chfi2d : not enough args";
|
||||
if (partial_result) {
|
||||
di <<" WARNING : this is a partial result ";
|
||||
DBRep::Set(a[1],res);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
Standard_Real p2 = atof(a[i+2]);
|
||||
if (a[i][2] == 'D') {
|
||||
MF.AddChamfer(E1,E2,p1,p2);
|
||||
}
|
||||
else {
|
||||
MF.AddChamfer(E1,V,p1,p2*PI180);
|
||||
}
|
||||
}
|
||||
|
||||
if (MF.Status() == ChFi2d_TangencyError) {
|
||||
di << "chfi2d : " << a[i-2] << " and " << a[i-1] << " are tangent ";
|
||||
if (partial_result) {
|
||||
di <<" WARNING : this is a partial result ";
|
||||
DBRep::Set(a[1],res);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (MF.Status() == ChFi2d_NotAuthorized) {
|
||||
di << "chfi2d : " << a[i-2] << " or " << a[i-1] << " is not a line or a circle ";
|
||||
if (partial_result) {
|
||||
di <<" WARNING : this is a partial result ";
|
||||
DBRep::Set(a[1],res);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (MF.Status() != ChFi2d_IsDone) {
|
||||
di << "chfi2d : operation failed on " << a[i-2];
|
||||
if (partial_result) {
|
||||
di <<" WARNING : this is a partial result ";
|
||||
DBRep::Set(a[1],res);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
partial_result = Standard_True;
|
||||
MF.Build();
|
||||
res = MF.Shape();
|
||||
}
|
||||
|
||||
if (*a[i] == 'F') {
|
||||
i +=2;
|
||||
}
|
||||
else {
|
||||
i +=3;
|
||||
}
|
||||
}
|
||||
|
||||
MF.Build();
|
||||
DBRep::Set(a[1],MF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Fillet2DCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::Fillet2DCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
|
||||
const char* g = "TOPOLOGY Fillet2D construction commands";
|
||||
|
||||
theCommands.Add("chfi2d","chfi2d result face [edge1 edge2 (F radius/CDD d1 d2/CDA d ang) ....]",__FILE__,chfi2d,g);
|
||||
}
|
786
src/BRepTest/BRepTest_FilletCommands.cxx
Executable file
786
src/BRepTest/BRepTest_FilletCommands.cxx
Executable file
@@ -0,0 +1,786 @@
|
||||
// File: DBRep_9.cxx
|
||||
// Created: Mon Jun 20 12:32:34 1994
|
||||
// Author: Modeling
|
||||
// <modeling@phylox>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <BRepTest.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <BRepFilletAPI_MakeFillet.hxx>
|
||||
#include <BRepAlgo_BooleanOperation.hxx>
|
||||
#include <BRepAlgo_Fuse.hxx>
|
||||
#include <BRepAlgo_Cut.hxx>
|
||||
#include <BiTgte_Blend.hxx>
|
||||
#include <TopOpeBRepBuild_HBuilder.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <BOPTools_DSFiller.hxx>
|
||||
#include <BRepAlgoAPI_BooleanOperation.hxx>
|
||||
#include <BRepAlgoAPI_Fuse.hxx>
|
||||
#include <BRepAlgoAPI_Cut.hxx>
|
||||
#include <BRepAlgoAPI_Section.hxx>
|
||||
|
||||
#include <FilletSurf_Builder.hxx>
|
||||
#include <ChFi3d_FilletShape.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <FilletSurf_StatusType.hxx>
|
||||
#include <FilletSurf_ErrorTypeStatus.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
//#define strcasecmp strcmp Already defined
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
//#endif
|
||||
|
||||
|
||||
static Standard_Real t3d = 1.e-4;
|
||||
static Standard_Real t2d = 1.e-5;
|
||||
static Standard_Real ta = 1.e-2;
|
||||
static Standard_Real fl = 1.e-3;
|
||||
static Standard_Real tapp_angle = 1.e-2;
|
||||
static GeomAbs_Shape blend_cont = GeomAbs_C1;
|
||||
|
||||
static BRepFilletAPI_MakeFillet* Rakk = 0;
|
||||
static BRepFilletAPI_MakeFillet* Rake = 0;
|
||||
static char name[100];
|
||||
|
||||
|
||||
static Standard_Integer contblend(Draw_Interpretor& di, Standard_Integer narg, const char** a)
|
||||
{
|
||||
if(narg ==1) {
|
||||
//cout<<"tolerance angular of approximation : "<< tapp_angle <<endl;
|
||||
//cout<<"internal continuity : ";
|
||||
di<<"tolerance angular of approximation : "<< tapp_angle <<"\n";
|
||||
di<<"internal continuity : ";
|
||||
switch (blend_cont) {
|
||||
case GeomAbs_C0:
|
||||
//cout << ""<<endl;
|
||||
di << "C0"<<"\n";
|
||||
break;
|
||||
case GeomAbs_C1:
|
||||
//cout << "C1"<<endl;
|
||||
di << "C1"<<"\n";
|
||||
break;
|
||||
case GeomAbs_C2:
|
||||
//cout << "C2"<<endl;
|
||||
di << "C2"<<"\n";
|
||||
break;
|
||||
#ifndef DEB
|
||||
default:
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (narg >3) return 1;
|
||||
if (narg == 3) { tapp_angle = Abs(atof(a[2])); }
|
||||
char c=a[1][1];
|
||||
switch (c) {
|
||||
case '0':
|
||||
blend_cont = GeomAbs_C0;
|
||||
break;
|
||||
case '2':
|
||||
blend_cont = GeomAbs_C2;
|
||||
break;
|
||||
default :
|
||||
blend_cont = GeomAbs_C1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void printtolblend(Draw_Interpretor& di)
|
||||
{
|
||||
//cout<<"tolerance ang : "<<ta<<endl;
|
||||
//cout<<"tolerance 3d : "<<t3d<<endl;
|
||||
//cout<<"tolerance 2d : "<<t2d<<endl;
|
||||
//cout<<"fleche : "<<fl<<endl;
|
||||
|
||||
//cout<<"tolblend "<<ta<<" "<<t3d<<" "<<t2d<<" "<<fl<<endl;
|
||||
|
||||
di<<"tolerance ang : "<<ta<<"\n";
|
||||
di<<"tolerance 3d : "<<t3d<<"\n";
|
||||
di<<"tolerance 2d : "<<t2d<<"\n";
|
||||
di<<"fleche : "<<fl<<"\n";
|
||||
|
||||
di<<"tolblend "<<ta<<" "<<t3d<<" "<<t2d<<" "<<fl<<"\n";
|
||||
}
|
||||
|
||||
static Standard_Integer tolblend(Draw_Interpretor& di, Standard_Integer narg, const char** a)
|
||||
{
|
||||
if(narg == 1){
|
||||
printtolblend(di);
|
||||
return 0;
|
||||
}
|
||||
else if(narg == 5){
|
||||
ta = atof(a[1]);
|
||||
t3d = atof(a[2]);
|
||||
t2d = atof(a[3]);
|
||||
fl = atof(a[4]);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
static Standard_Integer BLEND(Draw_Interpretor& di, Standard_Integer narg, const char** a)
|
||||
{
|
||||
if(Rakk != 0) {delete Rakk; Rakk = 0;}
|
||||
printtolblend(di);
|
||||
if (narg<5) return 1;
|
||||
TopoDS_Shape V = DBRep::Get(a[2]);
|
||||
if(V.IsNull()) return 1;
|
||||
ChFi3d_FilletShape FSh = ChFi3d_Rational;
|
||||
if (narg%2 == 0) {
|
||||
if (!strcasecmp(a[narg-1], "Q")) {
|
||||
FSh = ChFi3d_QuasiAngular;
|
||||
}
|
||||
else if (!strcasecmp(a[narg-1], "P")) {
|
||||
FSh = ChFi3d_Polynomial;
|
||||
}
|
||||
}
|
||||
Rakk = new BRepFilletAPI_MakeFillet(V,FSh);
|
||||
Rakk->SetParams(ta,t3d,t2d,t3d,t2d,fl);
|
||||
Rakk->SetContinuity(blend_cont, tapp_angle);
|
||||
Standard_Real Rad;
|
||||
TopoDS_Edge E;
|
||||
Standard_Integer nbedge = 0;
|
||||
for (Standard_Integer ii = 1; ii < (narg-1)/2; ii++){
|
||||
Rad = atof(a[2*ii + 1]);
|
||||
TopoDS_Shape aLocalEdge(DBRep::Get(a[(2*ii+2)],TopAbs_EDGE));
|
||||
E = TopoDS::Edge(aLocalEdge);
|
||||
// E = TopoDS::Edge(DBRep::Get(a[(2*ii+2)],TopAbs_EDGE));
|
||||
if(!E.IsNull()){
|
||||
Rakk->Add(Rad,E);
|
||||
nbedge++;
|
||||
}
|
||||
}
|
||||
if(!nbedge) return 1;
|
||||
Rakk->Build();
|
||||
if(!Rakk->IsDone()) return 1;
|
||||
TopoDS_Shape res = Rakk->Shape();
|
||||
DBRep::Set(a[1],res);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void PrintHist(const TopoDS_Shape& S,
|
||||
TopTools_ListIteratorOfListOfShape& It,
|
||||
Standard_Integer& nbgen)
|
||||
{
|
||||
TopoDS_Compound C;
|
||||
BRep_Builder B;
|
||||
B.MakeCompound(C);
|
||||
B.Add(C,S);
|
||||
char localname[100];
|
||||
if(nbgen<10){
|
||||
sprintf(localname,"generated_00%d", nbgen++);
|
||||
}
|
||||
else if(nbgen<100){
|
||||
sprintf(localname,"generated_0%d", nbgen++);
|
||||
}
|
||||
else {
|
||||
sprintf(localname,"generated_%d", nbgen++);
|
||||
}
|
||||
for(; It.More(); It.Next()){
|
||||
B.Add(C,It.Value());
|
||||
}
|
||||
DBRep::Set(localname,C);
|
||||
}
|
||||
|
||||
static Standard_Integer CheckHist(Draw_Interpretor& di,
|
||||
Standard_Integer ,
|
||||
const char** )
|
||||
{
|
||||
if(Rakk == 0) {
|
||||
//cout<<"Pas de Builder actif"<<endl;
|
||||
di<<"Pas de Builder actif"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
if(!Rakk->IsDone()) {
|
||||
//cout<<"Builder actif Not Done"<<endl;
|
||||
di<<"Builder actif Not Done"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
Standard_Integer nbc = Rakk->NbContours();
|
||||
Standard_Integer nbgen = 0;
|
||||
TopTools_ListIteratorOfListOfShape It;
|
||||
TopoDS_Shape curshape;
|
||||
for(Standard_Integer i = 1; i <= nbc; i++){
|
||||
curshape = Rakk->FirstVertex(i);
|
||||
It.Initialize(Rakk->Generated(curshape));
|
||||
PrintHist(curshape,It,nbgen);
|
||||
Standard_Integer nbe = Rakk->NbEdges(i);
|
||||
for(Standard_Integer j = 1; j <= nbe; j++){
|
||||
curshape = Rakk->Edge(i,j);
|
||||
It.Initialize(Rakk->Generated(curshape));
|
||||
PrintHist(curshape,It,nbgen);
|
||||
}
|
||||
curshape = Rakk->LastVertex(i);
|
||||
It.Initialize(Rakk->Generated(curshape));
|
||||
PrintHist(curshape,It,nbgen);
|
||||
}
|
||||
//cout<<"foreach g [lsort [dir gen*]] { wclick; puts [dname $g]; donl $g; }"<<endl;
|
||||
di<<"foreach g [lsort [dir gen*]] { wclick; puts [dname $g]; donl $g; }"<<"\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer MKEVOL(Draw_Interpretor& di,
|
||||
Standard_Integer narg,
|
||||
const char** a)
|
||||
{
|
||||
if(Rake != 0) {delete Rake; Rake = 0;}
|
||||
printtolblend(di);
|
||||
if (narg < 3) return 1;
|
||||
TopoDS_Shape V = DBRep::Get(a[2]);
|
||||
Rake = new BRepFilletAPI_MakeFillet(V);
|
||||
Rake->SetParams(ta,t3d,t2d,t3d,t2d,fl);
|
||||
Rake->SetContinuity(blend_cont, tapp_angle);
|
||||
if (narg == 4) {
|
||||
ChFi3d_FilletShape FSh = ChFi3d_Rational;
|
||||
if (!strcasecmp(a[3], "Q")) {
|
||||
FSh = ChFi3d_QuasiAngular;
|
||||
}
|
||||
else if (!strcasecmp(a[3], "P")) {
|
||||
FSh = ChFi3d_Polynomial;
|
||||
}
|
||||
Rake->SetFilletShape(FSh);
|
||||
}
|
||||
strcpy(name, a[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer UPDATEVOL(Draw_Interpretor& di,
|
||||
Standard_Integer narg,
|
||||
const char** a)
|
||||
{
|
||||
if(Rake == 0){
|
||||
//cout << "MakeFillet non initialise"<<endl;
|
||||
di << "MakeFillet non initialise"<<"\n";
|
||||
return 1 ;
|
||||
}
|
||||
if(narg%2 != 0 || narg < 4) return 1;
|
||||
TColgp_Array1OfPnt2d uandr(1,(narg/2)-1);
|
||||
Standard_Real Rad, Par;
|
||||
TopoDS_Shape aLocalEdge(DBRep::Get(a[1],TopAbs_EDGE));
|
||||
TopoDS_Edge E = TopoDS::Edge(aLocalEdge);
|
||||
// TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[1],TopAbs_EDGE));
|
||||
for (Standard_Integer ii = 1; ii <= (narg/2)-1; ii++){
|
||||
Par = atof(a[2*ii]);
|
||||
Rad = atof(a[2*ii + 1]);
|
||||
uandr.ChangeValue(ii).SetCoord(Par,Rad);
|
||||
}
|
||||
Rake->Add(uandr,E);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer BUILDEVOL(Draw_Interpretor& di,
|
||||
Standard_Integer,
|
||||
const char**)
|
||||
{
|
||||
if(Rake == 0){
|
||||
//cout << "MakeFillet non initialise"<<endl;
|
||||
di << "MakeFillet non initialise"<<"\n";
|
||||
return 1 ;
|
||||
}
|
||||
Rake->Build();
|
||||
if(Rake->IsDone()){
|
||||
TopoDS_Shape result = Rake->Shape();
|
||||
DBRep::Set(name,result);
|
||||
if(Rake != 0) {delete Rake; Rake = 0;}
|
||||
return 0;
|
||||
}
|
||||
if(Rake != 0) {delete Rake; Rake = 0;}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//**********************************************
|
||||
// commande des fusions et coupes avec conges *
|
||||
//**********************************************
|
||||
|
||||
Standard_Integer topoblend(Draw_Interpretor& di, Standard_Integer narg, const char** a)
|
||||
{
|
||||
printtolblend(di);
|
||||
if(narg != 5) return 1;
|
||||
Standard_Boolean fuse = !strcmp(a[0],"fubl");
|
||||
TopoDS_Shape S1 = DBRep::Get(a[2]);
|
||||
TopoDS_Shape S2 = DBRep::Get(a[3]);
|
||||
Standard_Real Rad = atof(a[4]);
|
||||
BRepAlgo_BooleanOperation* BC;
|
||||
if(fuse){
|
||||
BC = new BRepAlgo_Fuse(S1,S2);
|
||||
}
|
||||
else{
|
||||
BC = new BRepAlgo_Cut(S1,S2);
|
||||
}
|
||||
TopoDS_Shape ShapeCut = BC->Shape();
|
||||
|
||||
Handle(TopOpeBRepBuild_HBuilder) build = BC->Builder();
|
||||
TopTools_ListIteratorOfListOfShape its;
|
||||
|
||||
TopoDS_Compound result;
|
||||
BRep_Builder B;
|
||||
B.MakeCompound(result);
|
||||
|
||||
TopExp_Explorer ex;
|
||||
for (ex.Init(ShapeCut,TopAbs_SOLID); ex.More(); ex.Next()) {
|
||||
const TopoDS_Shape& cutsol = ex.Current();
|
||||
|
||||
BRepFilletAPI_MakeFillet fill(cutsol);
|
||||
fill.SetParams(ta,t3d,t2d,t3d,t2d,fl);
|
||||
fill.SetContinuity(blend_cont, tapp_angle);
|
||||
its = build->Section();
|
||||
while (its.More()) {
|
||||
TopoDS_Edge E = TopoDS::Edge(its.Value());
|
||||
fill.Add(Rad,E);
|
||||
its.Next();
|
||||
}
|
||||
|
||||
fill.Build();
|
||||
if(fill.IsDone()){
|
||||
B.Add(result,fill.Shape());
|
||||
}
|
||||
else {
|
||||
B.Add(result,cutsol);
|
||||
}
|
||||
}
|
||||
|
||||
delete BC;
|
||||
DBRep::Set(a[1],result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//**********************************************
|
||||
// bfuse or bcut and then blend the section
|
||||
//**********************************************
|
||||
|
||||
Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const char** a)
|
||||
{
|
||||
printtolblend(di);
|
||||
if(narg != 5) return 1;
|
||||
|
||||
Standard_Boolean fuse = !strcmp(a[0],"bfuseblend");
|
||||
TopoDS_Shape S1 = DBRep::Get(a[2]);
|
||||
TopoDS_Shape S2 = DBRep::Get(a[3]);
|
||||
if (S1.IsNull() || S2.IsNull()) {
|
||||
printf(" Null shapes are not allowed \n");
|
||||
return 1;
|
||||
}
|
||||
Standard_Real Rad = atof(a[4]);
|
||||
|
||||
BOPTools_DSFiller theDSFiller;
|
||||
|
||||
theDSFiller.SetShapes( S1, S2 );
|
||||
if (!theDSFiller.IsDone()) {
|
||||
printf("Check types of the arguments, please\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
theDSFiller.Perform();
|
||||
|
||||
BRepAlgoAPI_BooleanOperation* pBuilder=NULL;
|
||||
|
||||
if (fuse)
|
||||
pBuilder = new BRepAlgoAPI_Fuse( S1, S2, theDSFiller );
|
||||
else
|
||||
pBuilder = new BRepAlgoAPI_Cut ( S1, S2, theDSFiller );
|
||||
|
||||
Standard_Boolean anIsDone = pBuilder->IsDone();
|
||||
if (!anIsDone)
|
||||
{
|
||||
printf("boolean operation not done ErrorStatus()=%d\n", pBuilder->ErrorStatus());
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopoDS_Shape ResultOfBop = pBuilder->Shape();
|
||||
|
||||
delete pBuilder;
|
||||
pBuilder = new BRepAlgoAPI_Section( S1, S2, theDSFiller );
|
||||
TopoDS_Shape theSection = pBuilder->Shape();
|
||||
|
||||
TopoDS_Compound result;
|
||||
BRep_Builder BB;
|
||||
BB.MakeCompound(result);
|
||||
|
||||
TopExp_Explorer Explo( ResultOfBop, TopAbs_SOLID );
|
||||
for (; Explo.More(); Explo.Next())
|
||||
{
|
||||
const TopoDS_Shape& aSolid = Explo.Current();
|
||||
|
||||
BRepFilletAPI_MakeFillet Blender(aSolid);
|
||||
Blender.SetParams(ta,t3d,t2d,t3d,t2d,fl);
|
||||
Blender.SetContinuity( blend_cont, tapp_angle );
|
||||
|
||||
TopExp_Explorer expsec( theSection, TopAbs_EDGE );
|
||||
for (; expsec.More(); expsec.Next())
|
||||
{
|
||||
TopoDS_Edge anEdge = TopoDS::Edge(expsec.Current());
|
||||
Blender.Add( Rad, anEdge );
|
||||
}
|
||||
|
||||
Blender.Build();
|
||||
if (Blender.IsDone())
|
||||
BB.Add( result, Blender.Shape() );
|
||||
else
|
||||
BB.Add( result, aSolid );
|
||||
}
|
||||
|
||||
delete pBuilder;
|
||||
DBRep::Set( a[1], result );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static Standard_Integer blend1(Draw_Interpretor& di, Standard_Integer narg, const char** a)
|
||||
{
|
||||
if (narg<5) return 1;
|
||||
TopoDS_Shape V = DBRep::Get(a[2]);
|
||||
if(V.IsNull()) return 1;
|
||||
Standard_Integer nb ,i;
|
||||
Standard_Real Rad;
|
||||
Standard_Boolean simul=Standard_False;
|
||||
const char *ns0=(a[1]);
|
||||
Rad = atof(a[3]);
|
||||
TopTools_ListOfShape E;
|
||||
for (i=4; i <=(narg-1) ; i++){
|
||||
TopoDS_Shape edge= DBRep::Get(a[i],TopAbs_EDGE);
|
||||
if (edge.IsNull()) return 1 ;
|
||||
if(edge.ShapeType()!=TopAbs_EDGE) return 1;
|
||||
E.Append(edge);
|
||||
}
|
||||
FilletSurf_Builder Rakk(V,E,Rad);
|
||||
if (simul) Rakk.Simulate();
|
||||
else Rakk.Perform();
|
||||
|
||||
//if (Rakk.IsDone()==FilletSurf_IsNotOk)
|
||||
// { FilletSurf_ErrorTypeStatus err=Rakk.StatusError();
|
||||
// if (err==FilletSurf_EmptyList) cout<< "StatusError=EmptyList"<<endl;
|
||||
// else if (err==FilletSurf_EdgeNotG1) cout<< "StatusError=NotG1"<<endl;
|
||||
// else if (err==FilletSurf_FacesNotG1) cout<< "StatusError=facesNotG1"<<endl;
|
||||
// else if (err==FilletSurf_EdgeNotOnShape)
|
||||
// cout<< "StatusError=edgenotonshape"<<endl;
|
||||
// else if (err==FilletSurf_NotSharpEdge ) cout<< "StatusError=notsharpedge"<<endl;
|
||||
// else if (err==FilletSurf_PbFilletCompute) cout <<"StatusError=PBFillet"<<endl;
|
||||
// }
|
||||
// else {
|
||||
// if (Rakk.IsDone()==FilletSurf_IsPartial) cout <<"resultat partiel"<<endl;
|
||||
if (Rakk.IsDone()==FilletSurf_IsNotOk)
|
||||
{ FilletSurf_ErrorTypeStatus err=Rakk.StatusError();
|
||||
if (err==FilletSurf_EmptyList) di<< "StatusError=EmptyList"<<"\n";
|
||||
else if (err==FilletSurf_EdgeNotG1) di<< "StatusError=NotG1"<<"\n";
|
||||
else if (err==FilletSurf_FacesNotG1) di<< "StatusError=facesNotG1"<<"\n";
|
||||
else if (err==FilletSurf_EdgeNotOnShape)
|
||||
di<< "StatusError=edgenotonshape"<<"\n";
|
||||
else if (err==FilletSurf_NotSharpEdge ) di<< "StatusError=notsharpedge"<<"\n";
|
||||
else if (err==FilletSurf_PbFilletCompute) di <<"StatusError=PBFillet"<<"\n";
|
||||
}
|
||||
else {
|
||||
if (Rakk.IsDone()==FilletSurf_IsPartial) di <<"resultat partiel"<<"\n";
|
||||
|
||||
nb=Rakk.NbSurface();
|
||||
char localname [100];
|
||||
char *temp;
|
||||
|
||||
// affichage du type d'arret
|
||||
|
||||
if (!simul)
|
||||
{
|
||||
//if (Rakk.StartSectionStatus()==FilletSurf_NoExtremityOnEdge)
|
||||
// {cout<<" type deb conges = WLBLOUT"<<endl;}
|
||||
//else if (Rakk.StartSectionStatus()==FilletSurf_OneExtremityOnEdge )
|
||||
// { cout<<" type deb conges = WLBLSTOP"<<endl;}
|
||||
//else if (Rakk.StartSectionStatus()==FilletSurf_TwoExtremityOnEdge)
|
||||
// {cout<<" type deb conges = WLBLEND"<<endl;}
|
||||
if (Rakk.StartSectionStatus()==FilletSurf_NoExtremityOnEdge)
|
||||
{di<<" type deb conges = WLBLOUT"<<"\n";}
|
||||
else if (Rakk.StartSectionStatus()==FilletSurf_OneExtremityOnEdge )
|
||||
{ di<<" type deb conges = WLBLSTOP"<<"\n";}
|
||||
else if (Rakk.StartSectionStatus()==FilletSurf_TwoExtremityOnEdge)
|
||||
{di<<" type deb conges = WLBLEND"<<"\n";}
|
||||
|
||||
//if (Rakk.EndSectionStatus()==FilletSurf_NoExtremityOnEdge)
|
||||
// {cout<<" type fin conges = WLBLOUT"<<endl;}
|
||||
//else if (Rakk.EndSectionStatus()==FilletSurf_OneExtremityOnEdge)
|
||||
// {cout<<" type fin conges = WLBLSTOP"<<endl;}
|
||||
//else if (Rakk.EndSectionStatus()==FilletSurf_TwoExtremityOnEdge)
|
||||
// { cout<<" type fin conges = WLBLEND"<<endl;}
|
||||
if (Rakk.EndSectionStatus()==FilletSurf_NoExtremityOnEdge)
|
||||
{di<<" type fin conges = WLBLOUT"<<"\n";}
|
||||
else if (Rakk.EndSectionStatus()==FilletSurf_OneExtremityOnEdge)
|
||||
{di<<" type fin conges = WLBLSTOP"<<"\n";}
|
||||
else if (Rakk.EndSectionStatus()==FilletSurf_TwoExtremityOnEdge)
|
||||
{ di<<" type fin conges = WLBLEND"<<"\n";}
|
||||
Standard_Real f,l;
|
||||
f = Rakk.FirstParameter();
|
||||
l = Rakk.LastParameter();
|
||||
//cout<<"parametre sur edge debut : "<<f<<endl;
|
||||
//cout<<"parametre sur edge fin : "<<l<<endl;
|
||||
di<<"parametre sur edge debut : "<<f<<"\n";
|
||||
di<<"parametre sur edge fin : "<<l<<"\n";
|
||||
for (i=1;i<=nb;i++){
|
||||
//precision
|
||||
//cout<<"precision "<< i << "= "<<Rakk.TolApp3d(i)<<endl;
|
||||
di<<"precision "<< i << "= "<<Rakk.TolApp3d(i)<<"\n";
|
||||
|
||||
// affichage des surfaces resultats
|
||||
sprintf(localname, "%s%d" ,ns0,i);
|
||||
temp = localname;
|
||||
DrawTrSurf::Set(temp,Rakk.SurfaceFillet(i));
|
||||
di << localname<< " ";
|
||||
|
||||
//affichage des courbes 3d
|
||||
sprintf(localname, "%s%d" ,"courb1",i);
|
||||
temp =localname;
|
||||
DrawTrSurf::Set(temp,Rakk.CurveOnFace1(i));
|
||||
di << localname<< " ";
|
||||
sprintf(localname, "%s%d" ,"courb2",i);
|
||||
temp =localname;
|
||||
DrawTrSurf::Set(temp,Rakk.CurveOnFace2(i));
|
||||
di << localname<< " ";
|
||||
|
||||
// affichage des supports
|
||||
sprintf(localname, "%s%d" ,"face1",i);
|
||||
temp =localname ;
|
||||
DBRep::Set(temp,Rakk.SupportFace1(i));
|
||||
di << localname<< " ";
|
||||
sprintf(localname, "%s%d" ,"face2",i);
|
||||
temp =localname;
|
||||
DBRep::Set(temp,Rakk.SupportFace2(i));
|
||||
di << localname<< " ";
|
||||
|
||||
// affichage des Pcurve sur les faces
|
||||
sprintf(localname, "%s%d" ,"pcurveonface1",i);
|
||||
temp =localname ;
|
||||
DrawTrSurf::Set(temp,Rakk.PCurveOnFace1(i));
|
||||
di << localname<< " ";
|
||||
sprintf(localname, "%s%d" ,"pcurveonface2",i);
|
||||
temp =localname;
|
||||
DrawTrSurf::Set(temp,Rakk.PCurveOnFace2(i));
|
||||
di << localname<< " ";
|
||||
|
||||
// affichage des Pcurve sur le conge
|
||||
sprintf(localname, "%s%d" ,"pcurveonconge1",i);
|
||||
temp =localname;
|
||||
DrawTrSurf::Set(temp,Rakk.PCurve1OnFillet(i));
|
||||
di << localname<< " ";
|
||||
sprintf(localname, "%s%d" ,"pcurveonconge2",i);
|
||||
temp =localname;
|
||||
DrawTrSurf::Set(temp,Rakk.PCurve2OnFillet(i));
|
||||
di << localname<< " ";
|
||||
|
||||
} }
|
||||
else{
|
||||
Standard_Integer j;
|
||||
|
||||
for (i=1;i<=nb;i++)
|
||||
{Standard_Integer s=Rakk.NbSection(i);
|
||||
for (j=1;j<=s;j++)
|
||||
{Handle(Geom_TrimmedCurve Sec);
|
||||
Rakk.Section(i,j,Sec);
|
||||
sprintf(localname, "%s%d%d" ,"sec",i,j);
|
||||
temp =localname;
|
||||
DrawTrSurf::Set (temp,Sec);
|
||||
di << localname<< " ";}
|
||||
}}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : rollingball
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer rollingball(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n < 2) return 1;
|
||||
|
||||
TopoDS_Shape S = DBRep::Get(a[2]);
|
||||
if ( S.IsNull()) return 1;
|
||||
Standard_Real Rad = atof(a[3]);
|
||||
|
||||
Standard_Real Tol = t3d; //le meme que blend ! 1.e-7;
|
||||
|
||||
BiTgte_Blend Roll;
|
||||
Roll.Init(S,Rad,Tol,Standard_False);
|
||||
|
||||
Standard_Integer Nb = 0;
|
||||
for ( Standard_Integer i = 4; i <= n-1; i++) {
|
||||
if ( !strcmp(a[i],"@")) {
|
||||
Nb++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( Nb == 0) { // on recupere les faces d'arret.
|
||||
TopoDS_Shape aLocalFace(DBRep::Get(a[i],TopAbs_FACE));
|
||||
TopoDS_Face F1 = TopoDS::Face(aLocalFace);
|
||||
// TopoDS_Face F1 = TopoDS::Face(DBRep::Get(a[i],TopAbs_FACE));
|
||||
if ( F1.IsNull()) {
|
||||
//cout << " Face d'arret non reperee." << endl;
|
||||
di << " Face d'arret non reperee." << "\n";
|
||||
return 1;
|
||||
}
|
||||
Roll.SetStoppingFace(F1);
|
||||
}
|
||||
else if (Nb == 1) { // on recupere les faces sur lesquelles la bille roule
|
||||
TopoDS_Shape aLocalFace(DBRep::Get(a[i],TopAbs_FACE));
|
||||
TopoDS_Face F1 = TopoDS::Face(aLocalFace);
|
||||
// TopoDS_Face F1 = TopoDS::Face(DBRep::Get(a[i],TopAbs_FACE));
|
||||
i++;
|
||||
if ( !strcmp(a[i],"@")) {
|
||||
//cout << " Il faut un nombre pair de faces d'appui de la bille" << endl;
|
||||
di << " Il faut un nombre pair de faces d'appui de la bille" << "\n";
|
||||
return 1;
|
||||
}
|
||||
aLocalFace = DBRep::Get(a[i],TopAbs_FACE);
|
||||
TopoDS_Face F2 = TopoDS::Face(aLocalFace);
|
||||
// TopoDS_Face F2 = TopoDS::Face(DBRep::Get(a[i],TopAbs_FACE));
|
||||
if ( F1.IsNull() || F2.IsNull()) {
|
||||
//cout << " Face d'appui non reperee." << endl;
|
||||
di << " Face d'appui non reperee." << "\n";
|
||||
return 1;
|
||||
}
|
||||
Roll.SetFaces(F1,F2);
|
||||
}
|
||||
else if (Nb == 2) { // on recupere l'arete sur laquelle la bille roule
|
||||
TopoDS_Shape aLocalShape(DBRep::Get(a[i],TopAbs_EDGE));
|
||||
TopoDS_Edge E = TopoDS::Edge(aLocalShape);
|
||||
// TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[i],TopAbs_EDGE));
|
||||
if ( E.IsNull()) {
|
||||
//cout << " Edge non repere." << endl;
|
||||
di << " Edge non repere." << "\n";
|
||||
return 1;
|
||||
}
|
||||
Roll.SetEdge(E);
|
||||
}
|
||||
|
||||
}
|
||||
Standard_Boolean BuildShape = (!strcmp(a[0],"brollingball"));
|
||||
|
||||
Roll.Perform(BuildShape);
|
||||
|
||||
Standard_Boolean ComputeBranches = (!strcmp(a[0],"trollingball"));
|
||||
char localname[100];
|
||||
if (ComputeBranches) {
|
||||
Standard_Integer NbBranches = Roll.NbBranches();
|
||||
for (Standard_Integer i = 1; i <= NbBranches; i++) {
|
||||
Standard_Integer From,To;
|
||||
Roll.IndicesOfBranche(i,From,To);
|
||||
//cout << " Indices de la " << i << "eme Branche : ";
|
||||
//cout << " " << From << " " << To << endl;
|
||||
di << " Indices de la " << i << "eme Branche : ";
|
||||
di << " " << From << " " << To << "\n";
|
||||
for (Standard_Integer j = From; j <= To; j++) {
|
||||
const TopoDS_Shape& CurF = Roll.Face(j);
|
||||
sprintf(localname,"%s_%d_%d",a[1],i,j);
|
||||
DBRep::Set(localname,CurF);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
DBRep::Set(a[1],Roll.Shape());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FilletCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::FilletCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
|
||||
const char* g = "TOPOLOGY Fillet construction commands";
|
||||
|
||||
theCommands.Add("continuityblend",
|
||||
"continuityblend C0/C1/C2 [tangle]",__FILE__,
|
||||
contblend,g);
|
||||
|
||||
theCommands.Add("tolblend",
|
||||
"tolblend [ta t3d t2d fl]",__FILE__,
|
||||
tolblend,g);
|
||||
|
||||
theCommands.Add("blend",
|
||||
"blend result object rad1 ed1 rad2 ed2 ... [R/Q/P]",__FILE__,
|
||||
BLEND,g);
|
||||
|
||||
theCommands.Add("checkhist",
|
||||
"checkhist",__FILE__,
|
||||
CheckHist,g);
|
||||
|
||||
theCommands.Add("mkevol",
|
||||
"mkevol result object (then use updatevol) [R/Q/P]",__FILE__,
|
||||
MKEVOL,g);
|
||||
|
||||
theCommands.Add("updatevol",
|
||||
"updatevol edge u1 rad1 u2 rad2 ...",__FILE__,
|
||||
UPDATEVOL,g);
|
||||
|
||||
theCommands.Add("buildevol",
|
||||
"buildevol end of the evol fillet computation",__FILE__,
|
||||
BUILDEVOL,g);
|
||||
|
||||
theCommands.Add("fubl",
|
||||
"fubl result shape1 shape2 radius",__FILE__,
|
||||
topoblend,g);
|
||||
|
||||
theCommands.Add("cubl",
|
||||
"cubl result shape tool radius",__FILE__,
|
||||
topoblend,g);
|
||||
|
||||
theCommands.Add("bfuseblend",
|
||||
"bfuseblend result shape1 shape2 radius",__FILE__,
|
||||
boptopoblend,g);
|
||||
|
||||
theCommands.Add("bcutblend",
|
||||
"bcutblend result shape tool radius",__FILE__,
|
||||
boptopoblend,g);
|
||||
|
||||
theCommands.Add("blend1",
|
||||
"blend1 result object rad ed1 ed2 ...",__FILE__,
|
||||
blend1,g);
|
||||
|
||||
theCommands.Add("rollingball",
|
||||
"rollingball r S radius [stopf1 ..] @ [f1 f2 ..] @ [e1 ..]",
|
||||
__FILE__,
|
||||
rollingball);
|
||||
|
||||
theCommands.Add("brollingball",
|
||||
"brollingball r S radius [stopf1 ..] @ [f1 f2 ..] @ [e1 ..]",
|
||||
__FILE__,
|
||||
rollingball);
|
||||
|
||||
theCommands.Add("trollingball",
|
||||
"trollingball r S radius [stopf1 ..] @ [f1 f2 ..] @ [e1 ..]",
|
||||
__FILE__,
|
||||
rollingball);
|
||||
}
|
737
src/BRepTest/BRepTest_FillingCommands.cxx
Executable file
737
src/BRepTest/BRepTest_FillingCommands.cxx
Executable file
@@ -0,0 +1,737 @@
|
||||
// File: BRepTest_FillingCommands.cxx
|
||||
// Created: Wed Jul 10 13:23:02 1996
|
||||
// Author: Xavier BENVENISTE
|
||||
// <xab@mentox.paris1.matra-dtv.fr>
|
||||
// Modified: Wed Mar 5 09:45:42 1997
|
||||
// by: Joelle CHAUVET
|
||||
// G1134 : new command "approxplate"
|
||||
// Modified: Thu Jun 12 16:51:36 1997
|
||||
// by: Jerome LEMONIER
|
||||
// Mise a jour suite a la modification des methodes Curves2d
|
||||
// et Sense GeomPlate_BuildPlateSurface.
|
||||
// Modified: Mon Nov 3 10:24:07 1997
|
||||
// Author: Joelle CHAUVET
|
||||
// utilisation de BRepFill_CurveConstraint
|
||||
|
||||
|
||||
|
||||
#include <GeometryTest.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <BRepAdaptor_HSurface.hxx>
|
||||
#include <BRepAdaptor_HCurve2d.hxx>
|
||||
#include <BRepAdaptor_HCurve.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
#include <BRepAdaptor_Curve2d.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepTest.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Adaptor3d_HCurveOnSurface.hxx>
|
||||
#include <Adaptor3d_CurveOnSurface.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include <BRepLib.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <GeomPlate_BuildPlateSurface.hxx>
|
||||
#include <GeomPlate_BuildAveragePlane.hxx>
|
||||
#include <GeomPlate_Surface.hxx>
|
||||
#include <GeomPlate_BuildAveragePlane.hxx>
|
||||
#include <GeomPlate_HArray1OfHCurveOnSurface.hxx>
|
||||
|
||||
#include <GeomPlate_MakeApprox.hxx>
|
||||
#include <GeomPlate_PlateG0Criterion.hxx>
|
||||
#include <GeomPlate_PlateG1Criterion.hxx>
|
||||
#include <BRepFill_CurveConstraint.hxx>
|
||||
#include <GeomPlate_PointConstraint.hxx>
|
||||
#include <GeomAdaptor_HSurface.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepBuilderAPI_WireError.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <TColGeom2d_HArray1OfCurve.hxx>
|
||||
|
||||
#include <AdvApp2Var_ApproxAFunc2Var.hxx>
|
||||
#include <AdvApp2Var_Context.hxx>
|
||||
#include <AdvApprox_PrefCutting.hxx>
|
||||
#include <AdvApprox_Cutting.hxx>
|
||||
#include <AdvApprox_DichoCutting.hxx>
|
||||
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
|
||||
#include <TColgp_SequenceOfXY.hxx>
|
||||
#include <TColgp_SequenceOfXYZ.hxx>
|
||||
|
||||
#include <BRepAdaptor_HCurve.hxx>
|
||||
#include <Adaptor3d_HIsoCurve.hxx>
|
||||
|
||||
#include <Extrema_ExtPS.hxx>
|
||||
#include <Extrema_POnSurf.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <BRepOffsetAPI_MakeFilling.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <GeomConvert_ApproxSurface.hxx>
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
// pour mes tests
|
||||
#ifdef DEB
|
||||
#include <OSD_Chronometer.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#endif
|
||||
|
||||
const Standard_Integer defDegree = 3;
|
||||
const Standard_Integer defNbPtsOnCur = 10;
|
||||
const Standard_Integer defNbIter = 3;
|
||||
const Standard_Boolean defAnisotropie = Standard_False;
|
||||
const Standard_Real defTol2d = 0.00001;
|
||||
const Standard_Real defTol3d = 0.0001;
|
||||
const Standard_Real defTolAng = 0.01;
|
||||
const Standard_Real defTolCurv = 0.1;
|
||||
const Standard_Integer defMaxDeg = 8;
|
||||
const Standard_Integer defMaxSegments = 9;
|
||||
|
||||
Standard_Integer Degree = defDegree;
|
||||
Standard_Integer NbPtsOnCur = defNbPtsOnCur ;
|
||||
Standard_Integer NbIter = defNbIter;
|
||||
Standard_Boolean Anisotropie = defAnisotropie ;
|
||||
Standard_Real Tol2d = defTol2d;
|
||||
Standard_Real Tol3d = defTol3d;
|
||||
Standard_Real TolAng = defTolAng;
|
||||
Standard_Real TolCurv = defTolCurv;
|
||||
Standard_Integer MaxDeg = defMaxDeg;
|
||||
Standard_Integer MaxSegments = defMaxSegments;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// commande plate : resultat face sur surface plate
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Standard_Integer plate (Draw_Interpretor & di,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 8 ) return 1;
|
||||
Standard_Integer NbCurFront=atoi(a[3]);
|
||||
Handle(GeomPlate_HArray1OfHCurveOnSurface) Fronts = new GeomPlate_HArray1OfHCurveOnSurface(1,NbCurFront);
|
||||
Handle(TColStd_HArray1OfInteger) Tang = new TColStd_HArray1OfInteger(1,NbCurFront);
|
||||
Handle(TColStd_HArray1OfInteger) NbPtsCur = new TColStd_HArray1OfInteger(1,NbCurFront);
|
||||
BRep_Builder B;
|
||||
|
||||
GeomPlate_BuildPlateSurface Henri(3,15,2);
|
||||
|
||||
Standard_Integer i;
|
||||
for (i=1; i<=NbCurFront ; i++) {
|
||||
TopoDS_Shape aLocalEdge(DBRep::Get(a[3*i+1],TopAbs_EDGE));
|
||||
TopoDS_Edge E = TopoDS::Edge(aLocalEdge);
|
||||
// TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[3*i+1],TopAbs_EDGE));
|
||||
if(E.IsNull()) return 1;
|
||||
TopoDS_Shape aLocalFace(DBRep::Get(a[3*i+2],TopAbs_FACE));
|
||||
TopoDS_Face F = TopoDS::Face(aLocalFace);
|
||||
// TopoDS_Face F = TopoDS::Face(DBRep::Get(a[3*i+2],TopAbs_FACE));
|
||||
if(F.IsNull()) return 1;
|
||||
Standard_Integer T = atoi(a[3*i+3]);
|
||||
Tang->SetValue(i,T);
|
||||
NbPtsCur->SetValue(i,atoi(a[2]));
|
||||
Handle(BRepAdaptor_HSurface) S = new BRepAdaptor_HSurface();
|
||||
S->ChangeSurface().Initialize(F);
|
||||
Handle(BRepAdaptor_HCurve2d) C = new BRepAdaptor_HCurve2d();
|
||||
C->ChangeCurve2d().Initialize(E,F);
|
||||
Adaptor3d_CurveOnSurface ConS(C,S);
|
||||
Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
|
||||
Fronts->SetValue(i,HConS);
|
||||
Handle(BRepFill_CurveConstraint) Cont
|
||||
= new BRepFill_CurveConstraint(HConS,
|
||||
Tang->Value(i),
|
||||
NbPtsCur->Value(i));
|
||||
Henri.Add(Cont);
|
||||
}
|
||||
|
||||
Henri.Perform();
|
||||
|
||||
Standard_Real ErrG0 = 1.1*Henri.G0Error();
|
||||
//cout<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<endl;
|
||||
di<<" dist. max = "<<Henri.G0Error()<<" ; angle max = "<<Henri.G1Error()<<"\n";
|
||||
|
||||
BRepBuilderAPI_MakeWire MW;
|
||||
for (i=1 ; i<=NbCurFront ; i++) {
|
||||
Standard_Integer iInOrder=Henri.Order()->Value(i);
|
||||
TopoDS_Edge E;
|
||||
if (Henri.Sense()->Value(iInOrder)==1) {
|
||||
BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
|
||||
Henri.Surface(),
|
||||
Fronts->Value(iInOrder)->LastParameter(),
|
||||
Fronts->Value(iInOrder)->FirstParameter());
|
||||
E = ME.Edge();
|
||||
|
||||
}
|
||||
else {
|
||||
BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
|
||||
Henri.Surface(),
|
||||
Fronts->Value(iInOrder)->FirstParameter(),
|
||||
Fronts->Value(iInOrder)->LastParameter());
|
||||
E = ME.Edge();
|
||||
}
|
||||
B.UpdateVertex(TopExp::FirstVertex(E), ErrG0);
|
||||
B.UpdateVertex(TopExp::LastVertex(E), ErrG0);
|
||||
BRepLib::BuildCurve3d(E);
|
||||
char name[100];
|
||||
sprintf(name,"Edge_%d", i);
|
||||
DBRep::Set(name, E);
|
||||
MW.Add(E);
|
||||
if (MW.IsDone()==Standard_False) {
|
||||
#if DEB
|
||||
BRepBuilderAPI_WireError err =
|
||||
#endif
|
||||
MW.Error();
|
||||
Standard_Failure::Raise("mkWire is over ");
|
||||
}
|
||||
|
||||
}
|
||||
TopoDS_Wire W;
|
||||
W=MW.Wire();
|
||||
if (!(W.Closed())) Standard_Failure::Raise("Wire is not closed");
|
||||
BRepBuilderAPI_MakeFace MF(Henri.Surface(),W,Standard_True);
|
||||
DBRep::Set(a[1],MF.Face());
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// commande gplate : resultat face egale a la surface approchee
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 6 ) return 1;
|
||||
Standard_Integer NbCurFront=atoi(a[2]),
|
||||
NbPointConstraint=atoi(a[3]);
|
||||
|
||||
GeomPlate_BuildPlateSurface Henri(3,15,2);
|
||||
|
||||
Standard_Integer i;
|
||||
Standard_Integer Conti;
|
||||
Standard_Integer Indice=4;
|
||||
//Surface d'init
|
||||
TopoDS_Shape aLocalFace(DBRep::Get(a[Indice++],TopAbs_FACE));
|
||||
TopoDS_Face SI = TopoDS::Face(aLocalFace);
|
||||
// TopoDS_Face SI = TopoDS::Face(DBRep::Get(a[Indice++],TopAbs_FACE));
|
||||
if(SI.IsNull())
|
||||
Indice--;
|
||||
else
|
||||
{ Handle(BRepAdaptor_HSurface) HSI = new BRepAdaptor_HSurface();
|
||||
HSI->ChangeSurface().Initialize(SI);
|
||||
Henri.LoadInitSurface( BRep_Tool::Surface(HSI->ChangeSurface().Face()));
|
||||
}
|
||||
for (i=1; i<=NbCurFront ; i++) {
|
||||
TopoDS_Shape aLocalShape(DBRep::Get(a[Indice++],TopAbs_EDGE));
|
||||
TopoDS_Edge E = TopoDS::Edge(aLocalShape);
|
||||
// TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[Indice++],TopAbs_EDGE));
|
||||
if(E.IsNull()) return 1;
|
||||
Conti=atoi(a[Indice++]);
|
||||
if ((Conti==0)||(Conti==-1))
|
||||
{ Handle(BRepAdaptor_HCurve) C = new BRepAdaptor_HCurve();
|
||||
C->ChangeCurve().Initialize(E);
|
||||
Handle(BRepFill_CurveConstraint) Cont= new BRepFill_CurveConstraint(C,Conti);
|
||||
Henri.Add(Cont);
|
||||
}
|
||||
else
|
||||
{
|
||||
aLocalFace = DBRep::Get(a[Indice++],TopAbs_FACE);
|
||||
TopoDS_Face F = TopoDS::Face(aLocalFace);
|
||||
// TopoDS_Face F = TopoDS::Face(DBRep::Get(a[Indice++],TopAbs_FACE));
|
||||
if(F.IsNull())
|
||||
return 1;
|
||||
Handle(BRepAdaptor_HSurface) S = new BRepAdaptor_HSurface();
|
||||
S->ChangeSurface().Initialize(F);
|
||||
Handle(BRepAdaptor_HCurve2d) C = new BRepAdaptor_HCurve2d();
|
||||
C->ChangeCurve2d().Initialize(E,F);
|
||||
Adaptor3d_CurveOnSurface ConS(C,S);
|
||||
Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
|
||||
Handle(BRepFill_CurveConstraint) Cont= new BRepFill_CurveConstraint(HConS,Conti);
|
||||
Henri.Add(Cont);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=1; i<=NbPointConstraint ; i++)
|
||||
{
|
||||
// gp_Pnt P1,P2,P3;
|
||||
gp_Pnt P1;
|
||||
// gp_Vec V1,V2,V3,V4,V5;
|
||||
|
||||
if (DrawTrSurf::GetPoint(a[Indice], P1) )
|
||||
{ Conti=0;
|
||||
Handle(GeomPlate_PointConstraint) PCont= new GeomPlate_PointConstraint(P1,0);
|
||||
Henri.Add(PCont);
|
||||
Indice++;
|
||||
}
|
||||
else
|
||||
{ Standard_Real u=atof(a[Indice++]),
|
||||
v=atof(a[Indice++]);
|
||||
|
||||
Conti=atoi(a[Indice++]);
|
||||
aLocalFace = DBRep::Get(a[Indice++],TopAbs_FACE);
|
||||
TopoDS_Face F = TopoDS::Face(aLocalFace);
|
||||
// TopoDS_Face F = TopoDS::Face(DBRep::Get(a[Indice++],TopAbs_FACE));
|
||||
if(F.IsNull())
|
||||
return 1;
|
||||
Handle(BRepAdaptor_HSurface) HF = new BRepAdaptor_HSurface();
|
||||
HF->ChangeSurface().Initialize(F);
|
||||
Handle(GeomPlate_PointConstraint) PCont= new GeomPlate_PointConstraint(u,v,BRep_Tool::Surface(HF->ChangeSurface().Face()),Conti,0.001,0.001,0.001);
|
||||
Henri.Add(PCont);
|
||||
}
|
||||
}
|
||||
Henri.Perform();
|
||||
Standard_Integer nbcarreau=9;
|
||||
Standard_Integer degmax=8;
|
||||
Standard_Real seuil;
|
||||
|
||||
Handle(GeomPlate_Surface) gpPlate = Henri.Surface();
|
||||
TColgp_SequenceOfXY S2d;
|
||||
TColgp_SequenceOfXYZ S3d;
|
||||
S2d.Clear();
|
||||
S3d.Clear();
|
||||
Henri.Disc2dContour(4,S2d);
|
||||
Henri.Disc3dContour(4,0,S3d);
|
||||
seuil = Max(0.0001,10*Henri.G0Error());
|
||||
GeomPlate_PlateG0Criterion critere (S2d,S3d,seuil);
|
||||
GeomPlate_MakeApprox Mapp(gpPlate,critere,0.0001,nbcarreau,degmax);
|
||||
Handle (Geom_Surface) Surf (Mapp.Surface());
|
||||
|
||||
Standard_Real Umin, Umax, Vmin, Vmax;
|
||||
|
||||
Henri.Surface()->Bounds( Umin, Umax, Vmin, Vmax);
|
||||
|
||||
BRepBuilderAPI_MakeFace MF(Surf,Umin, Umax, Vmin, Vmax);
|
||||
|
||||
DBRep::Set(a[1],MF.Face());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// commande approxplate : resultat face sur surface approchee
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Standard_Integer approxplate (Draw_Interpretor & di,Standard_Integer n,const char** a)
|
||||
{
|
||||
if (n < 9 ) return 1;
|
||||
Standard_Integer NbMedium=atoi(a[2]);
|
||||
Standard_Integer NbCurFront=atoi(a[3]);
|
||||
Handle(GeomPlate_HArray1OfHCurveOnSurface) Fronts = new GeomPlate_HArray1OfHCurveOnSurface(1,NbCurFront);
|
||||
Handle(TColStd_HArray1OfInteger) Tang = new TColStd_HArray1OfInteger(1,NbCurFront);
|
||||
Handle(TColStd_HArray1OfInteger) NbPtsCur = new TColStd_HArray1OfInteger(1,NbCurFront);
|
||||
|
||||
GeomPlate_BuildPlateSurface Henri(3,15,2);
|
||||
|
||||
Standard_Integer i;
|
||||
for (i=1; i<=NbCurFront ; i++) {
|
||||
TopoDS_Shape aLocalShape(DBRep::Get(a[3*i+1],TopAbs_EDGE));
|
||||
TopoDS_Edge E = TopoDS::Edge(aLocalShape);
|
||||
// TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[3*i+1],TopAbs_EDGE));
|
||||
if(E.IsNull()) return 1;
|
||||
TopoDS_Shape aLocalFace(DBRep::Get(a[3*i+2],TopAbs_FACE));
|
||||
TopoDS_Face F = TopoDS::Face(aLocalFace);
|
||||
// TopoDS_Face F = TopoDS::Face(DBRep::Get(a[3*i+2],TopAbs_FACE));
|
||||
if(F.IsNull()) return 1;
|
||||
Standard_Integer T = atoi(a[3*i+3]);
|
||||
Tang->SetValue(i,T);
|
||||
NbPtsCur->SetValue(i,NbMedium);
|
||||
Handle(BRepAdaptor_HSurface) S = new BRepAdaptor_HSurface();
|
||||
S->ChangeSurface().Initialize(F);
|
||||
Handle(BRepAdaptor_HCurve2d) C = new BRepAdaptor_HCurve2d();
|
||||
C->ChangeCurve2d().Initialize(E,F);
|
||||
Adaptor3d_CurveOnSurface ConS(C,S);
|
||||
Handle (Adaptor3d_HCurveOnSurface) HConS = new Adaptor3d_HCurveOnSurface(ConS);
|
||||
Fronts->SetValue(i,HConS);
|
||||
Handle(BRepFill_CurveConstraint) Cont
|
||||
= new BRepFill_CurveConstraint(HConS,
|
||||
Tang->Value(i),
|
||||
NbPtsCur->Value(i));
|
||||
Henri.Add(Cont);
|
||||
}
|
||||
|
||||
Henri.Perform();
|
||||
|
||||
Standard_Real dmax = Henri.G0Error(),
|
||||
anmax = Henri.G1Error();
|
||||
//cout<<" dist. max = "<<dmax<<" ; angle max = "<<anmax<<endl;
|
||||
di<<" dist. max = "<<dmax<<" ; angle max = "<<anmax<<"\n";
|
||||
|
||||
Tol3d = atof(a[3*NbCurFront+4]);
|
||||
Standard_Integer Nbmax = atoi(a[3*NbCurFront+5]);
|
||||
Standard_Integer degmax = atoi(a[3*NbCurFront+6]);
|
||||
Standard_Integer CritOrder = atoi(a[3*NbCurFront+7]);
|
||||
Handle(GeomPlate_Surface) surf = Henri.Surface();
|
||||
Handle(Geom_BSplineSurface) support;
|
||||
|
||||
if (CritOrder==-1) {
|
||||
GeomPlate_MakeApprox MApp(surf,Tol3d,Nbmax,degmax,dmax,-1);
|
||||
support = MApp.Surface();
|
||||
}
|
||||
else if (CritOrder>=0) {
|
||||
TColgp_SequenceOfXY S2d;
|
||||
TColgp_SequenceOfXYZ S3d;
|
||||
S2d.Clear();
|
||||
S3d.Clear();
|
||||
Standard_Real seuil;
|
||||
if (CritOrder==0) {
|
||||
Henri.Disc2dContour(4,S2d);
|
||||
Henri.Disc3dContour(4,0,S3d);
|
||||
seuil = Max(Tol3d,dmax*10);
|
||||
GeomPlate_PlateG0Criterion Crit0(S2d,S3d,seuil);
|
||||
GeomPlate_MakeApprox MApp(surf,Crit0,Tol3d,Nbmax,degmax);
|
||||
support = MApp.Surface();
|
||||
}
|
||||
else if (CritOrder==1) {
|
||||
Henri.Disc2dContour(4,S2d);
|
||||
Henri.Disc3dContour(4,1,S3d);
|
||||
seuil = Max(Tol3d,anmax*10);
|
||||
GeomPlate_PlateG1Criterion Crit1(S2d,S3d,seuil);
|
||||
GeomPlate_MakeApprox MApp(surf,Crit1,Tol3d,Nbmax,degmax);
|
||||
support = MApp.Surface();
|
||||
}
|
||||
}
|
||||
|
||||
BRepBuilderAPI_MakeWire MW;
|
||||
BRep_Builder B;
|
||||
for (i=1 ; i<=NbCurFront ; i++) {
|
||||
Standard_Integer iInOrder=Henri.Order()->Value(i);
|
||||
TopoDS_Edge E;
|
||||
if (Henri.Sense()->Value(iInOrder)==1) {
|
||||
BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
|
||||
support,
|
||||
Fronts->Value(iInOrder)->LastParameter(),
|
||||
Fronts->Value(iInOrder)->FirstParameter());
|
||||
E = ME.Edge();
|
||||
}
|
||||
else {
|
||||
BRepBuilderAPI_MakeEdge ME(Henri.Curves2d()->Value(iInOrder),
|
||||
support,
|
||||
Fronts->Value(iInOrder)->FirstParameter(),
|
||||
Fronts->Value(iInOrder)->LastParameter());
|
||||
E = ME.Edge();
|
||||
}
|
||||
B.UpdateVertex(TopExp::FirstVertex(E), dmax);
|
||||
B.UpdateVertex(TopExp::LastVertex(E), dmax);
|
||||
BRepLib::BuildCurve3d(E);
|
||||
MW.Add(E);
|
||||
if (MW.IsDone()==Standard_False) {
|
||||
#ifdef DEB
|
||||
BRepBuilderAPI_WireError err =
|
||||
#endif
|
||||
MW.Error();
|
||||
Standard_Failure::Raise("mkWire is over ");
|
||||
}
|
||||
}
|
||||
TopoDS_Wire W;
|
||||
W=MW.Wire();
|
||||
if (!(W.Closed())) Standard_Failure::Raise("Wire is not closed");
|
||||
BRepBuilderAPI_MakeFace MF(support,W,Standard_True);
|
||||
DBRep::Set(a[1],MF.Face());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer filling( Draw_Interpretor & di, Standard_Integer n, const char** a )
|
||||
{
|
||||
#ifdef DEB
|
||||
// Chronmetrage
|
||||
OSD_Chronometer Chrono;
|
||||
Chrono.Reset();
|
||||
Chrono.Start();
|
||||
#endif
|
||||
|
||||
if (n < 7) return 1;
|
||||
Standard_Integer NbBounds = atoi( a[2] );
|
||||
Standard_Integer NbConstraints = atoi( a[3] );
|
||||
Standard_Integer NbPoints = atoi( a[4] );
|
||||
|
||||
BRepOffsetAPI_MakeFilling MakeFilling( Degree,
|
||||
NbPtsOnCur,
|
||||
NbIter,
|
||||
Anisotropie,
|
||||
Tol2d,
|
||||
Tol3d,
|
||||
TolAng,
|
||||
TolCurv,
|
||||
MaxDeg,
|
||||
MaxSegments );
|
||||
TopoDS_Shape aLocalFace(DBRep::Get( a[5], TopAbs_FACE ) );
|
||||
TopoDS_Face InitFace = TopoDS::Face( aLocalFace);
|
||||
// TopoDS_Face InitFace = TopoDS::Face( DBRep::Get( a[5], TopAbs_FACE ) );
|
||||
if (! InitFace.IsNull())
|
||||
MakeFilling.LoadInitSurface( InitFace );
|
||||
|
||||
Standard_Integer i = (InitFace.IsNull())? 5 : 6, k;
|
||||
TopoDS_Edge E;
|
||||
TopoDS_Face F;
|
||||
gp_Pnt Point;
|
||||
Standard_Integer Order;
|
||||
for (k = 1; k <= NbBounds; k++)
|
||||
{
|
||||
E.Nullify();
|
||||
F.Nullify();
|
||||
TopoDS_Shape aLocalEdge(DBRep::Get( a[i], TopAbs_EDGE ));
|
||||
E = TopoDS::Edge(aLocalEdge);
|
||||
// E = TopoDS::Edge( DBRep::Get( a[i], TopAbs_EDGE ) );
|
||||
if (! E.IsNull())
|
||||
i++;
|
||||
aLocalFace = DBRep::Get( a[i], TopAbs_FACE ) ;
|
||||
F = TopoDS::Face(aLocalFace);
|
||||
// F = TopoDS::Face( DBRep::Get( a[i], TopAbs_FACE ) );
|
||||
if (! F.IsNull())
|
||||
i++;
|
||||
|
||||
Order = atoi( a[i++] );
|
||||
|
||||
if (! E.IsNull() && ! F.IsNull())
|
||||
MakeFilling.Add( E, F, (GeomAbs_Shape)Order );
|
||||
else if (E.IsNull())
|
||||
{
|
||||
if (F.IsNull())
|
||||
{
|
||||
//cout<<endl<<"Wrong parameters"<<endl<<endl;
|
||||
di<<"\n"<<"Wrong parameters"<<"\n"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
MakeFilling.Add( F, (GeomAbs_Shape)Order );
|
||||
}
|
||||
else
|
||||
MakeFilling.Add( E, (GeomAbs_Shape)Order );
|
||||
}
|
||||
for (k = 1; k <= NbConstraints; k++)
|
||||
{
|
||||
E.Nullify();
|
||||
F.Nullify();
|
||||
TopoDS_Shape aLocalEdge(DBRep::Get( a[i++], TopAbs_EDGE ));
|
||||
E = TopoDS::Edge( aLocalEdge);
|
||||
// E = TopoDS::Edge( DBRep::Get( a[i++], TopAbs_EDGE ) );
|
||||
if (E.IsNull())
|
||||
{
|
||||
//cout<<"Wrong parameters"<<endl;
|
||||
di<<"Wrong parameters"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
TopoDS_Shape alocalFace(DBRep::Get( a[i], TopAbs_FACE ) );
|
||||
F = TopoDS::Face( aLocalFace);
|
||||
// F = TopoDS::Face( DBRep::Get( a[i], TopAbs_FACE ) );
|
||||
if (! F.IsNull())
|
||||
i++;
|
||||
|
||||
Order = atoi( a[i++] );
|
||||
|
||||
if (F.IsNull())
|
||||
MakeFilling.Add( E, (GeomAbs_Shape)Order, Standard_False );
|
||||
else
|
||||
MakeFilling.Add( E, F, (GeomAbs_Shape)Order, Standard_False );
|
||||
}
|
||||
for (k = 1; k <= NbPoints; k++)
|
||||
{
|
||||
if (DrawTrSurf::GetPoint( a[i], Point ))
|
||||
{
|
||||
MakeFilling.Add( Point );
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_Real U = atof( a[i++] ), V = atof( a[i++] );
|
||||
aLocalFace = DBRep::Get( a[i++], TopAbs_FACE );
|
||||
F = TopoDS::Face( aLocalFace);
|
||||
// F = TopoDS::Face( DBRep::Get( a[i++], TopAbs_FACE ));
|
||||
if (F.IsNull())
|
||||
{
|
||||
//cout<<"Wrong parameters"<<endl;
|
||||
di<<"Wrong parameters"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
Order = atoi( a[i++] );
|
||||
|
||||
MakeFilling.Add( U, V, F, (GeomAbs_Shape)Order );
|
||||
}
|
||||
}
|
||||
|
||||
MakeFilling.Build();
|
||||
if (! MakeFilling.IsDone())
|
||||
{
|
||||
//cout<<"filling failed"<<endl;
|
||||
di<<"filling failed"<<"\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Real dmax = MakeFilling.G0Error(),
|
||||
angmax = MakeFilling.G1Error(),
|
||||
curvmax = MakeFilling.G2Error();
|
||||
//cout<<" dist. max = "<<dmax<<" ; angle max = "<<angmax<<" ; diffcurv max = "<<curvmax<<endl;
|
||||
di<<" dist. max = "<<dmax<<" ; angle max = "<<angmax<<" ; diffcurv max = "<<curvmax<<"\n";
|
||||
|
||||
TopoDS_Face ResFace= TopoDS::Face( MakeFilling.Shape() );
|
||||
DBRep::Set( a[1], ResFace );
|
||||
|
||||
#ifdef DEB
|
||||
Chrono.Stop();
|
||||
Standard_Real Tps;
|
||||
Chrono.Show(Tps);
|
||||
//cout<<"*** FIN DE FILLING ***"<<endl;
|
||||
//cout<<"Temps de calcul : "<<Tps<<endl;
|
||||
di<<"*** FIN DE FILLING ***"<<"\n";
|
||||
di<<"Temps de calcul : "<<Tps<<"\n";
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer fillingparam( Draw_Interpretor & di, Standard_Integer n, const char** a )
|
||||
{
|
||||
if ( n == 1) {
|
||||
|
||||
//cout << "fillingparam : options are" <<endl;
|
||||
//cout << "-l : to list current values" << endl;
|
||||
//cout << "-i : to set default values" << endl;
|
||||
//cout << "-r deg nbPonC nbIt anis : to set filling options" <<endl;
|
||||
//cout << "-c t2d t3d tang tcur : to set tolerances" << endl;
|
||||
//cout << "-a maxdeg maxseg : Approximation option" << endl;
|
||||
di << "fillingparam : options are" <<"\n";
|
||||
di << "-l : to list current values" << "\n";
|
||||
di << "-i : to set default values" << "\n";
|
||||
di << "-r deg nbPonC nbIt anis : to set filling options" <<"\n";
|
||||
di << "-c t2d t3d tang tcur : to set tolerances" << "\n";
|
||||
di << "-a maxdeg maxseg : Approximation option" << "\n";
|
||||
}
|
||||
else if (n > 1)
|
||||
{
|
||||
TCollection_AsciiString AS( a[1] );
|
||||
AS.LowerCase();
|
||||
const char* flag = AS.ToCString();
|
||||
if (strcmp( flag, "-l" ) == 0 && n == 2)
|
||||
{
|
||||
//cout<<endl;
|
||||
//cout<<"Degree = "<<Degree<<endl;
|
||||
//cout<<"NbPtsOnCur = "<<NbPtsOnCur<<endl;
|
||||
//cout<<"NbIter = "<<NbIter<<endl;
|
||||
//cout<<"Anisotropie = "<<Anisotropie<<endl<<endl;
|
||||
//
|
||||
//cout<<"Tol2d = "<<Tol2d<<endl;
|
||||
//cout<<"Tol3d = "<<Tol3d<<endl;
|
||||
//cout<<"TolAng = "<<TolAng<<endl;
|
||||
//cout<<"TolCurv = "<<TolCurv<<endl<<endl;
|
||||
//
|
||||
//cout<<"MaxDeg = "<<MaxDeg<<endl;
|
||||
//cout<<"MaxSegments = "<<MaxSegments<<endl<<endl;
|
||||
di<<"\n";
|
||||
di<<"Degree = "<<Degree<<"\n";
|
||||
di<<"NbPtsOnCur = "<<NbPtsOnCur<<"\n";
|
||||
di<<"NbIter = "<<NbIter<<"\n";
|
||||
di<<"Anisotropie = "<< (Standard_Integer) Anisotropie<<"\n"<<"\n";
|
||||
|
||||
di<<"Tol2d = "<<Tol2d<<"\n";
|
||||
di<<"Tol3d = "<<Tol3d<<"\n";
|
||||
di<<"TolAng = "<<TolAng<<"\n";
|
||||
di<<"TolCurv = "<<TolCurv<<"\n"<<"\n";
|
||||
|
||||
di<<"MaxDeg = "<<MaxDeg<<"\n";
|
||||
di<<"MaxSegments = "<<MaxSegments<<"\n"<<"\n";
|
||||
}
|
||||
else if (strcmp( flag, "-i" ) == 0 && n == 2)
|
||||
{
|
||||
Degree = defDegree;
|
||||
NbPtsOnCur = defNbPtsOnCur;
|
||||
NbIter = defNbIter;
|
||||
Anisotropie = defAnisotropie;
|
||||
|
||||
Tol2d = defTol2d;
|
||||
Tol3d = defTol3d;
|
||||
TolAng = defTolAng;
|
||||
TolCurv = defTolCurv;
|
||||
|
||||
MaxDeg = defMaxDeg;
|
||||
MaxSegments = defMaxSegments;
|
||||
}
|
||||
else if (strcmp( flag, "-r" ) == 0 && n == 6)
|
||||
{
|
||||
Degree = atoi( a[2] );
|
||||
NbPtsOnCur = atoi( a[3] );
|
||||
NbIter = atoi( a[4] );
|
||||
Anisotropie = atoi( a[5] );
|
||||
}
|
||||
else if (strcmp( flag, "-c" ) == 0 && n == 6)
|
||||
{
|
||||
Tol2d = atof( a[2] );
|
||||
Tol3d = atof( a[3] );
|
||||
TolAng = atof( a[4] );
|
||||
TolCurv = atof( a[5] );
|
||||
}
|
||||
else if (strcmp( flag, "-a" ) == 0 && n == 4)
|
||||
{
|
||||
MaxDeg = atoi( a[2] );
|
||||
MaxSegments = atoi( a[3] );
|
||||
}
|
||||
else
|
||||
{
|
||||
//cout<<"Wrong parameters"<<endl;
|
||||
di<<"Wrong parameters"<<"\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void BRepTest::FillingCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
GeometryTest::SurfaceCommands(theCommands);
|
||||
|
||||
const char* g = "Surface filling topology commands";
|
||||
theCommands.Add("plate",
|
||||
"plate result nbrpntoncurve nbrcurfront edge face tang (0:vif;1:tang) ...",
|
||||
__FILE__,
|
||||
plate,
|
||||
g) ;
|
||||
|
||||
theCommands.Add("gplate",
|
||||
"gplate result nbrcurfront nbrpntconst [SurfInit] [edge 0] [edge tang (1:G1;2:G2) surf]... [point] [u v tang (1:G1;2:G2) surf] ...",
|
||||
__FILE__,
|
||||
gplate,
|
||||
g) ;
|
||||
|
||||
theCommands.Add("approxplate",
|
||||
"approxplate result nbrpntoncurve nbrcurfront edge face tang (0:vif;1:tang) ... tol nmax degmax crit",
|
||||
__FILE__,
|
||||
approxplate,
|
||||
g) ;
|
||||
|
||||
|
||||
|
||||
theCommands.Add("filling",
|
||||
"filling result nbB nbC nbP [SurfInit] [edge][face]order... edge[face]order... point/u v face order...",
|
||||
__FILE__,
|
||||
filling,
|
||||
g) ;
|
||||
|
||||
theCommands.Add("fillingparam",
|
||||
"fillingparam : no arg give help",
|
||||
__FILE__,
|
||||
fillingparam,
|
||||
g) ;
|
||||
|
||||
}
|
294
src/BRepTest/BRepTest_GPropCommands.cxx
Executable file
294
src/BRepTest/BRepTest_GPropCommands.cxx
Executable file
@@ -0,0 +1,294 @@
|
||||
// File: DBRep_8.cxx
|
||||
// Created: Fri Feb 18 17:24:52 1994
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@nonox>
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
#include <BRepTest.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <GProp_PrincipalProps.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
|
||||
#include <Draw_Axis3D.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <OSD_Chronometer.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
Standard_IMPORT Draw_Viewer dout;
|
||||
#endif
|
||||
|
||||
|
||||
Standard_Integer props(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 2) {
|
||||
di << "Use: " << a[0] << " shape [epsilon] [c[losed]] [x y z]" << "\n";
|
||||
di << "Compute properties of the shape" << "\n";
|
||||
di << "The epsilon, if given, defines relative precision of computation" << "\n";
|
||||
di << "The \"closed\" flag, if present, do computation only closed shells of the shape" << "\n";
|
||||
di << "The centroid coordinates will be put to DRAW variables x y z (if given)\n" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopoDS_Shape S = DBRep::Get(a[1]);
|
||||
if (S.IsNull()) return 0;
|
||||
|
||||
GProp_GProps G;
|
||||
|
||||
Standard_Boolean onlyClosed = Standard_False;
|
||||
Standard_Real eps = 1.0;
|
||||
Standard_Boolean witheps = Standard_False;
|
||||
if(n > 2 && *a[2]=='c' || n > 3 && *a[3]=='c') onlyClosed = Standard_True;
|
||||
if(n > 2 && *a[2]!='c' && n != 5) {eps = atof (a[2]); witheps = Standard_True;}
|
||||
|
||||
if (witheps){
|
||||
if (Abs(eps) < Precision::Angular()) return 2;
|
||||
if (*a[0] == 'l')
|
||||
BRepGProp::LinearProperties(S,G);
|
||||
else if (*a[0] == 's')
|
||||
eps = BRepGProp::SurfaceProperties(S,G,eps);
|
||||
else
|
||||
eps = BRepGProp::VolumeProperties(S,G,eps,onlyClosed);
|
||||
}
|
||||
else {
|
||||
if (*a[0] == 'l')
|
||||
BRepGProp::LinearProperties(S,G);
|
||||
else if (*a[0] == 's')
|
||||
BRepGProp::SurfaceProperties(S,G);
|
||||
else
|
||||
BRepGProp::VolumeProperties(S,G,onlyClosed);
|
||||
}
|
||||
|
||||
gp_Pnt P = G.CentreOfMass();
|
||||
gp_Mat I = G.MatrixOfInertia();
|
||||
|
||||
if (n >= 5) {
|
||||
Standard_Integer shift = n - 5;
|
||||
Draw::Set(a[shift+2],P.X());
|
||||
Draw::Set(a[shift+3],P.Y());
|
||||
Draw::Set(a[shift+4],P.Z());
|
||||
}
|
||||
|
||||
Standard_SStream aSStream1;
|
||||
aSStream1 << "\n\n";
|
||||
aSStream1 << "Mass : " << setw(15) << G.Mass() << "\n" << "\n";
|
||||
if(witheps && *a[0] != 'l') aSStream1 << "Relative error of mass computation : " << setw(15) << eps << "\n" << "\n";
|
||||
|
||||
aSStream1 << "Center of gravity : \n";
|
||||
aSStream1 << "X = " << setw(15) << P.X() << "\n";
|
||||
aSStream1 << "Y = " << setw(15) << P.Y() << "\n";
|
||||
aSStream1 << "Z = " << setw(15) << P.Z() << "\n";
|
||||
aSStream1 << "\n";
|
||||
|
||||
aSStream1 << "Matrix of Inertia : \n";
|
||||
aSStream1 << setw(15) << I(1,1);
|
||||
aSStream1 << " " << setw(15) << I(1,2);
|
||||
aSStream1 << " " << setw(15) << I(1,3) << "\n";
|
||||
aSStream1 << setw(15) << I(2,1);
|
||||
aSStream1 << " " << setw(15) << I(2,2);
|
||||
aSStream1 << " " << setw(15) << I(2,3) << "\n";
|
||||
aSStream1 << setw(15) << I(3,1);
|
||||
aSStream1 << " " << setw(15) << I(3,2);
|
||||
aSStream1 << " " << setw(15) << I(3,3) << "\n";
|
||||
aSStream1 << "\n";
|
||||
aSStream1 << ends;
|
||||
di << aSStream1;
|
||||
|
||||
GProp_PrincipalProps Pr = G.PrincipalProperties();
|
||||
|
||||
Standard_Real Ix,Iy,Iz;
|
||||
Pr.Moments(Ix,Iy,Iz);
|
||||
|
||||
Standard_SStream aSStream2;
|
||||
aSStream2 << "Moments : \n";
|
||||
aSStream2 << "IX = " << setw(15) << Ix << "\n";
|
||||
aSStream2 << "IY = " << setw(15) << Iy << "\n";
|
||||
aSStream2 << "IZ = " << setw(15) << Iz << "\n";
|
||||
aSStream2 << "\n";
|
||||
aSStream2 << ends;
|
||||
di << aSStream2;
|
||||
|
||||
//if (n == 2) {
|
||||
gp_Ax2 axes(P,Pr.ThirdAxisOfInertia(),Pr.FirstAxisOfInertia());
|
||||
|
||||
Handle(Draw_Axis3D) Dax = new Draw_Axis3D(axes,Draw_orange,30);
|
||||
dout << Dax;
|
||||
//}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer vpropsgk(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 2) {
|
||||
di << "Use: " << a[0] << " shape epsilon closed span mode [x y z]" << "\n";
|
||||
di << "Compute properties of the shape" << "\n";
|
||||
di << "The epsilon defines relative precision of computation" << "\n";
|
||||
di << "The \"closed\" flag, if equal 1, causes computation only closed shells of the shape" << "\n";
|
||||
di << "The \"span\" flag, if equal 1, says that computation is performed on spans" << "\n";
|
||||
di << " This option makes effect only for BSpline surfaces." << "\n";
|
||||
di << "mode can be 0 - only volume calculations" << "\n";
|
||||
di << " 1 - volume and gravity center" << "\n";
|
||||
di << " 2 - volume, gravity center and matrix of inertia" << "\n";
|
||||
di << "The centroid coordinates will be put to DRAW variables x y z (if given)\n" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( n > 2 && n < 6) {
|
||||
di << "Wrong arguments" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopoDS_Shape S = DBRep::Get(a[1]);
|
||||
if (S.IsNull()) return 0;
|
||||
|
||||
GProp_GProps G;
|
||||
|
||||
Standard_Boolean onlyClosed = Standard_False;
|
||||
Standard_Boolean isUseSpan = Standard_False;
|
||||
Standard_Boolean CGFlag = Standard_False;
|
||||
Standard_Boolean IFlag = Standard_False;
|
||||
Standard_Real eps = 1.e-3;
|
||||
//Standard_Real aDefaultTol = 1.e-3;
|
||||
Standard_Integer mode = 0;
|
||||
|
||||
eps = atof(a[2]);
|
||||
mode = atoi(a[3]);
|
||||
if(mode > 0) onlyClosed = Standard_True;
|
||||
mode = atoi(a[4]);
|
||||
if(mode > 0) isUseSpan = Standard_True;
|
||||
|
||||
mode = atoi(a[5]);
|
||||
if(mode == 1 || mode == 3) CGFlag = Standard_True;
|
||||
if(mode == 2 || mode == 3) IFlag = Standard_True;
|
||||
|
||||
//OSD_Chronometer aChrono;
|
||||
|
||||
//aChrono.Reset();
|
||||
//aChrono.Start();
|
||||
eps = BRepGProp::VolumePropertiesGK(S, G, eps, onlyClosed, isUseSpan, CGFlag, IFlag);
|
||||
//aChrono.Stop();
|
||||
|
||||
Standard_SStream aSStream0;
|
||||
Standard_Integer anOutWidth = 24;
|
||||
|
||||
aSStream0.precision(15);
|
||||
aSStream0 << "\n\n";
|
||||
aSStream0 << "Mass : " << setw(anOutWidth) << G.Mass() << "\n" << "\n";
|
||||
aSStream0 << "Relative error of mass computation : " << setw(anOutWidth) << eps << "\n" << "\n";
|
||||
aSStream0 << ends;
|
||||
di << aSStream0;
|
||||
|
||||
if(CGFlag || IFlag) {
|
||||
Standard_SStream aSStream1;
|
||||
gp_Pnt P = G.CentreOfMass();
|
||||
if (n > 6) {
|
||||
Draw::Set(a[6],P.X());
|
||||
}
|
||||
if (n > 7) {
|
||||
Draw::Set(a[7],P.Y());
|
||||
}
|
||||
if (n > 8) {
|
||||
Draw::Set(a[8],P.Z());
|
||||
}
|
||||
|
||||
aSStream1.precision(15);
|
||||
aSStream1 << "Center of gravity : \n";
|
||||
aSStream1 << "X = " << setw(anOutWidth) << P.X() << "\n";
|
||||
aSStream1 << "Y = " << setw(anOutWidth) << P.Y() << "\n";
|
||||
aSStream1 << "Z = " << setw(anOutWidth) << P.Z() << "\n";
|
||||
aSStream1 << "\n";
|
||||
|
||||
if(IFlag) {
|
||||
gp_Mat I = G.MatrixOfInertia();
|
||||
|
||||
aSStream1 << "Matrix of Inertia : \n";
|
||||
aSStream1 << setw(anOutWidth) << I(1,1);
|
||||
aSStream1 << " " << setw(anOutWidth) << I(1,2);
|
||||
aSStream1 << " " << setw(anOutWidth) << I(1,3) << "\n";
|
||||
aSStream1 << setw(anOutWidth) << I(2,1);
|
||||
aSStream1 << " " << setw(anOutWidth) << I(2,2);
|
||||
aSStream1 << " " << setw(anOutWidth) << I(2,3) << "\n";
|
||||
aSStream1 << setw(anOutWidth) << I(3,1);
|
||||
aSStream1 << " " << setw(anOutWidth) << I(3,2);
|
||||
aSStream1 << " " << setw(anOutWidth) << I(3,3) << "\n";
|
||||
aSStream1 << "\n";
|
||||
}
|
||||
aSStream1 << ends;
|
||||
di << aSStream1;
|
||||
}
|
||||
|
||||
if(IFlag) {
|
||||
|
||||
GProp_PrincipalProps Pr = G.PrincipalProperties();
|
||||
|
||||
Standard_Real Ix,Iy,Iz;
|
||||
Pr.Moments(Ix,Iy,Iz);
|
||||
gp_Pnt P = G.CentreOfMass();
|
||||
|
||||
Standard_SStream aSStream2;
|
||||
|
||||
aSStream2.precision(15);
|
||||
aSStream2 << "Moments : \n";
|
||||
aSStream2 << "IX = " << setw(anOutWidth) << Ix << "\n";
|
||||
aSStream2 << "IY = " << setw(anOutWidth) << Iy << "\n";
|
||||
aSStream2 << "IZ = " << setw(anOutWidth) << Iz << "\n";
|
||||
aSStream2 << "\n";
|
||||
aSStream2 << "\n";
|
||||
aSStream2 << ends;
|
||||
di << aSStream2;
|
||||
|
||||
gp_Ax2 axes(P,Pr.ThirdAxisOfInertia(),Pr.FirstAxisOfInertia());
|
||||
|
||||
Handle(Draw_Axis3D) Dax = new Draw_Axis3D(axes,Draw_orange,30);
|
||||
dout << Dax;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GPropCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::GPropCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
|
||||
const char* g = "Global properties";
|
||||
theCommands.Add("lprops",
|
||||
"lprops name [epsilon] [x y z] : compute linear properties",
|
||||
__FILE__,
|
||||
props,
|
||||
g);
|
||||
theCommands.Add("sprops",
|
||||
"sprops name [epsilon] [x y z] : compute surfacic properties",
|
||||
__FILE__,
|
||||
props,
|
||||
g);
|
||||
theCommands.Add("vprops",
|
||||
"vprops name [epsilon] [c[losed]] [x y z] : compute volumic properties",
|
||||
__FILE__,
|
||||
props,
|
||||
g);
|
||||
|
||||
theCommands.Add("vpropsgk",
|
||||
"vpropsgk name epsilon closed span mode [x y z] : compute volumic properties",
|
||||
__FILE__,
|
||||
vpropsgk,
|
||||
g);
|
||||
}
|
263
src/BRepTest/BRepTest_MatCommands.cxx
Executable file
263
src/BRepTest/BRepTest_MatCommands.cxx
Executable file
@@ -0,0 +1,263 @@
|
||||
// File: BRepTest_MatCommands.cxx
|
||||
// Created: Tue Oct 4 09:25:21 1994
|
||||
// Author: Yves FRICAUD
|
||||
// <yfr@stylox>
|
||||
|
||||
#include <BRepTest.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <DrawTrSurf_Curve2d.hxx>
|
||||
|
||||
#include <Geom2d_Line.hxx>
|
||||
#include <Geom2d_Circle.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <Geom2d_Parabola.hxx>
|
||||
#include <Geom2d_Hyperbola.hxx>
|
||||
|
||||
#include <MAT_Bisector.hxx>
|
||||
#include <MAT_Zone.hxx>
|
||||
#include <MAT_Graph.hxx>
|
||||
#include <MAT_Arc.hxx>
|
||||
#include <MAT_BasicElt.hxx>
|
||||
#include <MAT_Node.hxx>
|
||||
#include <MAT_Side.hxx>
|
||||
|
||||
#include <Bisector_Bisec.hxx>
|
||||
#include <Bisector_BisecAna.hxx>
|
||||
#include <Bisector_Curve.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <BRepMAT2d_Explorer.hxx>
|
||||
#include <BRepMAT2d_BisectingLocus.hxx>
|
||||
#include <BRepMAT2d_LinkTopoBilo.hxx>
|
||||
|
||||
#include <gp_Parab2d.hxx>
|
||||
#include <gp_Hypr2d.hxx>
|
||||
|
||||
#include <DBRep.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
Standard_IMPORT Draw_Viewer dout;
|
||||
#endif
|
||||
|
||||
static BRepMAT2d_BisectingLocus MapBiLo;
|
||||
static BRepMAT2d_Explorer anExplo;
|
||||
static BRepMAT2d_LinkTopoBilo TopoBilo;
|
||||
static MAT_Side SideOfMat = MAT_Left;
|
||||
static Standard_Boolean LinkComputed;
|
||||
|
||||
static void DrawCurve(const Handle(Geom2d_Curve)& aCurve,
|
||||
const Standard_Integer Indice);
|
||||
|
||||
//==========================================================================
|
||||
//function : topoLoad
|
||||
// chargement d une face dans l explorer.
|
||||
//==========================================================================
|
||||
static Standard_Integer topoload (Draw_Interpretor& , Standard_Integer argc, const char** argv)
|
||||
{
|
||||
if (argc < 2) return 1;
|
||||
|
||||
TopoDS_Shape C1 = DBRep::Get (argv[1],TopAbs_FACE);
|
||||
|
||||
if (C1.IsNull()) return 1;
|
||||
|
||||
anExplo.Perform (TopoDS::Face(C1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//function : drawcont
|
||||
// visualisation du contour defini par l explorateur.
|
||||
//==========================================================================
|
||||
static Standard_Integer drawcont(Draw_Interpretor& , Standard_Integer , const char**)
|
||||
{
|
||||
Handle(Geom2d_TrimmedCurve) C;
|
||||
|
||||
for (Standard_Integer j = 1; j <= anExplo.NumberOfContours(); j ++) {
|
||||
for (anExplo.Init(j);anExplo.More();anExplo.Next()) {
|
||||
DrawCurve(anExplo.Value(),1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//function : mat
|
||||
// calcul de la carte des lieux bisecteur sur le contour defini
|
||||
// par l explorateur.
|
||||
//==========================================================================
|
||||
static Standard_Integer mat(Draw_Interpretor& , Standard_Integer, const char**)
|
||||
{
|
||||
MapBiLo.Compute(anExplo,1,SideOfMat);
|
||||
LinkComputed = Standard_False;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//function : zone
|
||||
// construction et affichage de la zone de proximite associee aux
|
||||
// elements de base definis par l edge ou le vertex.
|
||||
//==========================================================================
|
||||
static Standard_Integer zone(Draw_Interpretor& , Standard_Integer argc , const char** argv)
|
||||
{
|
||||
if (argc < 2) return 1;
|
||||
|
||||
TopoDS_Shape S = DBRep::Get (argv[1],TopAbs_EDGE);
|
||||
if (S.IsNull()) {
|
||||
S = DBRep::Get (argv[1],TopAbs_VERTEX);
|
||||
}
|
||||
|
||||
if (!LinkComputed) {
|
||||
TopoBilo.Perform(anExplo,MapBiLo);
|
||||
LinkComputed = Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean Reverse;
|
||||
Handle(MAT_Zone) TheZone = new MAT_Zone();
|
||||
|
||||
for (TopoBilo.Init(S); TopoBilo.More(); TopoBilo.Next()) {
|
||||
const Handle(MAT_BasicElt)& BE = TopoBilo.Value();
|
||||
TheZone->Perform(BE);
|
||||
for (Standard_Integer i=1; i <= TheZone->NumberOfArcs(); i++) {
|
||||
DrawCurve(MapBiLo.GeomBis(TheZone->ArcOnFrontier(i),Reverse).Value(),2);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//function : side
|
||||
// side = left => calcul a gauche du contour.
|
||||
// side = right => calcul a droite du contour.
|
||||
//==========================================================================
|
||||
|
||||
static Standard_Integer side(Draw_Interpretor& , Standard_Integer, const char** argv)
|
||||
{
|
||||
if(!strcmp(argv[1],"right"))
|
||||
SideOfMat = MAT_Right;
|
||||
else
|
||||
SideOfMat = MAT_Left;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//function : result
|
||||
// Affichage complet de la carte calculee.
|
||||
//==========================================================================
|
||||
static Standard_Integer result(Draw_Interpretor& , Standard_Integer, const char**)
|
||||
{
|
||||
Standard_Integer i,NbArcs=0;
|
||||
Standard_Boolean Rev;
|
||||
|
||||
NbArcs = MapBiLo.Graph()->NumberOfArcs();
|
||||
|
||||
for (i=1; i <= NbArcs;i++) {
|
||||
DrawCurve(MapBiLo.GeomBis(MapBiLo.Graph()->Arc(i),Rev).Value(),3);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//function : DrawCurve
|
||||
// Affichage d une courbe <aCurve> de Geom2d. dans une couleur
|
||||
// definie par <Indice>.
|
||||
// Indice = 1 jaune,
|
||||
// Indice = 2 bleu,
|
||||
// Indice = 3 rouge,
|
||||
// Indice = 4 vert.
|
||||
//==========================================================================
|
||||
void DrawCurve(const Handle(Geom2d_Curve)& aCurve,
|
||||
const Standard_Integer Indice)
|
||||
{
|
||||
Handle(Standard_Type) type = aCurve->DynamicType();
|
||||
Handle(Geom2d_Curve) curve,CurveDraw;
|
||||
Handle(DrawTrSurf_Curve2d) dr;
|
||||
Draw_Color Couleur;
|
||||
|
||||
if (type == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
|
||||
curve = (*(Handle_Geom2d_TrimmedCurve*)&aCurve)->BasisCurve();
|
||||
type = curve->DynamicType();
|
||||
if (type == STANDARD_TYPE(Bisector_BisecAna)) {
|
||||
curve =(*(Handle_Bisector_BisecAna*)&curve)->Geom2dCurve();
|
||||
type = curve->DynamicType();
|
||||
}
|
||||
// PB de representation des courbes semi_infinies.
|
||||
gp_Parab2d gpParabola;
|
||||
gp_Hypr2d gpHyperbola;
|
||||
Standard_Real Focus;
|
||||
Standard_Real Limit = 50000.;
|
||||
Standard_Real delta = 400;
|
||||
|
||||
// PB de representation des courbes semi_infinies.
|
||||
if (aCurve->LastParameter() == Precision::Infinite()) {
|
||||
|
||||
if (type == STANDARD_TYPE(Geom2d_Parabola)) {
|
||||
gpParabola = Handle(Geom2d_Parabola)::DownCast(curve)->Parab2d();
|
||||
Focus = gpParabola.Focal();
|
||||
Standard_Real Val1 = Sqrt(Limit*Focus);
|
||||
Standard_Real Val2 = Sqrt(Limit*Limit);
|
||||
delta= (Val1 <= Val2 ? Val1:Val2);
|
||||
}
|
||||
else if (type == STANDARD_TYPE(Geom2d_Hyperbola)) {
|
||||
gpHyperbola = Handle(Geom2d_Hyperbola)::DownCast(curve)->Hypr2d();
|
||||
Standard_Real Majr = gpHyperbola.MajorRadius();
|
||||
Standard_Real Minr = gpHyperbola.MinorRadius();
|
||||
Standard_Real Valu1 = Limit/Majr;
|
||||
Standard_Real Valu2 = Limit/Minr;
|
||||
Standard_Real Val1 = Log(Valu1+Sqrt(Valu1*Valu1-1));
|
||||
Standard_Real Val2 = Log(Valu2+Sqrt(Valu2*Valu2+1));
|
||||
delta = (Val1 <= Val2 ? Val1:Val2);
|
||||
}
|
||||
if (aCurve->FirstParameter() == -Precision::Infinite())
|
||||
CurveDraw = new Geom2d_TrimmedCurve(aCurve, -delta, delta);
|
||||
else
|
||||
CurveDraw = new Geom2d_TrimmedCurve(aCurve,
|
||||
aCurve->FirstParameter(),
|
||||
aCurve->FirstParameter() + delta);
|
||||
}
|
||||
else {
|
||||
CurveDraw = aCurve;
|
||||
}
|
||||
// fin PB.
|
||||
}
|
||||
else {
|
||||
CurveDraw = aCurve;
|
||||
}
|
||||
|
||||
if (Indice == 1) Couleur = Draw_jaune;
|
||||
else if (Indice == 2) Couleur = Draw_bleu;
|
||||
else if (Indice == 3) Couleur = Draw_rouge;
|
||||
else if (Indice == 4) Couleur = Draw_vert;
|
||||
|
||||
Standard_Integer Discret = 50;
|
||||
|
||||
if (type == STANDARD_TYPE(Geom2d_Circle))
|
||||
dr = new DrawTrSurf_Curve2d(CurveDraw,Couleur,30,Standard_False);
|
||||
else if (type == STANDARD_TYPE(Geom2d_Line))
|
||||
dr = new DrawTrSurf_Curve2d(CurveDraw,Couleur,2,Standard_False);
|
||||
else
|
||||
dr = new DrawTrSurf_Curve2d(CurveDraw,Couleur,Discret,Standard_False);
|
||||
|
||||
dout << dr;
|
||||
dout.Flush();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//function BRepTest:: MatCommands
|
||||
//==========================================================================
|
||||
|
||||
void BRepTest::MatCommands (Draw_Interpretor& theCommands)
|
||||
{
|
||||
theCommands.Add("topoload","load face",__FILE__,topoload);
|
||||
theCommands.Add("drawcont","display current contour",__FILE__,drawcont);
|
||||
theCommands.Add("mat","computes the mat",__FILE__,mat);
|
||||
theCommands.Add("side","side left/right",__FILE__,side);
|
||||
theCommands.Add("result","result",__FILE__,result);
|
||||
theCommands.Add("zone","zone edge or vertex",__FILE__,zone);
|
||||
}
|
444
src/BRepTest/BRepTest_OtherCommands.cxx
Executable file
444
src/BRepTest/BRepTest_OtherCommands.cxx
Executable file
@@ -0,0 +1,444 @@
|
||||
// File: BRepTest_OtherCommands.cxx
|
||||
// Created: Thu Apr 13 15:06:24 1995
|
||||
// Author: Jean Yves LEBEY
|
||||
// <jyl@meteox>
|
||||
|
||||
#include <BRepTest.hxx>
|
||||
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_CompSolid.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Shell.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <BRepIntCurveSurface_Inter.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
|
||||
//#ifdef WNT
|
||||
#include <stdio.h>
|
||||
//#endif
|
||||
|
||||
//=======================================================================
|
||||
// shape : shape name V/E/W/F/SH/SO/CS/C
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer emptyshape(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n <= 1) return 1;
|
||||
|
||||
BRep_Builder B;
|
||||
TopoDS_Shape S;
|
||||
|
||||
if (n == 3) {
|
||||
TCollection_AsciiString as(a[2]); as.LowerCase();
|
||||
const char* a2 = as.ToCString();
|
||||
|
||||
if ( ! strcmp(a2,"c") ) {
|
||||
TopoDS_Compound SS; B.MakeCompound(SS); S = SS;
|
||||
}
|
||||
else if ( ! strcmp(a2,"cs") ) {
|
||||
TopoDS_CompSolid SS; B.MakeCompSolid(SS); S = SS;
|
||||
}
|
||||
else if ( ! strcmp(a2,"so") ) {
|
||||
TopoDS_Solid SS; B.MakeSolid(SS); S = SS;
|
||||
}
|
||||
else if ( ! strcmp(a2,"sh") ) {
|
||||
TopoDS_Shell SS; B.MakeShell(SS); S = SS;
|
||||
}
|
||||
else if ( ! strcmp(a2,"f") ) {
|
||||
TopoDS_Face SS; B.MakeFace(SS); S = SS;
|
||||
}
|
||||
else if ( ! strcmp(a2,"w") ) {
|
||||
TopoDS_Wire SS; B.MakeWire(SS); S = SS;
|
||||
}
|
||||
else if ( ! strcmp(a2,"e") ) {
|
||||
TopoDS_Edge SS; B.MakeEdge(SS); S = SS;
|
||||
}
|
||||
else if ( ! strcmp(a2,"v") ) {
|
||||
TopoDS_Vertex SS; B.MakeVertex(SS); S = SS;
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
const char *shapename = a[1];
|
||||
DBRep::Set(shapename,S);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// subshape
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer subshape(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n <= 2) return 1;
|
||||
|
||||
|
||||
TopoDS_Shape S = DBRep::Get(a[1]);
|
||||
if (S.IsNull()) return 0;
|
||||
char newname[1024];
|
||||
strcpy(newname,a[1]);
|
||||
char* p = newname;
|
||||
while (*p != '\0') p++;
|
||||
*p = '_';
|
||||
p++;
|
||||
Standard_Integer i = 0;
|
||||
if (n == 3) {
|
||||
Standard_Integer isub = atoi(a[2]);
|
||||
TopoDS_Iterator itr(S);
|
||||
while (itr.More()) {
|
||||
i++;
|
||||
if ( i == isub ) {
|
||||
sprintf(p,"%d",i);
|
||||
DBRep::Set(newname,itr.Value());
|
||||
di.AppendElement(newname);
|
||||
break;
|
||||
}
|
||||
itr.Next();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// explode a type
|
||||
TopAbs_ShapeEnum typ;
|
||||
switch (a[2][0]) {
|
||||
|
||||
case 'C' :
|
||||
case 'c' :
|
||||
typ = TopAbs_COMPSOLID;
|
||||
break;
|
||||
|
||||
case 'S' :
|
||||
case 's' :
|
||||
if ((a[2][1] == 'O')||(a[2][1] == 'o'))
|
||||
typ = TopAbs_SOLID;
|
||||
else if ((a[2][1] == 'H')||(a[2][1] == 'h'))
|
||||
typ = TopAbs_SHELL;
|
||||
else
|
||||
return 1;
|
||||
break;
|
||||
|
||||
case 'F' :
|
||||
case 'f' :
|
||||
typ = TopAbs_FACE;
|
||||
break;
|
||||
|
||||
case 'W' :
|
||||
case 'w' :
|
||||
typ = TopAbs_WIRE;
|
||||
break;
|
||||
|
||||
case 'E' :
|
||||
case 'e' :
|
||||
typ = TopAbs_EDGE;
|
||||
break;
|
||||
|
||||
case 'V' :
|
||||
case 'v' :
|
||||
typ = TopAbs_VERTEX;
|
||||
break;
|
||||
|
||||
default :
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer isub = atoi(a[3]);
|
||||
TopTools_MapOfShape M;
|
||||
M.Add(S);
|
||||
TopExp_Explorer ex(S,typ);
|
||||
while (ex.More()) {
|
||||
if (M.Add(ex.Current())) {
|
||||
i++;
|
||||
if ( i == isub ) {
|
||||
sprintf(p,"%d",i);
|
||||
DBRep::Set(newname,ex.Current());
|
||||
di.AppendElement(newname);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ex.Next();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// subshape
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer brepintcs(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n <= 2) return 1;
|
||||
TopoDS_Shape S = DBRep::Get(a[n-1]);
|
||||
if (S.IsNull()) return 3;
|
||||
|
||||
static BRepIntCurveSurface_Inter theAlg;
|
||||
static double tol=1e-6;
|
||||
static int nbpi=0;
|
||||
static gp_Pnt curp;
|
||||
|
||||
if (n==3) {
|
||||
Handle(Geom_Curve) C= DrawTrSurf::GetCurve(a[1]);
|
||||
if (C.IsNull()) return 2;
|
||||
GeomAdaptor_Curve acur(C);
|
||||
theAlg.Init(S, acur, tol);
|
||||
for (; theAlg.More(); theAlg.Next()) {
|
||||
curp=theAlg.Pnt();
|
||||
nbpi++;
|
||||
char name[64];
|
||||
char* temp = name; // pour portage WNT
|
||||
sprintf(temp, "%s_%d", "brics", nbpi);
|
||||
DrawTrSurf::Set(temp, curp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Handle(Geom_Line) hl;
|
||||
gp_Lin thel;
|
||||
for (Standard_Integer il = 1; il<n ; il++) {
|
||||
hl= Handle(Geom_Line)::DownCast(DrawTrSurf::GetCurve(a[il]));
|
||||
if (!hl.IsNull()) {
|
||||
thel=hl->Lin();
|
||||
theAlg.Init(S, thel, tol);
|
||||
for (; theAlg.More(); theAlg.Next()) {
|
||||
curp=theAlg.Pnt();
|
||||
nbpi++;
|
||||
char name[64];
|
||||
char* temp = name; // pour portage WNT
|
||||
sprintf(temp, "%s_%d", "brics", nbpi);
|
||||
DrawTrSurf::Set(temp, curp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//POP pour NT
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <IntCurvesFace_Intersector.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <BRepFeat_MakeDPrism.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
//#include <SaveShape.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <LocOpe_CSIntersector.hxx>
|
||||
#include <LocOpe_SequenceOfLin.hxx>
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#include <LocOpe_PntFace.hxx>
|
||||
|
||||
static void SampleEdges (const TopoDS_Shape& theShape, TColgp_SequenceOfPnt& theSeq);
|
||||
static TopoDS_Face NextFaceForPrism (const TopoDS_Shape& shape,
|
||||
const TopoDS_Shape& basis,
|
||||
const gp_Ax1& ax1);
|
||||
|
||||
//=======================================================================
|
||||
// intgo
|
||||
//=======================================================================
|
||||
static Standard_Integer MakeBoss(Draw_Interpretor& , Standard_Integer , const char** a)
|
||||
{
|
||||
|
||||
|
||||
TopoDS_Shape myS = DBRep::Get( a[2] );
|
||||
|
||||
TopoDS_Shape myBasis = DBRep::Get( a[3] ) ;
|
||||
|
||||
Standard_Real ang = -0.05235987901687622;
|
||||
|
||||
|
||||
TopoDS_Face basis = TopoDS::Face(myBasis);
|
||||
|
||||
BRepFeat_MakeDPrism DPRISM(myS, basis, basis, ang, 1, Standard_True);
|
||||
|
||||
TopoDS_Shape myFaceOnShape;
|
||||
gp_Pnt Pnt(0.0, 0.0, 50.0);
|
||||
gp_Dir Dir(-0.0, -0.0, -1.0);
|
||||
gp_Ax1 ax(Pnt, Dir);
|
||||
|
||||
myFaceOnShape = NextFaceForPrism(myS, myBasis, ax);
|
||||
|
||||
DPRISM.Perform (myFaceOnShape);
|
||||
DPRISM.Build();
|
||||
|
||||
if( DPRISM.IsDone() ) DBRep::Set( a[1], DPRISM.Shape() );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <BRepOffset_MakeOffset.hxx>
|
||||
#include <BRepOffset.hxx>
|
||||
//#include <SaveShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <GeomAbs_JoinType.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// Create a shell
|
||||
//=======================================================================
|
||||
static Standard_Integer MakeShell(Draw_Interpretor& , Standard_Integer , const char** a)
|
||||
{
|
||||
|
||||
TopoDS_Shape aShape = DBRep::Get( a[1] );
|
||||
TopTools_ListOfShape Lst;
|
||||
TopExp_Explorer Exp(aShape, TopAbs_FACE);
|
||||
TopoDS_Shape InputShape(DBRep::Get( a[2] ));
|
||||
TopoDS_Face F = TopoDS::Face(InputShape);
|
||||
// TopoDS_Face F = TopoDS::Face(DBRep::Get( a[2] ));
|
||||
|
||||
Standard_Real Off = -atof( a[3] );
|
||||
|
||||
BRepOffset_MakeOffset Offset;
|
||||
|
||||
Offset.Initialize( aShape, Off, 1.0e-3, BRepOffset_Skin,
|
||||
Standard_True , Standard_False , GeomAbs_Arc );
|
||||
Offset.AddFace( F );
|
||||
Offset.MakeThickSolid();
|
||||
|
||||
if( Offset.IsDone() ) {
|
||||
// SaveShape::Save(Offset.Shape(), "ss");
|
||||
DBRep::Set( a[1], Offset.Shape() );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : OtherCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::OtherCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
const char* g = "TOPOLOGY other commands";
|
||||
|
||||
theCommands.Add("shape",
|
||||
"shape name V/E/W/F/Sh/So/CS/C; make a empty shape",__FILE__,emptyshape,g);
|
||||
|
||||
theCommands.Add("subshape",
|
||||
"subshape name V/E/W/F/Sh/So/CS/C index; get subsshape <index> of given type"
|
||||
,__FILE__,subshape,g);
|
||||
|
||||
theCommands.Add("BRepIntCS",
|
||||
"Calcul d'intersection entre face et curve : BRepIntCS curve shape"
|
||||
,__FILE__,brepintcs,g);
|
||||
|
||||
theCommands.Add("makeboss",
|
||||
"create a boss on the shape myS", __FILE__, MakeBoss, g);
|
||||
|
||||
theCommands.Add("mksh",
|
||||
"create a shell on Shape", __FILE__, MakeShell, g);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NextFaceForPrism
|
||||
//purpose : Search a face from <shape> which intersects with a line of
|
||||
// direction <ax1> and location a point of <basis>.
|
||||
//=======================================================================
|
||||
static TopoDS_Face NextFaceForPrism (const TopoDS_Shape& shape,
|
||||
const TopoDS_Shape& basis,
|
||||
const gp_Ax1& ax1)
|
||||
{
|
||||
TopoDS_Face nextFace;
|
||||
|
||||
TColgp_SequenceOfPnt seqPnts;
|
||||
SampleEdges(basis, seqPnts);
|
||||
|
||||
for (Standard_Integer i=1; i<=seqPnts.Length(); i++) {
|
||||
const gp_Pnt& pt = seqPnts(i);
|
||||
// find a axis through a face
|
||||
gp_Dir dir = ax1.Direction();
|
||||
gp_Ax1 ax1b(pt, dir);
|
||||
|
||||
LocOpe_CSIntersector ASI(shape);
|
||||
LocOpe_SequenceOfLin slin;
|
||||
slin.Append(ax1b);
|
||||
ASI.Perform(slin);
|
||||
|
||||
if (ASI.IsDone()) {
|
||||
Standard_Integer no=1, IndFrom, IndTo;
|
||||
TopAbs_Orientation theOr;
|
||||
Standard_Real min = 1.e-04, Tol = -Precision::Confusion();
|
||||
if (ASI.LocalizeAfter (no, min, Tol, theOr, IndFrom, IndTo)) {
|
||||
nextFace = ASI.Point(no, IndFrom).Face();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nextFace;
|
||||
}
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : SampleEdges
|
||||
//purpose : Sampling of <theShape>.
|
||||
//design : Collect the vertices and points on the edges
|
||||
//=======================================================================
|
||||
static void SampleEdges (const TopoDS_Shape& theShape, TColgp_SequenceOfPnt& theSeq)
|
||||
{
|
||||
|
||||
theSeq.Clear();
|
||||
|
||||
|
||||
TopTools_MapOfShape theMap;
|
||||
TopExp_Explorer exp;
|
||||
|
||||
// Adds all vertices/pnt
|
||||
for (exp.Init(theShape,TopAbs_VERTEX); exp.More(); exp.Next()) {
|
||||
if (theMap.Add(exp.Current())) {
|
||||
theSeq.Append (BRep_Tool::Pnt(TopoDS::Vertex(exp.Current())));
|
||||
}
|
||||
}
|
||||
|
||||
// Computes points on edge, but does not take the extremities into account
|
||||
Standard_Integer NECHANT = 5;
|
||||
Handle(Geom_Curve) C;
|
||||
Standard_Real f,l,prm;
|
||||
for (exp.Init (theShape,TopAbs_EDGE); exp.More(); exp.Next()) {
|
||||
const TopoDS_Edge& edg = TopoDS::Edge(exp.Current());
|
||||
if (theMap.Add(edg)) {
|
||||
if (!BRep_Tool::Degenerated(edg)) {
|
||||
C = BRep_Tool::Curve(edg,f,l);
|
||||
for (Standard_Integer i=1; i < NECHANT; i++) {
|
||||
prm = ((NECHANT-i)*f+i*l)/NECHANT;
|
||||
theSeq.Append (C->Value(prm));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
276
src/BRepTest/BRepTest_PrimitiveCommands.cxx
Executable file
276
src/BRepTest/BRepTest_PrimitiveCommands.cxx
Executable file
@@ -0,0 +1,276 @@
|
||||
// File: DBRep_1.cxx
|
||||
// Created: Thu Jul 22 11:46:12 1993
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@nonox>
|
||||
|
||||
|
||||
#include <BRepTest.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBuilderAPI.hxx>
|
||||
#include <BRepPrimAPI_MakeBox.hxx>
|
||||
#include <BRepPrimAPI_MakeWedge.hxx>
|
||||
#include <BRepPrimAPI_MakeCylinder.hxx>
|
||||
#include <BRepPrimAPI_MakeCone.hxx>
|
||||
#include <BRepPrimAPI_MakeSphere.hxx>
|
||||
#include <BRepPrimAPI_MakeTorus.hxx>
|
||||
#include <BRepPrimAPI_MakeSphere.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// box
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer box(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 5) return 1;
|
||||
Standard_Real dx = atof(a[n-3]);
|
||||
Standard_Real dy = atof(a[n-2]);
|
||||
Standard_Real dz = atof(a[n-1]);
|
||||
|
||||
TopoDS_Solid S;
|
||||
|
||||
if (n > 5) {
|
||||
if (n < 8) return 1;
|
||||
Standard_Real x = atof(a[2]);
|
||||
Standard_Real y = atof(a[3]);
|
||||
Standard_Real z = atof(a[4]);
|
||||
S = BRepPrimAPI_MakeBox(gp_Pnt(x,y,z),dx,dy,dz);
|
||||
}
|
||||
else {
|
||||
S = BRepPrimAPI_MakeBox(dx,dy,dz);
|
||||
}
|
||||
|
||||
DBRep::Set(a[1],S);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// wedge
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer wedge(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
TopoDS_Solid S;
|
||||
|
||||
// Standard_Integer i = 0;
|
||||
if ( n == 15 || n == 18) {
|
||||
gp_Pnt LocalP(atof(a[2]),atof(a[3]),atof(a[4]));
|
||||
gp_Dir LocalN(atof(a[5]),atof(a[6]),atof(a[7]));
|
||||
gp_Dir LocalVx(atof(a[8]),atof(a[9]),atof(a[10]));
|
||||
gp_Ax2 Axis(LocalP,LocalN,LocalVx);
|
||||
// gp_Ax2 Axis(gp_Pnt(atof(a[2]),atof(a[3]),atof(a[4])),
|
||||
// gp_Dir(atof(a[5]),atof(a[6]),atof(a[7])),
|
||||
// gp_Dir(atof(a[8]),atof(a[9]),atof(a[10])));
|
||||
if ( n == 15) {
|
||||
S = BRepPrimAPI_MakeWedge(Axis,
|
||||
atof(a[11]),atof(a[12]),atof(a[13]),atof(a[14]));
|
||||
}
|
||||
else {
|
||||
S = BRepPrimAPI_MakeWedge(Axis,
|
||||
atof(a[11]),atof(a[12]),atof(a[13]),
|
||||
atof(a[14]),atof(a[15]),atof(a[16]),atof(a[17]));
|
||||
}
|
||||
}
|
||||
else if (n == 6) {
|
||||
S = BRepPrimAPI_MakeWedge(atof(a[2]),atof(a[3]),atof(a[4]),atof(a[5]));
|
||||
}
|
||||
else if (n == 9){
|
||||
S = BRepPrimAPI_MakeWedge(atof(a[2]),atof(a[3]),atof(a[4]),
|
||||
atof(a[5]),atof(a[6]),atof(a[7]),atof(a[8]));
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
|
||||
DBRep::Set(a[1],S);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// cylinder
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer cylinder(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
TopoDS_Solid S;
|
||||
Handle(Geom_Plane) P =
|
||||
Handle(Geom_Plane)::DownCast(DrawTrSurf::Get(a[2]));
|
||||
|
||||
if (n == 4) {
|
||||
S = BRepPrimAPI_MakeCylinder(atof(a[2]),atof(a[3]));
|
||||
}
|
||||
else if (n == 5) {
|
||||
if (P.IsNull())
|
||||
S = BRepPrimAPI_MakeCylinder(atof(a[2]),atof(a[3]),atof(a[4]) * PI180);
|
||||
else
|
||||
S = BRepPrimAPI_MakeCylinder(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]));
|
||||
}
|
||||
else if (n == 6) {
|
||||
if (P.IsNull())
|
||||
return 1;
|
||||
else
|
||||
S = BRepPrimAPI_MakeCylinder(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]),atof(a[5]) * PI180);
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
|
||||
DBRep::Set(a[1],S);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// cone
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer cone(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
TopoDS_Solid S;
|
||||
|
||||
Handle(Geom_Plane) P =
|
||||
Handle(Geom_Plane)::DownCast(DrawTrSurf::Get(a[2]));
|
||||
|
||||
if (n == 5) {
|
||||
S = BRepPrimAPI_MakeCone(atof(a[2]),atof(a[3]),atof(a[4]));
|
||||
}
|
||||
else if (n == 6) {
|
||||
if (P.IsNull())
|
||||
S = BRepPrimAPI_MakeCone(atof(a[2]),atof(a[3]),atof(a[4]),atof(a[5]) * PI180);
|
||||
else
|
||||
S = BRepPrimAPI_MakeCone(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]),atof(a[5]));
|
||||
}
|
||||
else if (n == 7) {
|
||||
S = BRepPrimAPI_MakeCone(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]),atof(a[5]),atof(a[6]) * PI180);
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
|
||||
DBRep::Set(a[1],S);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// sphere
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer sphere(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
TopoDS_Solid S;
|
||||
|
||||
Handle(Geom_Plane) P =
|
||||
Handle(Geom_Plane)::DownCast(DrawTrSurf::Get(a[2]));
|
||||
|
||||
if (n == 3) {
|
||||
S = BRepPrimAPI_MakeSphere(atof(a[2]));
|
||||
}
|
||||
else if (n == 4) {
|
||||
if (P.IsNull())
|
||||
S = BRepPrimAPI_MakeSphere(atof(a[2]),atof(a[3]) * PI180);
|
||||
else
|
||||
S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),atof(a[3]));
|
||||
}
|
||||
else if (n == 5) {
|
||||
if (P.IsNull())
|
||||
S = BRepPrimAPI_MakeSphere(atof(a[2]),atof(a[3]) * PI180,atof(a[4]) * PI180);
|
||||
else
|
||||
S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]) * PI180);
|
||||
}
|
||||
else if (n == 6) {
|
||||
if (P.IsNull())
|
||||
S = BRepPrimAPI_MakeSphere(atof(a[2]),atof(a[3]) * PI180,atof(a[4]) * PI180,atof(a[5]) * PI180);
|
||||
else
|
||||
S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]) * PI180,atof(a[5]) * PI180);
|
||||
}
|
||||
else if (n == 7) {
|
||||
S = BRepPrimAPI_MakeSphere(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]) * PI180,atof(a[5]) * PI180,atof(a[6]) * PI180);
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
|
||||
DBRep::Set(a[1],S);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// torus
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer torus(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
TopoDS_Solid S;
|
||||
|
||||
Handle(Geom_Plane) P =
|
||||
Handle(Geom_Plane)::DownCast(DrawTrSurf::Get(a[2]));
|
||||
|
||||
if (n == 4) {
|
||||
S = BRepPrimAPI_MakeTorus(atof(a[2]),atof(a[3]));
|
||||
}
|
||||
else if (n == 5) {
|
||||
if (P.IsNull())
|
||||
S = BRepPrimAPI_MakeTorus(atof(a[2]),atof(a[3]),atof(a[4]) * PI180);
|
||||
else
|
||||
S = BRepPrimAPI_MakeTorus(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]));
|
||||
}
|
||||
else if (n == 6) {
|
||||
if (P.IsNull())
|
||||
S = BRepPrimAPI_MakeTorus(atof(a[2]),atof(a[3]),
|
||||
atof(a[4]) * PI180,atof(a[5]) * PI180);
|
||||
else
|
||||
S = BRepPrimAPI_MakeTorus(P->Pln().Position().Ax2(),
|
||||
atof(a[3]),atof(a[4]),atof(a[5]) * PI180);
|
||||
}
|
||||
else if (n == 7) {
|
||||
if (P.IsNull())
|
||||
S = BRepPrimAPI_MakeTorus(atof(a[2]),atof(a[3]),
|
||||
atof(a[4]) * PI180,atof(a[5]) * PI180,atof(a[6]) * PI180);
|
||||
else
|
||||
S = BRepPrimAPI_MakeTorus(P->Pln().Position().Ax2(),atof(a[3]),
|
||||
atof(a[4]),atof(a[5]) * PI180,atof(a[6]) * PI180);
|
||||
}
|
||||
else if (n == 8) {
|
||||
S = BRepPrimAPI_MakeTorus(P->Pln().Position().Ax2(),atof(a[3]),atof(a[4]),
|
||||
atof(a[5]) * PI180,atof(a[6]) * PI180,atof(a[7]) * PI180);
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
|
||||
DBRep::Set(a[1],S);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : PrimitiveCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::PrimitiveCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
|
||||
const char* g = "Primitive building commands";
|
||||
|
||||
theCommands.Add("box","box name [x1 y1 z1] dx dy dz",__FILE__,box,g);
|
||||
theCommands.Add("wedge","wedge name [Ox Oy Oz Zx Zy Zz Xx Xy Xz] dx dy dz ltx / xmin zmin xmax zmax",__FILE__,wedge,g);
|
||||
|
||||
theCommands.Add("pcylinder","pcylinder name [plane(ax2)] R H [angle]",__FILE__,cylinder,g);
|
||||
theCommands.Add("pcone", "pcone name [plane(ax2)] R1 R2 H [angle]",__FILE__,cone,g);
|
||||
theCommands.Add("psphere", "psphere name [plane(ax2)] R [angle1 angle2] [angle]",__FILE__,sphere,g);
|
||||
theCommands.Add("ptorus", "ptorus name [plane(ax2)] R1 R2 [angle1 angle2] [angle]",__FILE__,torus,g);
|
||||
}
|
||||
|
||||
|
98
src/BRepTest/BRepTest_ProjectionCommands.cxx
Executable file
98
src/BRepTest/BRepTest_ProjectionCommands.cxx
Executable file
@@ -0,0 +1,98 @@
|
||||
// File: BRepTest_ProjectionCommands.cxx
|
||||
// Created: Tue Mar 3 15:54:08 1998
|
||||
// Author: Didier PIFFAULT
|
||||
// <dpf@motox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <GeometryTest.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <BRepProj_Projection.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <BRepTest.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
//#ifdef WNT
|
||||
#include <stdio.h>
|
||||
//#endif
|
||||
static Standard_Integer prj(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
char newname[255];
|
||||
if (n < 7) return 1;
|
||||
TopoDS_Shape InpLine = DBRep::Get(a[2]);
|
||||
TopoDS_Shape InpShape = DBRep::Get(a[3]);
|
||||
Standard_Real DX=atof(a[4]),DY=atof(a[5]),DZ=atof(a[6]);
|
||||
gp_Dir TD(DX,DY,DZ);
|
||||
BRepProj_Projection Prj(InpLine,InpShape,TD);
|
||||
Standard_Integer i = 1;
|
||||
char* temp = newname;
|
||||
|
||||
|
||||
if (Prj.IsDone()) {
|
||||
while (Prj.More()) {
|
||||
sprintf(newname,"%s_%d",a[1],i);
|
||||
DBRep::Set(temp,Prj.Current());
|
||||
//cout<<newname<<" ";
|
||||
di<<newname<<" ";
|
||||
i++;
|
||||
Prj.Next();
|
||||
}
|
||||
}
|
||||
|
||||
//cout<<endl;
|
||||
di<<"\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer cprj(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
char newname[255];
|
||||
if (n < 7) return 1;
|
||||
TopoDS_Shape InpLine = DBRep::Get(a[2]);
|
||||
TopoDS_Shape InpShape = DBRep::Get(a[3]);
|
||||
Standard_Real PX=atof(a[4]),PY=atof(a[5]),PZ=atof(a[6]);
|
||||
gp_Pnt P(PX,PY,PZ);
|
||||
BRepProj_Projection Prj(InpLine,InpShape,P);
|
||||
Standard_Integer i = 1;
|
||||
char* temp = newname;
|
||||
|
||||
if (Prj.IsDone()) {
|
||||
while (Prj.More()) {
|
||||
sprintf(newname,"%s_%d",a[1],i);
|
||||
DBRep::Set(temp,Prj.Current());
|
||||
//cout<<newname<<" ";
|
||||
di<<newname<<" ";
|
||||
i++;
|
||||
Prj.Next();
|
||||
}
|
||||
}
|
||||
|
||||
//cout<<endl;
|
||||
di<<"\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************/
|
||||
|
||||
void BRepTest::ProjectionCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean loaded = Standard_False;
|
||||
if (loaded) return;
|
||||
loaded = Standard_True;
|
||||
|
||||
const char* g = "Projection of wire commands";
|
||||
|
||||
theCommands.Add("prj","prj result w s x y z: cylindrical projection of w (wire or edge) on s (faces) along direction",
|
||||
__FILE__,
|
||||
prj,g);
|
||||
|
||||
|
||||
theCommands.Add("cprj","cprj result w s x y z: conical projection of w (wire or edge) on s (faces)",
|
||||
__FILE__,
|
||||
cprj,g);
|
||||
|
||||
}
|
||||
|
118
src/BRepTest/BRepTest_ShellCommands.cxx
Executable file
118
src/BRepTest/BRepTest_ShellCommands.cxx
Executable file
@@ -0,0 +1,118 @@
|
||||
// File: BRepTest_ShellCommands.cxx
|
||||
// Created: Mon Dec 21 10:19:27 1998
|
||||
// Author: Michael KAZAKOV
|
||||
// <mko@vladox.nnov.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <BRepTest.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepOffset.hxx>
|
||||
#include <BRepOffsetAPI_MakeThickSolid.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
|
||||
|
||||
|
||||
static Standard_Boolean issame(TopoDS_Face& face, TopoDS_Face& newface)
|
||||
{
|
||||
TopExp_Explorer exp(face,TopAbs_VERTEX),newexp(newface,TopAbs_VERTEX);
|
||||
Standard_Integer newcounter=0,counter=0;
|
||||
for (;exp.More();exp.Next())
|
||||
{
|
||||
counter++;
|
||||
gp_Pnt p(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current())));
|
||||
for (;newexp.More();newexp.Next())
|
||||
{
|
||||
gp_Pnt newp(BRep_Tool::Pnt(TopoDS::Vertex(newexp.Current())));
|
||||
if (p.IsEqual(newp,1e-7))
|
||||
{
|
||||
newcounter++;
|
||||
break;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (counter==newcounter)
|
||||
return Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
static TopoDS_Face findface(TopoDS_Shape& shape, TopoDS_Face& face)
|
||||
{
|
||||
TopoDS_Face newface;
|
||||
TopExp_Explorer exp(shape,TopAbs_FACE);
|
||||
for (;exp.More();exp.Next())
|
||||
{
|
||||
newface = TopoDS::Face(exp.Current());
|
||||
if (issame(face,newface))
|
||||
{
|
||||
break;
|
||||
};
|
||||
};
|
||||
return newface;
|
||||
}
|
||||
|
||||
static Standard_Integer shell(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
TopoDS_Shape Shape = DBRep::Get(a[1]);
|
||||
TopTools_ListOfShape ListOfCorks;
|
||||
//cout <<"You have "<<n-2<<" of the reference faces" << endl;
|
||||
di <<"You have "<<n-2<<" of the reference faces" << "\n";
|
||||
Standard_Integer i=2;
|
||||
for (;i<n;i++)
|
||||
{
|
||||
//cout <<i-1<<"th element"<< endl;
|
||||
di <<i-1<<"th element"<< "\n";
|
||||
// ListOfCorks.Append(findface(Shape,TopoDS::Face(DBRep::Get(a[i]))));
|
||||
TopoDS_Shape aLocalFace(DBRep::Get(a[i]));
|
||||
ListOfCorks.Append(findface(Shape,(TopoDS_Face &) TopoDS::Face(aLocalFace)));
|
||||
// ListOfCorks.Append(findface(Shape,(TopoDS_Face &) TopoDS::Face(DBRep::Get(a[i]))));
|
||||
}
|
||||
Standard_Real Tol = 1e-5;
|
||||
Standard_Real OffsetValue = 1;
|
||||
OffsetValue = -OffsetValue; // Offset > 0 = Interior.
|
||||
BRepOffsetAPI_MakeThickSolid MKTS (Shape,
|
||||
ListOfCorks,
|
||||
OffsetValue,
|
||||
Tol,
|
||||
BRepOffset_Skin,
|
||||
1, Standard_False);
|
||||
|
||||
DBRep::Set("Result.brep",MKTS.Shape());
|
||||
TopTools_ListOfShape Larg;
|
||||
Larg.Append(Shape);
|
||||
//Check if the shape has at least one face
|
||||
TopExp_Explorer FExp (MKTS.Shape (), TopAbs_FACE);
|
||||
if (FExp.More ()) {
|
||||
//cout << "Standard_True"<<endl;
|
||||
di << "Standard_True"<<"\n";
|
||||
}
|
||||
DBRep::Set("S",MKTS.Shape());
|
||||
return 0;
|
||||
}
|
||||
/*********************************************************************************/
|
||||
|
||||
void BRepTest::ShellCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean loaded = Standard_False;
|
||||
if (loaded) return;
|
||||
loaded = Standard_True;
|
||||
|
||||
const char* g = "Projection of wire commands";
|
||||
|
||||
theCommands.Add("shell","Make shell on bugged object",
|
||||
__FILE__,
|
||||
shell,g);
|
||||
|
||||
}
|
433
src/BRepTest/BRepTest_SurfaceCommands.cxx
Executable file
433
src/BRepTest/BRepTest_SurfaceCommands.cxx
Executable file
@@ -0,0 +1,433 @@
|
||||
// File: DBRep_4.cxx
|
||||
// Created: Thu Jul 22 16:39:43 1993
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@nonox>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <BRepTest.hxx>
|
||||
#include <GeometryTest.hxx>
|
||||
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <BRepTools_Quilt.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRepBuilderAPI_MakeShell.hxx>
|
||||
#include <BRepBuilderAPI.hxx>
|
||||
#include <BRepBuilderAPI_Sewing.hxx>
|
||||
#include <BRepOffsetAPI_FindContigousEdges.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom2d_TrimmedCurve.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
//#define strcasecmp strcmp Already defined
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// suppressarg : suppress a[d],modifie na--
|
||||
//-----------------------------------------------------------------------
|
||||
static void suppressarg(Standard_Integer& na,const char** a,const Standard_Integer d)
|
||||
{
|
||||
for(Standard_Integer i=d;i<na;i++) {
|
||||
a[i]=a[i+1];
|
||||
a[i+1]=NULL;
|
||||
}
|
||||
na--;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// mkface
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer mkface(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
|
||||
Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[2]);
|
||||
if (S.IsNull()) {
|
||||
cout << a[2] << " is not a surface" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Boolean mkface = a[0][2] == 'f';
|
||||
TopoDS_Shape res;
|
||||
|
||||
Standard_Boolean Segment = Standard_False;
|
||||
if ( !mkface && (n == 4 || n == 8)) {
|
||||
Segment = !strcmp(a[n-1],"1");
|
||||
n--;
|
||||
}
|
||||
|
||||
if (n == 3) {
|
||||
if (mkface)
|
||||
res = BRepBuilderAPI_MakeFace(S);
|
||||
else
|
||||
res = BRepBuilderAPI_MakeShell(S,Segment);
|
||||
}
|
||||
else if (n <= 5) {
|
||||
if (!mkface) return 1;
|
||||
Standard_Boolean orient = (n == 4);
|
||||
TopoDS_Shape W = DBRep::Get(a[3],TopAbs_WIRE);
|
||||
if (W.IsNull()) return 1;
|
||||
res = BRepBuilderAPI_MakeFace(S,TopoDS::Wire(W),orient);
|
||||
}
|
||||
else {
|
||||
if (mkface)
|
||||
res = BRepBuilderAPI_MakeFace(S,atof(a[3]),atof(a[4]),atof(a[5]),atof(a[6]));
|
||||
else
|
||||
res = BRepBuilderAPI_MakeShell(S,atof(a[3]),atof(a[4]),atof(a[5]),atof(a[6]),
|
||||
Segment);
|
||||
}
|
||||
|
||||
DBRep::Set(a[1],res);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// quilt
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer quilt(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 4) return 1;
|
||||
BRepTools_Quilt Q;
|
||||
|
||||
Standard_Integer i = 2;
|
||||
while (i < n) {
|
||||
TopoDS_Shape S = DBRep::Get(a[i]);
|
||||
if (!S.IsNull()) {
|
||||
if (S.ShapeType() == TopAbs_EDGE) {
|
||||
if (i+1 < n) {
|
||||
TopoDS_Shape E = DBRep::Get(a[i+1]);
|
||||
if (!E.IsNull()) {
|
||||
if (E.ShapeType() == TopAbs_EDGE) {
|
||||
i++;
|
||||
Q.Bind(TopoDS::Edge(S),TopoDS::Edge(E));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (S.ShapeType() == TopAbs_VERTEX) {
|
||||
if (i+1 < n) {
|
||||
TopoDS_Shape E = DBRep::Get(a[i+1]);
|
||||
if (!E.IsNull()) {
|
||||
if (E.ShapeType() == TopAbs_VERTEX) {
|
||||
i++;
|
||||
Q.Bind(TopoDS::Vertex(S),TopoDS::Vertex(E));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Q.Add(S);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
DBRep::Set(a[1],Q.Shells());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// mksurface
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer mksurface(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
|
||||
TopoDS_Shape S = DBRep::Get(a[2],TopAbs_FACE);
|
||||
if (S.IsNull()) return 1;
|
||||
TopLoc_Location L;
|
||||
Handle(Geom_Surface) C = BRep_Tool::Surface(TopoDS::Face(S),L);
|
||||
|
||||
|
||||
DrawTrSurf::Set(a[1],C->Transformed(L.Transformation()));
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// mkplane
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer mkplane(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3) return 1;
|
||||
|
||||
TopoDS_Shape S = DBRep::Get(a[2],TopAbs_WIRE);
|
||||
if (S.IsNull()) return 1;
|
||||
|
||||
Standard_Boolean OnlyPlane = Standard_False;
|
||||
if ( n == 4) {
|
||||
OnlyPlane = !strcmp(a[3],"1");
|
||||
}
|
||||
|
||||
TopoDS_Face F = BRepBuilderAPI_MakeFace(TopoDS::Wire(S), OnlyPlane);
|
||||
|
||||
DBRep::Set(a[1],F);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// pcurve
|
||||
//=======================================================================
|
||||
Standard_IMPORT Draw_Color DrawTrSurf_CurveColor(const Draw_Color col);
|
||||
Standard_IMPORT void DBRep_WriteColorOrientation ();
|
||||
Standard_IMPORT Draw_Color DBRep_ColorOrientation (const TopAbs_Orientation Or);
|
||||
|
||||
static Standard_Integer pcurve(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
Standard_Boolean mute = Standard_False;
|
||||
for(Standard_Integer ia=1;ia<n;ia++) {
|
||||
if (!strcasecmp(a[ia],"-mute")) {
|
||||
suppressarg(n,a,ia);
|
||||
mute = Standard_True;
|
||||
}
|
||||
}
|
||||
|
||||
if (n == 2) {
|
||||
// pcurves of a face
|
||||
TopoDS_Shape S = DBRep::Get(a[1],TopAbs_FACE);
|
||||
if (S.IsNull()) return 1;
|
||||
|
||||
if (!mute) DBRep_WriteColorOrientation();
|
||||
Draw_Color col, savecol = DrawTrSurf_CurveColor(Draw_rouge);
|
||||
|
||||
char* name = new char[100];
|
||||
Standard_Real f,l;
|
||||
S.Orientation(TopAbs_FORWARD);
|
||||
TopExp_Explorer ex(S,TopAbs_EDGE);
|
||||
for (Standard_Integer i=1; ex.More(); ex.Next(), i++) {
|
||||
const Handle(Geom2d_Curve) c = BRep_Tool::CurveOnSurface
|
||||
(TopoDS::Edge(ex.Current()),TopoDS::Face(S),f,l);
|
||||
if ( c.IsNull() ) {
|
||||
cout << "Error: Edge " << i << " does not have pcurve" << endl;
|
||||
continue;
|
||||
}
|
||||
col = DBRep_ColorOrientation(ex.Current().Orientation());
|
||||
DrawTrSurf_CurveColor(col);
|
||||
|
||||
sprintf(name,"%s_%d",a[1],i);
|
||||
DrawTrSurf::Set(name,new Geom2d_TrimmedCurve(c,f,l));
|
||||
}
|
||||
DrawTrSurf_CurveColor(savecol);
|
||||
|
||||
}
|
||||
else if (n >= 4) {
|
||||
TopoDS_Shape SE = DBRep::Get(a[2],TopAbs_EDGE);
|
||||
if (SE.IsNull()) return 1;
|
||||
TopoDS_Shape SF = DBRep::Get(a[3],TopAbs_FACE);
|
||||
if (SF.IsNull()) return 1;
|
||||
|
||||
Draw_Color col, savecol = DrawTrSurf_CurveColor(Draw_rouge);
|
||||
Standard_Real f,l;
|
||||
const Handle(Geom2d_Curve) c = BRep_Tool::CurveOnSurface
|
||||
(TopoDS::Edge(SE),TopoDS::Face(SF),f,l);
|
||||
|
||||
col = DBRep_ColorOrientation(SE.Orientation());
|
||||
DrawTrSurf_CurveColor(col);
|
||||
DrawTrSurf::Set(a[1],new Geom2d_TrimmedCurve(c,f,l));
|
||||
DrawTrSurf_CurveColor(savecol);
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// sewing
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer sewing (Draw_Interpretor& ,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 3) return (1);
|
||||
|
||||
BRepBuilderAPI_Sewing aSewing;
|
||||
Standard_Integer ntmp = n;
|
||||
|
||||
TopoDS_Shape sh = DBRep::Get(a[2]);
|
||||
Standard_Integer i=2;
|
||||
Standard_Real tol = 1.0e-06;
|
||||
if (sh.IsNull()) {
|
||||
if (n < 4) return (1);
|
||||
tol = atof(a[2]);
|
||||
//Standard_Real tol = atof(a[2]);
|
||||
//aSewing.Init(tol, Standard_True,Standard_True,Standard_True,Standard_False);
|
||||
i = 3;
|
||||
}
|
||||
|
||||
Standard_Boolean NonManifoldMode = Standard_False;
|
||||
sh = DBRep::Get(a[n-1]);
|
||||
if (sh.IsNull()) {
|
||||
// read non manifold mode
|
||||
Standard_Integer nmm = atoi(a[n-1]);
|
||||
if(nmm==1)
|
||||
NonManifoldMode = Standard_True;
|
||||
ntmp--;
|
||||
}
|
||||
|
||||
aSewing.Init(tol, Standard_True,Standard_True,Standard_True,NonManifoldMode);
|
||||
|
||||
while (i < ntmp) {
|
||||
sh = DBRep::Get(a[i]);
|
||||
aSewing.Add(sh);
|
||||
i++;
|
||||
}
|
||||
|
||||
aSewing.Perform();
|
||||
aSewing.Dump();
|
||||
|
||||
const TopoDS_Shape& sh2 = aSewing.SewedShape();
|
||||
if (!sh2.IsNull()) {
|
||||
DBRep::Set(a[1], sh2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// continuity
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer continuity (Draw_Interpretor& ,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 2) return (1);
|
||||
|
||||
BRepOffsetAPI_FindContigousEdges aFind;
|
||||
|
||||
TopoDS_Shape sh = DBRep::Get(a[1]);
|
||||
Standard_Integer i=1;
|
||||
if (sh.IsNull()) {
|
||||
if (n < 3) return (1);
|
||||
Standard_Real tol = atof(a[1]);
|
||||
aFind.Init(tol, Standard_False);
|
||||
i = 2;
|
||||
}
|
||||
|
||||
while (i < n) {
|
||||
sh = DBRep::Get(a[i]);
|
||||
aFind.Add(sh);
|
||||
i++;
|
||||
}
|
||||
|
||||
aFind.Perform();
|
||||
aFind.Dump();
|
||||
|
||||
for (i=1; i<=aFind.NbContigousEdges(); i++) {
|
||||
#ifdef DEB
|
||||
const TopoDS_Edge& edge =
|
||||
#endif
|
||||
aFind.ContigousEdge(i);
|
||||
const TopTools_ListOfShape& list = aFind.ContigousEdgeCouple(i);
|
||||
const TopoDS_Edge& sec1 = TopoDS::Edge(list.First());
|
||||
const TopoDS_Edge& sec2 = TopoDS::Edge(list.Last());
|
||||
#ifdef DEB
|
||||
const TopoDS_Edge& bound1 =
|
||||
#endif
|
||||
aFind.SectionToBoundary(sec1);
|
||||
#ifdef DEB
|
||||
const TopoDS_Edge& bound2 =
|
||||
#endif
|
||||
aFind.SectionToBoundary(sec2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// encoderegularity
|
||||
//=======================================================================
|
||||
static Standard_Integer encoderegularity (Draw_Interpretor& ,
|
||||
Standard_Integer n, const char** a)
|
||||
|
||||
{
|
||||
if (n < 2) return 1;
|
||||
TopoDS_Shape sh = DBRep::Get(a[1]);
|
||||
if (sh.IsNull()) return 1;
|
||||
if (n==2)
|
||||
BRepLib::EncodeRegularity(sh);
|
||||
else {
|
||||
Standard_Real Tol = atof(a[2]);
|
||||
Tol *= PI/180.;
|
||||
BRepLib::EncodeRegularity(sh, Tol);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SurfaceCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::SurfaceCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
GeometryTest::SurfaceCommands(theCommands);
|
||||
|
||||
const char* g = "Surface topology commands";
|
||||
|
||||
theCommands.Add("mkface",
|
||||
"mkface facename surfacename [ufirst ulast vfirst vlast] [wire [norient]]",
|
||||
__FILE__,mkface,g);
|
||||
|
||||
theCommands.Add("mkshell",
|
||||
"mkshell shellname surfacename [ufirst ulast vfirst vlast] [segment 0/1]",
|
||||
__FILE__,mkface,g);
|
||||
|
||||
theCommands.Add("quilt",
|
||||
"quilt compoundname shape1 edgeshape2 edgeshape1... shape2 edgeshape3 edgeshape1or2 ... shape3 ...",
|
||||
__FILE__,quilt,g);
|
||||
|
||||
theCommands.Add("mksurface",
|
||||
"mksurface surfacename facename",
|
||||
__FILE__,mksurface,g);
|
||||
|
||||
theCommands.Add("mkplane",
|
||||
"mkplane facename wirename [OnlyPlane 0/1]",
|
||||
__FILE__,mkplane,g);
|
||||
|
||||
theCommands.Add("pcurve",
|
||||
"pcurve [name edgename] facename",
|
||||
__FILE__,pcurve,g);
|
||||
|
||||
theCommands.Add("sewing",
|
||||
"sewing result [tolerance] shape1 shape2 ...",
|
||||
__FILE__,sewing, g);
|
||||
|
||||
theCommands.Add("continuity",
|
||||
"continuity [tolerance] shape1 shape2 ...",
|
||||
__FILE__,continuity, g);
|
||||
|
||||
theCommands.Add("encoderegularity",
|
||||
"encoderegularity shape [tolerance (in degree)]",
|
||||
__FILE__,encoderegularity, g);
|
||||
}
|
||||
|
827
src/BRepTest/BRepTest_SweepCommands.cxx
Executable file
827
src/BRepTest/BRepTest_SweepCommands.cxx
Executable file
@@ -0,0 +1,827 @@
|
||||
// File: BRepTest_SweepCommands.cxx
|
||||
// Created: Thu Jul 22 16:40:19 1993
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@nonox>
|
||||
|
||||
|
||||
|
||||
#include <BRepTest.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
|
||||
#include <BRepFill.hxx>
|
||||
#include <BRepBuilderAPI_PipeError.hxx>
|
||||
#include <BRepFill_Generator.hxx>
|
||||
#include <BRepPrimAPI_MakePrism.hxx>
|
||||
#include <BRepPrimAPI_MakeRevol.hxx>
|
||||
#include <BRepOffsetAPI_MakePipe.hxx>
|
||||
#include <BRepOffsetAPI_MakeEvolved.hxx>
|
||||
#include <BRepOffsetAPI_ThruSections.hxx>
|
||||
#include <BRepOffsetAPI_MakePipeShell.hxx>
|
||||
|
||||
#include <BRepLib_MakeWire.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <Law_Interpol.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
|
||||
static BRepOffsetAPI_MakePipeShell* Sweep= 0;
|
||||
|
||||
//#ifdef WNT
|
||||
#include <stdio.h>
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <GeomAdaptor_HCurve.hxx>
|
||||
#include <GeomFill_Pipe.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
//#endi#include <gp_Vec.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// prism
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer prism(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 6) return 1;
|
||||
|
||||
TopoDS_Shape base = DBRep::Get(a[2]);
|
||||
if (base.IsNull()) return 1;
|
||||
|
||||
gp_Vec V(atof(a[3]),atof(a[4]),atof(a[5]));
|
||||
|
||||
Standard_Boolean copy = Standard_False;
|
||||
Standard_Boolean inf = Standard_False;
|
||||
Standard_Boolean sinf = Standard_False;
|
||||
|
||||
if (n > 6) {
|
||||
copy = (*a[6] == 'c') || (*a[6] == 'C');
|
||||
inf = (*a[6] == 'i') || (*a[6] == 'I');
|
||||
sinf = (*a[6] == 's') || (*a[6] == 'S');
|
||||
}
|
||||
|
||||
TopoDS_Shape res;
|
||||
|
||||
if (inf || sinf)
|
||||
res = BRepPrimAPI_MakePrism(base,gp_Dir(V),inf);
|
||||
else
|
||||
res = BRepPrimAPI_MakePrism(base,V,copy);
|
||||
|
||||
DBRep::Set(a[1],res);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// revol
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer revol(Draw_Interpretor& ,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 10) return 1;
|
||||
|
||||
TopoDS_Shape base = DBRep::Get(a[2]);
|
||||
if (base.IsNull()) return 1;
|
||||
|
||||
gp_Pnt P(atof(a[3]),atof(a[4]),atof(a[5]));
|
||||
gp_Dir D(atof(a[6]),atof(a[7]),atof(a[8]));
|
||||
gp_Ax1 A(P,D);
|
||||
|
||||
Standard_Real angle = atof(a[9]) * PI180;
|
||||
|
||||
Standard_Boolean copy = n > 10;
|
||||
|
||||
TopoDS_Shape res = BRepPrimAPI_MakeRevol(base,A,angle,copy);
|
||||
|
||||
DBRep::Set(a[1],res);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// pipe
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer pipe(Draw_Interpretor& ,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n < 4) return 1;
|
||||
|
||||
TopoDS_Shape Spine = DBRep::Get(a[2],TopAbs_WIRE);
|
||||
if ( Spine.IsNull()) return 1;
|
||||
|
||||
TopoDS_Shape Profile = DBRep::Get(a[3]);
|
||||
if ( Profile.IsNull()) return 1;
|
||||
|
||||
TopoDS_Shape S = BRepOffsetAPI_MakePipe(TopoDS::Wire(Spine),Profile);
|
||||
|
||||
DBRep::Set(a[1],S);
|
||||
|
||||
return 0;
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer geompipe(Draw_Interpretor& ,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
TopoDS_Shape Spine = DBRep::Get(a[2],TopAbs_EDGE);
|
||||
if ( Spine.IsNull()) return 1;
|
||||
if ( n < 5) return 1;
|
||||
TopoDS_Shape Profile = DBRep::Get(a[3],TopAbs_EDGE);
|
||||
if ( Profile.IsNull()) return 1;
|
||||
Standard_Real aSpFirst,aSpLast,aPrFirst,aPrLast;
|
||||
Handle(Geom_Curve) SpineCurve = BRep_Tool::Curve(TopoDS::Edge(Spine),aSpFirst,aSpLast);
|
||||
Handle(Geom_Curve) ProfileCurve = BRep_Tool::Curve(TopoDS::Edge(Profile),aPrFirst,aPrLast);
|
||||
Handle(GeomAdaptor_HCurve) aAdaptCurve = new GeomAdaptor_HCurve(SpineCurve,aSpFirst,aSpLast);
|
||||
Standard_Boolean ByACR = Standard_False;
|
||||
Standard_Boolean rotate = Standard_False;
|
||||
Standard_Real Radius = atof(a[4]);
|
||||
gp_Pnt ctr;
|
||||
gp_Vec norm;
|
||||
ProfileCurve->D1(aSpFirst,ctr,norm);
|
||||
gp_Vec xAxisStart(ctr,SpineCurve->Value(aSpFirst));
|
||||
gp_Ax2 aAx2Start(ctr,norm,xAxisStart);
|
||||
Handle(Geom_Circle) cStart=new Geom_Circle(aAx2Start,Radius);
|
||||
Standard_Integer k =5;
|
||||
if(n > k)
|
||||
ByACR = (atoi(a[k++]) ==1);
|
||||
if(n > k)
|
||||
rotate = (atoi(a[k++])==1);
|
||||
GeomFill_Pipe aPipe(ProfileCurve,aAdaptCurve,cStart,ByACR,rotate);
|
||||
aPipe.Perform(Standard_True);
|
||||
Handle(Geom_Surface) Sur=aPipe.Surface();
|
||||
TopoDS_Face F;
|
||||
if(!Sur.IsNull())
|
||||
F =BRepBuilderAPI_MakeFace(Sur);
|
||||
DBRep::Set(a[1],F);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : evolved
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer evolved(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n == 1) {
|
||||
//cout << " 1) evolved result base profil : "<< endl;
|
||||
//cout << " The relative position of the profil on the base" << endl;
|
||||
//cout << " is given in the referencial axis. " << endl;
|
||||
//cout << " 2) evolved result base profil o : "<< endl;
|
||||
//cout << " This position is automatically computed." << endl;
|
||||
di << " 1) evolved result base profil : "<< "\n";
|
||||
di << " The relative position of the profil on the base" << "\n";
|
||||
di << " is given in the referencial axis. " << "\n";
|
||||
di << " 2) evolved result base profil o : "<< "\n";
|
||||
di << " This position is automatically computed." << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( n < 4 ) return 1;
|
||||
Standard_Boolean IsAFace = Standard_False;
|
||||
Standard_Boolean Solid = (!strcmp(a[0],"evolvedsolid"));
|
||||
|
||||
|
||||
|
||||
TopoDS_Shape Base = DBRep::Get(a[2],TopAbs_WIRE,Standard_False);
|
||||
if ( Base.IsNull()) {
|
||||
Base = DBRep::Get(a[2],TopAbs_FACE,Standard_False);
|
||||
IsAFace = Standard_True;
|
||||
}
|
||||
if ( Base.IsNull()) return 1;
|
||||
|
||||
TopoDS_Shape InpuTShape(DBRep::Get(a[3],TopAbs_WIRE,Standard_False));
|
||||
TopoDS_Wire Prof = TopoDS::Wire(InpuTShape);
|
||||
// TopoDS_Wire Prof =
|
||||
// TopoDS::Wire(DBRep::Get(a[3],TopAbs_WIRE,Standard_False));
|
||||
if ( Prof.IsNull()) return 1;
|
||||
|
||||
if (IsAFace) {
|
||||
TopoDS_Shape Volevo
|
||||
= BRepOffsetAPI_MakeEvolved(TopoDS::Face(Base),Prof,GeomAbs_Arc,n == 4,Solid);
|
||||
DBRep::Set(a[1],Volevo);
|
||||
}
|
||||
else {
|
||||
TopoDS_Shape Volevo
|
||||
= BRepOffsetAPI_MakeEvolved(TopoDS::Wire(Base),Prof,GeomAbs_Arc,n == 4,Solid);
|
||||
DBRep::Set(a[1],Volevo);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : pruled
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer pruled(Draw_Interpretor& ,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n != 4) return 1;
|
||||
|
||||
Standard_Boolean YaWIRE = Standard_False;
|
||||
TopoDS_Shape S1 = DBRep::Get(a[2],TopAbs_EDGE);
|
||||
if ( S1.IsNull()) {
|
||||
S1 = DBRep::Get(a[2],TopAbs_WIRE);
|
||||
if (S1.IsNull()) return 1;
|
||||
YaWIRE = Standard_True;
|
||||
}
|
||||
|
||||
TopoDS_Shape S2 = DBRep::Get(a[3],TopAbs_EDGE);
|
||||
if ( S2.IsNull()) {
|
||||
S2 = DBRep::Get(a[3],TopAbs_WIRE);
|
||||
if ( S2.IsNull()) return 1;
|
||||
if (!YaWIRE) {
|
||||
S1 = BRepLib_MakeWire(TopoDS::Edge(S1));
|
||||
YaWIRE = Standard_True;
|
||||
}
|
||||
}
|
||||
else if ( YaWIRE) {
|
||||
S2 = BRepLib_MakeWire(TopoDS::Edge(S2));
|
||||
}
|
||||
|
||||
TopoDS_Shape Result;
|
||||
if ( YaWIRE) {
|
||||
Result = BRepFill::Shell(TopoDS::Wire(S1),TopoDS::Wire(S2));
|
||||
}
|
||||
else {
|
||||
Result = BRepFill::Face(TopoDS::Edge(S1),TopoDS::Edge(S2));
|
||||
}
|
||||
|
||||
DBRep::Set(a[1],Result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : gener
|
||||
//purpose : Create a surface between generating wires
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer gener(Draw_Interpretor&, Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n < 4) return 1;
|
||||
|
||||
TopoDS_Shape Shape;
|
||||
|
||||
BRepFill_Generator Generator;
|
||||
|
||||
for ( Standard_Integer i = 2; i<= n-1 ; i++) {
|
||||
Shape = DBRep::Get(a[i],TopAbs_WIRE);
|
||||
if ( Shape.IsNull())
|
||||
return 1;
|
||||
|
||||
Generator.AddWire(TopoDS::Wire(Shape));
|
||||
}
|
||||
|
||||
Generator.Perform();
|
||||
|
||||
TopoDS_Shell Shell = Generator.Shell();
|
||||
|
||||
DBRep::Set(a[1], Shell);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : thrusections
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer thrusections(Draw_Interpretor&, Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n<6) return 1;
|
||||
|
||||
Standard_Boolean check = Standard_True;
|
||||
Standard_Boolean samenumber = Standard_True;
|
||||
Standard_Integer index = 2;
|
||||
// Lecture option
|
||||
if (!strcmp(a[1],"-N")) {
|
||||
if (n<7) return 1;
|
||||
check = Standard_False;
|
||||
index++;
|
||||
}
|
||||
|
||||
TopoDS_Shape Shape;
|
||||
|
||||
Standard_Boolean issolid = ( atoi(a[index]) == 1 );
|
||||
Standard_Boolean isruled = ( atoi(a[index+1]) == 1 );
|
||||
|
||||
BRepOffsetAPI_ThruSections Generator(issolid,isruled);
|
||||
|
||||
Standard_Integer NbEdges = 0;
|
||||
Standard_Boolean IsFirstWire = Standard_False;
|
||||
for ( Standard_Integer i = index+2; i<= n-1 ; i++) {
|
||||
Standard_Boolean IsWire = Standard_True;
|
||||
Shape = DBRep::Get(a[i], TopAbs_WIRE);
|
||||
if (!Shape.IsNull())
|
||||
{
|
||||
Generator.AddWire(TopoDS::Wire(Shape));
|
||||
if (!IsFirstWire)
|
||||
IsFirstWire = Standard_True;
|
||||
else
|
||||
IsFirstWire = Standard_False;
|
||||
}
|
||||
else
|
||||
{
|
||||
Shape = DBRep::Get(a[i], TopAbs_VERTEX);
|
||||
IsWire = Standard_False;
|
||||
if (!Shape.IsNull())
|
||||
Generator.AddVertex(TopoDS::Vertex(Shape));
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Integer cpt = 0;
|
||||
TopExp_Explorer PE;
|
||||
for (PE.Init(Shape, TopAbs_EDGE); PE.More(); PE.Next()) {
|
||||
cpt++;
|
||||
}
|
||||
if (IsFirstWire)
|
||||
NbEdges = cpt;
|
||||
else
|
||||
if (IsWire && cpt != NbEdges)
|
||||
samenumber = Standard_False;
|
||||
|
||||
}
|
||||
|
||||
check = (check || !samenumber);
|
||||
Generator.CheckCompatibility(check);
|
||||
|
||||
Generator.Build();
|
||||
|
||||
TopoDS_Shape Shell = Generator.Shape();
|
||||
|
||||
DBRep::Set(a[index-1], Shell);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// mksweep
|
||||
//=======================================================================
|
||||
static Standard_Integer mksweep(Draw_Interpretor& ,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n != 2) return 1;
|
||||
TopoDS_Shape Spine = DBRep::Get(a[1],TopAbs_WIRE);
|
||||
if ( Spine.IsNull()) return 1;
|
||||
if (Sweep !=0) {
|
||||
delete Sweep;
|
||||
Sweep = 0;
|
||||
}
|
||||
Sweep = new BRepOffsetAPI_MakePipeShell(TopoDS::Wire(Spine));
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// setsweep
|
||||
//=======================================================================
|
||||
static Standard_Integer setsweep(Draw_Interpretor& di,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n == 1) {
|
||||
//cout << "setsweep options [arg1 [arg2 [...]]] : options are :" << endl;
|
||||
//cout << " -FR : Tangent and Normal are given by Frenet trihedron" <<endl;
|
||||
//cout << " -CF : Tangente is given by Frenet," << endl;
|
||||
//cout << " the Normal is computed to minimize the torsion " << endl;
|
||||
//cout << " -DX Surf : Tangent and Normal are given by Darboux trihedron,"
|
||||
// <<endl;
|
||||
//cout << " Surf have to be a shell or a face" <<endl;
|
||||
//cout << " -CN dx dy dz : BiNormal is given by dx dy dz" << endl;
|
||||
//cout << " -FX Tx Ty TZ [Nx Ny Nz] : Tangent and Normal are fixed" <<endl;
|
||||
//cout << " -G guide 0|1(ACR|Plan) 0|1(contact|no contact) : with guide"<<endl;
|
||||
di << "setsweep options [arg1 [arg2 [...]]] : options are :" << "\n";
|
||||
di << " -FR : Tangent and Normal are given by Frenet trihedron" <<"\n";
|
||||
di << " -CF : Tangente is given by Frenet," << "\n";
|
||||
di << " the Normal is computed to minimize the torsion " << "\n";
|
||||
di << " -DX Surf : Tangent and Normal are given by Darboux trihedron," <<"\n";
|
||||
di << " Surf have to be a shell or a face" <<"\n";
|
||||
di << " -CN dx dy dz : BiNormal is given by dx dy dz" << "\n";
|
||||
di << " -FX Tx Ty TZ [Nx Ny Nz] : Tangent and Normal are fixed" <<"\n";
|
||||
di << " -G guide 0|1(ACR|Plan) 0|1(contact|no contact) : with guide"<<"\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Sweep ==0) {
|
||||
//cout << "You have forgotten the <<mksweep>> command !"<< endl;
|
||||
di << "You have forgotten the <<mksweep>> command !"<< "\n";
|
||||
return 1;
|
||||
}
|
||||
if (!strcmp(a[1],"-FR")) {
|
||||
Sweep->SetMode(Standard_True);
|
||||
}
|
||||
else if (!strcmp(a[1],"-CF")) {
|
||||
Sweep->SetMode(Standard_False);
|
||||
}
|
||||
else if (!strcmp(a[1],"-DX")) {
|
||||
if (n!=3) {
|
||||
//cout << "bad arguments !" << endl;
|
||||
di << "bad arguments !" << "\n";
|
||||
return 1;
|
||||
}
|
||||
TopoDS_Shape Surf;
|
||||
Surf = DBRep::Get(a[2],TopAbs_SHAPE);
|
||||
if (Surf.IsNull()) {
|
||||
//cout << a[2] <<"is not a shape !" << endl;
|
||||
di << a[2] <<"is not a shape !" << "\n";
|
||||
return 1;
|
||||
}
|
||||
Sweep->SetMode(Surf);
|
||||
}
|
||||
else if (!strcmp(a[1],"-CN")) {
|
||||
if (n!=5) {
|
||||
//cout << "bad arguments !" << endl;
|
||||
di << "bad arguments !" << "\n";
|
||||
return 1;
|
||||
}
|
||||
gp_Dir D(atof(a[2]), atof(a[3]), atof(a[4]));
|
||||
Sweep->SetMode(D);;
|
||||
}
|
||||
else if (!strcmp(a[1],"-FX")) {
|
||||
if ((n!=5)&&(n!=8)) {
|
||||
//cout << "bad arguments !" << endl;
|
||||
di << "bad arguments !" << "\n";
|
||||
return 1;
|
||||
}
|
||||
gp_Dir D(atof(a[2]), atof(a[3]), atof(a[4]));
|
||||
if (n==8) {
|
||||
gp_Dir DN(atof(a[5]), atof(a[6]), atof(a[7]));
|
||||
gp_Ax2 Axe(gp_Pnt(0., 0., 0.), D, DN);
|
||||
Sweep->SetMode(Axe);
|
||||
}
|
||||
else {
|
||||
gp_Ax2 Axe(gp_Pnt(0., 0., 0.), D);
|
||||
Sweep->SetMode(Axe);
|
||||
}
|
||||
}
|
||||
else if (!strcmp(a[1],"-G")) // contour guide
|
||||
{
|
||||
if (n != 5)
|
||||
{
|
||||
//cout << "bad arguments !" << endl;
|
||||
di << "bad arguments !" << "\n";
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
TopoDS_Shape Guide = DBRep::Get(a[2],TopAbs_WIRE);
|
||||
Sweep->SetMode(TopoDS::Wire(Guide), atoi(a[3]), atoi(a[4]));
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
//cout << "The option "<< a[1] << " is unknown !" << endl;
|
||||
di << "The option "<< a[1] << " is unknown !" << "\n";
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// addsweep
|
||||
//=======================================================================
|
||||
static Standard_Integer addsweep(Draw_Interpretor& di,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n == 1) {
|
||||
//cout << "addsweep wire/vertex [Vertex] [-T] [-R] [u0 v0 u1 v1 [...[uN vN]]] : options are :" << endl;
|
||||
//cout << " -T : the wire/vertex have to be translated to assume contact"<< endl;
|
||||
//cout << " with the spine" <<endl;
|
||||
//cout << " -R : the wire have to be rotated to assume orthogonality"<<endl;
|
||||
//cout << " with the spine's tangent" << endl;
|
||||
di << "addsweep wire/vertex [Vertex] [-T] [-R] [u0 v0 u1 v1 [...[uN vN]]] : options are :" << "\n";
|
||||
di << " -T : the wire/vertex have to be translated to assume contact"<< "\n";
|
||||
di << " with the spine" <<"\n";
|
||||
di << " -R : the wire have to be rotated to assume orthogonality"<<"\n";
|
||||
di << " with the spine's tangent" << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Sweep ==0) {
|
||||
//cout << "You have forgotten the <<mksweep>> command !"<< endl;
|
||||
di << "You have forgotten the <<mksweep>> command !"<< "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopoDS_Shape Section;
|
||||
TopoDS_Vertex Vertex;
|
||||
Handle(Law_Interpol) thelaw;
|
||||
|
||||
Section = DBRep::Get(a[1], TopAbs_SHAPE);
|
||||
if (Section.ShapeType() != TopAbs_WIRE &&
|
||||
Section.ShapeType() != TopAbs_VERTEX)
|
||||
{
|
||||
//cout << a[1] <<"is not a wire and is not a vertex!" << endl;
|
||||
di << a[1] <<"is not a wire and is not a vertex!" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Standard_Boolean HasVertex=Standard_False,
|
||||
isT=Standard_False,
|
||||
isR=Standard_False;
|
||||
|
||||
if (n > 2) {
|
||||
Standard_Integer cur = 2;
|
||||
// Lecture du Vertex
|
||||
TopoDS_Shape InputVertex(DBRep::Get(a[cur],TopAbs_VERTEX));
|
||||
Vertex = TopoDS::Vertex(InputVertex);
|
||||
// Vertex = TopoDS::Vertex(DBRep::Get(a[cur],TopAbs_VERTEX));
|
||||
if (!Vertex.IsNull()) {
|
||||
cur++;
|
||||
HasVertex = Standard_True;
|
||||
}
|
||||
|
||||
// Lecture de l'option de translation
|
||||
if ((n>cur) && !strcmp(a[cur],"-T")) {
|
||||
cur++;
|
||||
isT = Standard_True;
|
||||
}
|
||||
|
||||
// Lecture de l'option de rotation
|
||||
if ((n>cur) && !strcmp(a[cur],"-R")) {
|
||||
cur++;
|
||||
isR = Standard_True;
|
||||
}
|
||||
|
||||
// loi ?
|
||||
if (n>cur) {
|
||||
Standard_Integer nbreal = n-cur;
|
||||
if ( (nbreal < 4) || (nbreal % 2 != 0) ) {
|
||||
//cout << "bad arguments ! :" <<a[cur] << endl;
|
||||
di << "bad arguments ! :" <<a[cur] << "\n";
|
||||
} else { //loi d'interpolation
|
||||
Standard_Integer ii, L= nbreal/2;
|
||||
TColgp_Array1OfPnt2d ParAndRad(1, L);
|
||||
for (ii=1; ii<=L; ii++, cur+=2) {
|
||||
ParAndRad(ii).SetX(atof(a[cur]));
|
||||
ParAndRad(ii).SetY(atof(a[cur+1]));
|
||||
}
|
||||
thelaw = new (Law_Interpol) ();
|
||||
thelaw->Set(ParAndRad,
|
||||
Abs(ParAndRad(1).Y() - ParAndRad(L).Y()) < Precision::Confusion());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (thelaw.IsNull()) {
|
||||
if (HasVertex) Sweep->Add(Section, Vertex, isT, isR);
|
||||
else Sweep->Add(Section, isT, isR);
|
||||
}
|
||||
else {
|
||||
if (HasVertex) Sweep->SetLaw(Section, thelaw, Vertex, isT, isR);
|
||||
else Sweep->SetLaw(Section, thelaw, isT, isR);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// deletesweep
|
||||
//=======================================================================
|
||||
static Standard_Integer deletesweep(Draw_Interpretor& di,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n != 2) {
|
||||
return 1;
|
||||
}
|
||||
TopoDS_Wire Section;
|
||||
TopoDS_Shape InputShape(DBRep::Get(a[1],TopAbs_SHAPE));
|
||||
Section = TopoDS::Wire(InputShape);
|
||||
// Section = TopoDS::Wire(DBRep::Get(a[1],TopAbs_SHAPE));
|
||||
if (Section.IsNull()) {
|
||||
//cout << a[1] <<"is not a wire !" << endl;
|
||||
di << a[1] <<"is not a wire !" << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Sweep->Delete(Section);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// buildsweep
|
||||
//=======================================================================
|
||||
static Standard_Integer buildsweep(Draw_Interpretor& di,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( n == 1) {
|
||||
//cout << "build sweep result [-M/-C/-R] [-S] [tol] : options are" << endl;
|
||||
//cout << " -M : Discontinuities are treated by Modfication of"<< endl;
|
||||
//cout << " the sweeping mode : it is the default" <<endl;
|
||||
//cout << " -C : Discontinuities are treated like Right Corner" << endl;
|
||||
//cout << " Treatement is Extent && Intersect" << endl;
|
||||
//cout << " -R : Discontinuities are treated like Round Corner" << endl;
|
||||
//cout << " Treatement is Intersect and Fill" << endl;
|
||||
//cout << " -S : To build a Solid" << endl;
|
||||
di << "build sweep result [-M/-C/-R] [-S] [tol] : options are" << "\n";
|
||||
di << " -M : Discontinuities are treated by Modfication of"<< "\n";
|
||||
di << " the sweeping mode : it is the default" <<"\n";
|
||||
di << " -C : Discontinuities are treated like Right Corner" << "\n";
|
||||
di << " Treatement is Extent && Intersect" << "\n";
|
||||
di << " -R : Discontinuities are treated like Round Corner" << "\n";
|
||||
di << " Treatement is Intersect and Fill" << "\n";
|
||||
di << " -S : To build a Solid" << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
Standard_Boolean mksolid = Standard_False;
|
||||
if (Sweep ==0) {
|
||||
//cout << "You have forgotten the <<mksweep>> command !"<< endl;
|
||||
di << "You have forgotten the <<mksweep>> command !"<< "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!Sweep->IsReady()) {
|
||||
//cout << "You have forgotten the <<addsweep>> command !"<< endl;
|
||||
di << "You have forgotten the <<addsweep>> command !"<< "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopoDS_Shape result;
|
||||
Standard_Integer cur=2;
|
||||
if (n>cur) {
|
||||
BRepBuilderAPI_TransitionMode Transition = BRepBuilderAPI_Transformed;
|
||||
|
||||
// Lecture Transition
|
||||
if (!strcmp(a[cur],"-C")) {
|
||||
Transition = BRepBuilderAPI_RightCorner;
|
||||
cur++;
|
||||
}
|
||||
else if (!strcmp(a[cur],"-R")) {
|
||||
Transition = BRepBuilderAPI_RoundCorner;
|
||||
cur++;
|
||||
}
|
||||
Sweep->SetTransitionMode(Transition);
|
||||
}
|
||||
// Lecture solide ?
|
||||
if ((n>cur) && (!strcmp(a[cur],"-S")) ) mksolid = Standard_True;
|
||||
|
||||
// Calcul le resultat
|
||||
Sweep->Build();
|
||||
if (!Sweep->IsDone()) {
|
||||
//cout << "Buildsweep : Not Done" << endl;
|
||||
di << "Buildsweep : Not Done" << "\n";
|
||||
BRepBuilderAPI_PipeError Stat = Sweep->GetStatus();
|
||||
if (Stat == BRepBuilderAPI_PlaneNotIntersectGuide) {
|
||||
//cout << "Buildsweep : One Plane not intersect the guide" << endl;
|
||||
di << "Buildsweep : One Plane not intersect the guide" << "\n";
|
||||
}
|
||||
if (Stat == BRepBuilderAPI_ImpossibleContact) {
|
||||
//cout << "BuildSweep : One section can not be in contact with the guide" << endl;
|
||||
di << "BuildSweep : One section can not be in contact with the guide" << "\n";
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
if (mksolid) {
|
||||
Standard_Boolean B;
|
||||
B = Sweep->MakeSolid();
|
||||
//if (!B) cout << " BuildSweep : It is impossible to make a solid !" << endl;
|
||||
if (!B) di << " BuildSweep : It is impossible to make a solid !" << "\n";
|
||||
}
|
||||
result = Sweep->Shape();
|
||||
DBRep::Set(a[1],result);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// simulsweep
|
||||
//=======================================================================
|
||||
static Standard_Integer simulsweep(Draw_Interpretor& di,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if ( (n!=3) && (n!=4) ) return 1;
|
||||
|
||||
if (Sweep ==0) {
|
||||
//cout << "You have forgotten the <<mksweep>> command !"<< endl;
|
||||
di << "You have forgotten the <<mksweep>> command !"<< "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!Sweep->IsReady()) {
|
||||
//cout << "You have forgotten the <<addsweep>> command !"<< endl;
|
||||
di << "You have forgotten the <<addsweep>> command !"<< "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
char name[100];
|
||||
TopTools_ListOfShape List;
|
||||
TopTools_ListIteratorOfListOfShape it;
|
||||
Standard_Integer N, ii;
|
||||
N = atoi(a[2]);
|
||||
|
||||
if (n>3) {
|
||||
BRepBuilderAPI_TransitionMode Transition = BRepBuilderAPI_Transformed;
|
||||
// Lecture Transition
|
||||
if (!strcmp(a[3],"-C")) {
|
||||
Transition = BRepBuilderAPI_RightCorner;
|
||||
}
|
||||
else if (!strcmp(a[3],"-R")) {
|
||||
Transition = BRepBuilderAPI_RoundCorner;
|
||||
}
|
||||
Sweep->SetTransitionMode(Transition);
|
||||
}
|
||||
|
||||
// Calcul le resultat
|
||||
Sweep->Simulate(N, List);
|
||||
for (ii=1, it.Initialize(List); it.More(); it.Next(), ii++) {
|
||||
sprintf(name,"%s_%d",a[1],ii);
|
||||
DBRep::Set(name, it.Value());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SweepCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::SweepCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
|
||||
const char* g = "Sweep commands";
|
||||
|
||||
theCommands.Add("prism",
|
||||
"prism result base dx dy dz [Copy | Inf | Seminf]",
|
||||
__FILE__,prism,g);
|
||||
|
||||
theCommands.Add("revol",
|
||||
"revol result base px py pz dx dy dz angle [Copy]",
|
||||
__FILE__,revol,g);
|
||||
|
||||
theCommands.Add("pipe",
|
||||
"pipe result Wire_spine Profile",
|
||||
__FILE__,pipe,g);
|
||||
|
||||
theCommands.Add("evolved",
|
||||
"evolved , no args to get help",
|
||||
__FILE__,evolved,g);
|
||||
|
||||
theCommands.Add("evolvedsolid",
|
||||
"evolved , no args to get help",
|
||||
__FILE__,evolved,g);
|
||||
|
||||
theCommands.Add("pruled",
|
||||
"pruled result Edge1/Wire1 Edge2/Wire2",
|
||||
__FILE__,pruled,g);
|
||||
|
||||
theCommands.Add("gener", "gener result wire1 wire2 [..wire..]",
|
||||
__FILE__,gener,g);
|
||||
|
||||
theCommands.Add("thrusections", "thrusections [-N] result issolid isruled shape1 shape2 [..shape..], the option -N means no check on wires, shapes must be wires or vertices (only first or last)",
|
||||
__FILE__,thrusections,g);
|
||||
|
||||
|
||||
theCommands.Add("mksweep", "mksweep wire",
|
||||
__FILE__,mksweep,g);
|
||||
|
||||
theCommands.Add("setsweep", "setsweep no args to get help",
|
||||
__FILE__,setsweep,g);
|
||||
|
||||
theCommands.Add("addsweep",
|
||||
"addsweep wire [vertex] [-M ] [-C] [auxiilaryshape]:no args to get help",
|
||||
__FILE__,addsweep,g);
|
||||
|
||||
theCommands.Add("deletesweep",
|
||||
"deletesweep wire, To delete a section",
|
||||
__FILE__,deletesweep,g);
|
||||
|
||||
theCommands.Add("buildsweep", "builsweep [r] [option] [Tol] , no args to get help"
|
||||
__FILE__,buildsweep,g);
|
||||
|
||||
theCommands.Add("simulsweep", "simulsweep r [n] [option]"
|
||||
__FILE__,simulsweep,g);
|
||||
theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]"
|
||||
__FILE__,geompipe,g);
|
||||
}
|
||||
|
277
src/BRepTest/BRepTest_TopologyCommands.cxx
Executable file
277
src/BRepTest/BRepTest_TopologyCommands.cxx
Executable file
@@ -0,0 +1,277 @@
|
||||
// File: DBRep_6.cxx
|
||||
// Created: Thu Jul 22 16:40:43 1993
|
||||
// Author: Remi LEQUETTE
|
||||
// <rle@nonox>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <BRepTest.hxx>
|
||||
#include <DBRep.hxx>
|
||||
#include <Draw_Interpretor.hxx>
|
||||
#include <DrawTrSurf.hxx>
|
||||
#include <Geom_Plane.hxx>
|
||||
#include <Draw_Appli.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
|
||||
#include <BRepAlgo_Fuse.hxx>
|
||||
#include <BRepAlgo_Common.hxx>
|
||||
#include <BRepAlgo_Cut.hxx>
|
||||
#include <BRepAlgo_Section.hxx>
|
||||
|
||||
#include <BRepFilletAPI_MakeFillet.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <BRepPrimAPI_MakeHalfSpace.hxx>
|
||||
#include <BRepAlgo_FaceRestrictor.hxx>
|
||||
#include <BRepExtrema_ExtPF.hxx>
|
||||
#include <BRepLProp_SLProps.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopOpeBRepBuild_HBuilder.hxx>
|
||||
#include <TopOpeBRepDS_HDataStructure.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
// topop
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer topop(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 4) return 1;
|
||||
|
||||
TopoDS_Shape s1 = DBRep::Get(a[2]);
|
||||
TopoDS_Shape s2 = DBRep::Get(a[3]);
|
||||
|
||||
if (s1.IsNull() || s2.IsNull()) return 1;
|
||||
|
||||
TopoDS_Shape res;
|
||||
|
||||
if (*a[0] == 'f')
|
||||
res = BRepAlgo_Fuse(s1,s2);
|
||||
else if (*(a[0]+1) == 'o')
|
||||
res = BRepAlgo_Common(s1,s2);
|
||||
else
|
||||
res = BRepAlgo_Cut(s1,s2);
|
||||
|
||||
DBRep::Set(a[1],res);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// section
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer section(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
|
||||
if (n < 4) return 1;
|
||||
|
||||
TopoDS_Shape s1 = DBRep::Get(a[2]);
|
||||
TopoDS_Shape s2 = DBRep::Get(a[3]);
|
||||
|
||||
if (s1.IsNull() || s2.IsNull())
|
||||
return 1;
|
||||
|
||||
BRepAlgo_Section Sec(s1, s2, Standard_False);
|
||||
TopoDS_Shape res;
|
||||
|
||||
if (n > 4) {
|
||||
#ifdef WNT
|
||||
if (!strcasecmp(a[4],"-2d") || !strcasecmp(a[4], "-no2d")) {
|
||||
#else
|
||||
if (!strncasecmp(a[4],"-2d", 3) || !strcasecmp(a[4], "-no2d")) {
|
||||
#endif
|
||||
if (!strcasecmp(a[4], "-2d")) {
|
||||
Sec.ComputePCurveOn1(Standard_True);
|
||||
Sec.ComputePCurveOn2(Standard_True);
|
||||
} else
|
||||
if (!strcasecmp(a[4], "-2d1"))
|
||||
Sec.ComputePCurveOn1(Standard_True);
|
||||
else
|
||||
if (!strcasecmp(a[4], "-2d2"))
|
||||
Sec.ComputePCurveOn2(Standard_True);
|
||||
else
|
||||
if (strcasecmp(a[4], "-no2d"))
|
||||
return 1;
|
||||
if(n > 5)
|
||||
if (!strcasecmp(a[5], "-a"))
|
||||
Sec.Approximation(TopOpeBRepTool_APPROX);
|
||||
else
|
||||
if (strcasecmp(a[5], "-p"))
|
||||
return 1;
|
||||
} else {// fin a[4],"-2d"
|
||||
if (!strcasecmp(a[4], "-a") || !strcasecmp(a[4], "-p")) {
|
||||
if (!strcasecmp(a[4], "-a"))
|
||||
Sec.Approximation(TopOpeBRepTool_APPROX);
|
||||
if(n > 5) {
|
||||
#ifdef WNT
|
||||
if (!strcasecmp(a[5],"-2d") || !strcasecmp(a[5], "-no2d")) {
|
||||
#else
|
||||
if (!strncasecmp(a[5],"-2d", 3) || !strcasecmp(a[5], "-no2d")) {
|
||||
#endif
|
||||
if (!strcasecmp(a[5], "-2d")) {
|
||||
Sec.ComputePCurveOn1(Standard_True);
|
||||
Sec.ComputePCurveOn2(Standard_True);
|
||||
} else
|
||||
if (!strcasecmp(a[5], "-2d1"))
|
||||
Sec.ComputePCurveOn1(Standard_True);
|
||||
else
|
||||
if (!strcasecmp(a[5], "-2d2"))
|
||||
Sec.ComputePCurveOn2(Standard_True);
|
||||
else
|
||||
if (strcasecmp(a[5], "-no2d"))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else // fin a[4],"-a"
|
||||
return 1;
|
||||
}
|
||||
}// fin n > 4
|
||||
|
||||
res = Sec.Shape();
|
||||
|
||||
DBRep::Set(a[1],res);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// psection
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer psection(Draw_Interpretor& , Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 4) return 1;
|
||||
|
||||
TopoDS_Shape s = DBRep::Get(a[2]);
|
||||
if (s.IsNull()) return 1;
|
||||
|
||||
Handle(Geom_Surface) ps = DrawTrSurf::GetSurface(a[3]);
|
||||
if (ps.IsNull()) return 1;
|
||||
|
||||
Handle(Geom_Plane) pg = Handle(Geom_Plane)::DownCast(ps);
|
||||
if (pg.IsNull()) return 1;
|
||||
|
||||
const gp_Pln& p = pg->Pln();
|
||||
|
||||
TopoDS_Shape res = BRepAlgo_Section(s,p);
|
||||
|
||||
DBRep::Set(a[1],res);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Standard_Integer halfspace(Draw_Interpretor& di,
|
||||
Standard_Integer n, const char** a)
|
||||
{
|
||||
if (n < 6) return 1;
|
||||
|
||||
// Le point indiquant le cote "matiere".
|
||||
gp_Pnt RefPnt = gp_Pnt(atof(a[3]),atof(a[4]),atof(a[5]));
|
||||
|
||||
TopoDS_Shape Face = DBRep::Get(a[2],TopAbs_FACE);
|
||||
if ( Face.IsNull()) {
|
||||
TopoDS_Shape Shell = DBRep::Get(a[2],TopAbs_SHELL);
|
||||
if (Shell.IsNull()) {
|
||||
//cout << a[2] << " must be a face or a shell" << endl;
|
||||
di << a[2] << " must be a face or a shell" << "\n";
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
BRepPrimAPI_MakeHalfSpace Half(TopoDS::Shell(Shell),RefPnt);
|
||||
if ( Half.IsDone()) {
|
||||
DBRep::Set(a[1],Half.Solid());
|
||||
}
|
||||
else {
|
||||
//cout << " HalfSpace NotDone" << endl;
|
||||
di << " HalfSpace NotDone" << "\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
BRepPrimAPI_MakeHalfSpace Half(TopoDS::Face(Face),RefPnt);
|
||||
if ( Half.IsDone()) {
|
||||
DBRep::Set(a[1],Half.Solid());
|
||||
}
|
||||
else {
|
||||
//cout << " HalfSpace NotDone" << endl;
|
||||
di << " HalfSpace NotDone" << "\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : buildfaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static Standard_Integer buildfaces(Draw_Interpretor& , Standard_Integer narg, const char** a)
|
||||
{
|
||||
if (narg < 4) return 1;
|
||||
|
||||
TopoDS_Shape InputShape(DBRep::Get( a[2] ,TopAbs_FACE));
|
||||
TopoDS_Face F = TopoDS::Face(InputShape);
|
||||
// TopoDS_Face F = TopoDS::Face(DBRep::Get(a[2],TopAbs_FACE));
|
||||
BRepAlgo_FaceRestrictor FR;
|
||||
FR.Init(F);
|
||||
|
||||
for (Standard_Integer i = 3 ; i < narg ; i++) {
|
||||
TopoDS_Shape InputWire(DBRep::Get(a[i],TopAbs_WIRE));
|
||||
TopoDS_Wire W = TopoDS::Wire(InputWire);
|
||||
// TopoDS_Wire W = TopoDS::Wire(DBRep::Get(a[i],TopAbs_WIRE));
|
||||
FR.Add(W);
|
||||
}
|
||||
FR.Perform();
|
||||
if (!FR.IsDone()) return 1;
|
||||
|
||||
TopoDS_Compound Res;
|
||||
BRep_Builder BB;
|
||||
BB.MakeCompound(Res);
|
||||
|
||||
for (; FR.More(); FR.Next()) {
|
||||
TopoDS_Face FF = FR.Current();
|
||||
BB.Add(Res,FF);
|
||||
DBRep::Set(a[1],Res);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TopologyCommands
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepTest::TopologyCommands(Draw_Interpretor& theCommands)
|
||||
{
|
||||
static Standard_Boolean done = Standard_False;
|
||||
if (done) return;
|
||||
done = Standard_True;
|
||||
|
||||
DBRep::BasicCommands(theCommands);
|
||||
|
||||
const char* g = "TOPOLOGY Topological operation commands";
|
||||
|
||||
theCommands.Add("fuse","fuse result s1 s2",__FILE__,topop,g);
|
||||
theCommands.Add("common","common result s1 s2",__FILE__,topop,g);
|
||||
theCommands.Add("cut","cut result part tool",__FILE__,topop,g);
|
||||
theCommands.Add("section","section result s1 s2 [-no2d/-2d/-2d1/-2d2] [-p/-a]",__FILE__,section,g);
|
||||
theCommands.Add("psection","psection result s plane",__FILE__,psection,g);
|
||||
theCommands.Add("halfspace","halfspace result face/shell x y z",__FILE__,halfspace,g);
|
||||
theCommands.Add("buildfaces","buildfaces result faceReference wire1 wire2 ...",__FILE__,buildfaces,g);
|
||||
}
|
19
src/BRepTest/FILES
Executable file
19
src/BRepTest/FILES
Executable file
@@ -0,0 +1,19 @@
|
||||
BRepTest_BasicCommands.cxx
|
||||
BRepTest_CurveCommands.cxx
|
||||
BRepTest_Fillet2DCommands.cxx
|
||||
BRepTest_DraftAngleCommands.cxx
|
||||
BRepTest_ExtremaCommands.cxx
|
||||
BRepTest_FeatureCommands.cxx
|
||||
BRepTest_FilletCommands.cxx
|
||||
BRepTest_FillingCommands.cxx
|
||||
BRepTest_ChamferCommands.cxx
|
||||
BRepTest_GPropCommands.cxx
|
||||
BRepTest_MatCommands.cxx
|
||||
BRepTest_PrimitiveCommands.cxx
|
||||
BRepTest_SurfaceCommands.cxx
|
||||
BRepTest_SweepCommands.cxx
|
||||
BRepTest_TopologyCommands.cxx
|
||||
BRepTest_OtherCommands.cxx
|
||||
BRepTest_CheckCommands.cxx
|
||||
BRepTest_ProjectionCommands.cxx
|
||||
BRepTest_ShellCommands.cxx
|
Reference in New Issue
Block a user