mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0025232: Functionality to create solids from set of shapes
Purpose: The algorithm is to build solids from set of shapes. It uses the BOPAlgo_Builder algorithm to intersect the given shapes and build the images of faces (if needed) and BOPAlgo_BuilderSolid algorithm to build the solids. Steps of the algorithm: 1. Collect all faces: intersect the shapes if necessary and collect the images of faces, otherwise just collect the faces to the <myFaces> list. All faces on this step added twice, with orientation FORWARD and REVERSED; 2. Create bounding box covering all the faces from <myFaces> and create solid box from corner points of that bounding box (myBBox, mySBox). Add faces from that box to <myFaces>; 3. Build solids using faces from <myFaces> using BOPAlgo_BuilderSolid algorithm; 4. Treat the result: Eliminate solid containig faces from <mySBox>; 5. Fill internal shapes: add internal vertices and edges into created solids; 6. Prepare the history. Fix for regression. class BOPAlgo_BuilderSolid: The tolerance value used in BRepClass3d_SolidClassifier has been increased. Test cases for issue CR25232 Small correction to eliminate the warning.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <BOPAlgo_PaveFiller.hxx>
|
||||
#include <BOPAlgo_Operation.hxx>
|
||||
#include <BOPAlgo_BOP.hxx>
|
||||
#include <BOPAlgo_MakerVolume.hxx>
|
||||
#include <BOPDS_DS.hxx>
|
||||
#include <BOPTest_DrawableShape.hxx>
|
||||
#include <BOPCol_ListOfShape.hxx>
|
||||
@@ -75,6 +76,8 @@ static Standard_Integer bcommon (Draw_Interpretor&, Standard_Integer, const ch
|
||||
//
|
||||
static Standard_Integer bopcurves (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
static Standard_Integer bopnews (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
//
|
||||
static Standard_Integer mkvolume (Draw_Interpretor&, Standard_Integer, const char**);
|
||||
|
||||
//=======================================================================
|
||||
//function : BOPCommands
|
||||
@@ -105,6 +108,8 @@ static Standard_Integer bopnews (Draw_Interpretor&, Standard_Integer, const ch
|
||||
//
|
||||
theCommands.Add("bopcurves", "use bopcurves F1 F2 [-2d]", __FILE__, bopcurves, g);
|
||||
theCommands.Add("bopnews", "use bopnews -v[e,f]" , __FILE__, bopnews, g);
|
||||
//
|
||||
theCommands.Add("mkvolume", "make solids from set of shapes.\nmkvolume r b1 b2 ... [-ni (do not intersect)] [-s (run in non parallel mode)]", __FILE__, mkvolume , g);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -686,3 +691,81 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : mkvolume
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer mkvolume(Draw_Interpretor& di, Standard_Integer n, const char** a)
|
||||
{
|
||||
const char* usage = "Usage: mkvolume r b1 b2 ... [-ni (do not intersect)] [-s (run in non parallel mode)]\n";
|
||||
if (n < 3) {
|
||||
di << usage;
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
Standard_Boolean bToIntersect, bRunParallel;
|
||||
Standard_Integer i, aNb;
|
||||
//
|
||||
aNb = n;
|
||||
bToIntersect = Standard_True;
|
||||
bRunParallel = Standard_True;
|
||||
//
|
||||
if (!strcmp(a[n-1], "-ni")) {
|
||||
bToIntersect = Standard_False;
|
||||
aNb = n-1;
|
||||
}
|
||||
else if (!strcmp(a[n-1], "-s")) {
|
||||
bRunParallel = Standard_False;
|
||||
aNb = n-1;
|
||||
}
|
||||
if (n > 3) {
|
||||
if (!strcmp(a[n-2], "-ni")) {
|
||||
bToIntersect = Standard_False;
|
||||
aNb = n-2;
|
||||
}
|
||||
else if (!strcmp(a[n-2], "-s")) {
|
||||
bRunParallel = Standard_False;
|
||||
aNb = n-2;
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aNb < 3) {
|
||||
di << "no shapes to process.\n";
|
||||
di << usage;
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
BOPCol_ListOfShape aLS;
|
||||
TopoDS_Shape aS;
|
||||
for (i = 2; i < aNb; ++i) {
|
||||
aS = DBRep::Get(a[i]);
|
||||
if (!aS.IsNull()) {
|
||||
aLS.Append(aS);
|
||||
}
|
||||
}
|
||||
//
|
||||
if (aLS.IsEmpty()) {
|
||||
di << "no shapes to process.\n";
|
||||
di << usage;
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
BOPAlgo_MakerVolume aMV;
|
||||
aMV.SetArguments(aLS);
|
||||
aMV.SetIntersect(bToIntersect);
|
||||
aMV.SetRunParallel(bRunParallel);
|
||||
//
|
||||
aMV.Perform();
|
||||
if (aMV.ErrorStatus()) {
|
||||
di << "Error status: " << aMV.ErrorStatus();
|
||||
return 1;
|
||||
}
|
||||
//
|
||||
const TopoDS_Shape& aR = aMV.Shape();
|
||||
//
|
||||
DBRep::Set(a[1], aR);
|
||||
//
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user