Commit 7f952353 by Christophe Geuzaine

make autoFix of orientation of wires, faces, shells and solids optional (this allows to

speed up entity creation for experts; it also avoids creating duplicates when not necessary)
parent 30429a91
Pipeline #310 passed with stage
in 9 minutes 19 seconds
......@@ -74,7 +74,7 @@ struct contextGeometryOptions {
double normals, tangents, scalingFactor;
int autoCoherence, highlightOrphans, clip, useTransform;
double tolerance, toleranceBoolean, snap[3], transform[3][3], offset[3];
int occFixDegenerated, occFixSmallEdges, occFixSmallFaces;
int occAutoFix, occFixDegenerated, occFixSmallEdges, occFixSmallFaces;
int occSewFaces, occParallel, occBooleanPreserveNumbering;
double occScaling;
int copyMeshingMethod, exactExtrusion;
......
......@@ -860,6 +860,9 @@ StringXNumber GeometryOptions_Number[] = {
{ F|O, "NumSubEdges" , opt_geometry_num_sub_edges , 20. ,
"Number of edge subdivisions between control points when displaying curves" },
{ F|O, "OCCAutoFix" , opt_geometry_occ_auto_fix , 1. ,
"Automatically fix orientation of wires, faces, shells and volumes when creating"
" new entities" },
{ F|O, "OCCFixDegenerated" , opt_geometry_occ_fix_degenerated , 0. ,
"Fix degenerated edges/faces in STEP, IGES and BRep models" },
{ F|O, "OCCFixSmallEdges" , opt_geometry_occ_fix_small_edges , 0. ,
......@@ -902,7 +905,7 @@ StringXNumber GeometryOptions_Number[] = {
{ F|O, "ReparamOnFaceRobust" , opt_geometry_reparam_on_face_robust, 0 ,
"Use projection for reparametrization of a point classified on GEdge on a GFace" },
{ F|O, "ScalingFactor" , opt_geometry_scaling_factor , 1.0 ,
"Global geometry scaling factor" },
{ F|O, "OrientedPhysicals" , opt_geometry_oriented_physicals, 1. ,
......
......@@ -4695,6 +4695,13 @@ double opt_geometry_light_two_side(OPT_ARGS_NUM)
return CTX::instance()->geom.lightTwoSide;
}
double opt_geometry_occ_auto_fix(OPT_ARGS_NUM)
{
if(action & GMSH_SET)
CTX::instance()->geom.occAutoFix = val ? 1 : 0;
return CTX::instance()->geom.occAutoFix;
}
double opt_geometry_occ_fix_degenerated(OPT_ARGS_NUM)
{
if(action & GMSH_SET)
......
......@@ -383,6 +383,7 @@ double opt_geometry_line_type(OPT_ARGS_NUM);
double opt_geometry_surface_type(OPT_ARGS_NUM);
double opt_geometry_light(OPT_ARGS_NUM);
double opt_geometry_light_two_side(OPT_ARGS_NUM);
double opt_geometry_occ_auto_fix(OPT_ARGS_NUM);
double opt_geometry_occ_fix_degenerated(OPT_ARGS_NUM);
double opt_geometry_occ_fix_small_edges(OPT_ARGS_NUM);
double opt_geometry_occ_fix_small_faces(OPT_ARGS_NUM);
......
......@@ -1146,8 +1146,6 @@ bool OCC_Internals::addDisk(int &tag, double xc, double yc, double zc,
bool OCC_Internals::addPlaneSurface(int &tag, const std::vector<int> &wireTags)
{
const bool autoFix = true;
if(tag >= 0 && _tagFace.IsBound(tag)){
Msg::Error("OpenCASCADE face with tag %d already exists", tag);
return false;
......@@ -1183,7 +1181,7 @@ bool OCC_Internals::addPlaneSurface(int &tag, const std::vector<int> &wireTags)
return false;
}
result = f.Face();
if(autoFix){
if(CTX::instance()->geom.occAutoFix){
// make sure wires are oriented correctly
ShapeFix_Face fix(result);
fix.Perform();
......@@ -1244,8 +1242,6 @@ bool OCC_Internals::addSurfaceFilling(int &tag, int wireTag)
bool OCC_Internals::addSurfaceLoop(int &tag, const std::vector<int> &faceTags)
{
const bool autoFix = true;
if(tag >= 0 && _tagShell.IsBound(tag)){
Msg::Error("OpenCASCADE surface loop with tag %d already exists", tag);
return false;
......@@ -1274,7 +1270,7 @@ bool OCC_Internals::addSurfaceLoop(int &tag, const std::vector<int> &faceTags)
TopExp_Explorer exp0;
for(exp0.Init(result, TopAbs_SHELL); exp0.More(); exp0.Next()){
TopoDS_Shell shell = TopoDS::Shell(exp0.Current());
if(autoFix){
if(CTX::instance()->geom.occAutoFix){
// make sure faces in shell are oriented correctly
ShapeFix_Shell fix(shell);
fix.Perform();
......@@ -1295,8 +1291,6 @@ bool OCC_Internals::addSurfaceLoop(int &tag, const std::vector<int> &faceTags)
bool OCC_Internals::addVolume(int &tag, const std::vector<int> &shellTags)
{
const bool autoFix = true;
if(tag >= 0 && _tagSolid.IsBound(tag)){
Msg::Error("OpenCASCADE region with tag %d already exists", tag);
return false;
......@@ -1314,7 +1308,7 @@ bool OCC_Internals::addVolume(int &tag, const std::vector<int> &shellTags)
s.Add(shell);
}
result = s.Solid();
if(autoFix){
if(CTX::instance()->geom.occAutoFix){
// make sure the volume is finite
ShapeFix_Solid fix(result);
fix.Perform();
......
......@@ -29,6 +29,5 @@ Plane Surface(4) = {4};
Plane Surface(5) = {5};
Surface Loop(1) = {1,2,3,4,5};
Volume(1) = {1};
Cylinder(2) = {0.5,0.5,-0.5, 0,0,2, 0.2};
BooleanFragments{ Volume{1,2}; Delete; }{}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment