Activate Part/Part Design check and refine preferences by default (#14406)

* Activate Part/Part Design check and refine preferences by default

* added bool in .ui

* Update tests

* Fix Sketcher tests
This commit is contained in:
Max Wilfinger
2024-07-01 17:50:42 +02:00
committed by GitHub
parent 96731cbd66
commit 86b1c2e863
10 changed files with 25 additions and 19 deletions

View File

@@ -124,7 +124,7 @@ App::DocumentObjectExecReturn* Boolean::execute()
->GetGroup("Preferences")
->GetGroup("Mod/Part/Boolean");
if (hGrp->GetBool("CheckModel", false)) {
if (hGrp->GetBool("CheckModel", true)) {
BRepCheck_Analyzer aChecker(resShape);
if (!aChecker.IsValid()) {
return new App::DocumentObjectExecReturn("Resulting shape is invalid");

View File

@@ -147,7 +147,7 @@ App::DocumentObjectExecReturn *MultiCommon::execute()
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean");
if (hGrp->GetBool("CheckModel", false)) {
if (hGrp->GetBool("CheckModel", true)) {
BRepCheck_Analyzer aChecker(resShape);
if (! aChecker.IsValid() ) {
return new App::DocumentObjectExecReturn("Resulting shape is invalid");
@@ -222,7 +222,7 @@ App::DocumentObjectExecReturn *MultiCommon::execute()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/Part/Boolean");
if (hGrp->GetBool("CheckModel", false)) {
if (hGrp->GetBool("CheckModel", true)) {
BRepCheck_Analyzer aChecker(res.getShape());
if (!aChecker.IsValid()) {
return new App::DocumentObjectExecReturn("Resulting shape is invalid");

View File

@@ -148,7 +148,7 @@ App::DocumentObjectExecReturn *MultiFuse::execute()
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean");
if (hGrp->GetBool("CheckModel", false)) {
if (hGrp->GetBool("CheckModel", true)) {
BRepCheck_Analyzer aChecker(resShape);
if (! aChecker.IsValid() ) {
return new App::DocumentObjectExecReturn("Resulting shape is invalid");
@@ -268,7 +268,7 @@ App::DocumentObjectExecReturn *MultiFuse::execute()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/Part/Boolean");
if (hGrp->GetBool("CheckModel", false)) {
if (hGrp->GetBool("CheckModel", true)) {
BRepCheck_Analyzer aChecker(res.getShape());
if (!aChecker.IsValid()) {
return new App::DocumentObjectExecReturn("Resulting shape is invalid");

View File

@@ -25,6 +25,9 @@
<property name="text">
<string>Automatically check model after boolean operation</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>CheckModel</cstring>
</property>
@@ -38,6 +41,9 @@
<property name="text">
<string>Automatically refine model after boolean operation</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>RefineModel</cstring>
</property>
@@ -51,6 +57,9 @@
<property name="text">
<string>Automatically refine model after sketch-based operation</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>RefineModel</cstring>
</property>

View File

@@ -49,7 +49,7 @@ FeatureAddSub::FeatureAddSub()
//init Refine property
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
this->Refine.setValue(hGrp->GetBool("RefineModel", false));
this->Refine.setValue(hGrp->GetBool("RefineModel", true));
}
FeatureAddSub::Type FeatureAddSub::getAddSubType()

View File

@@ -54,7 +54,7 @@ Boolean::Boolean()
ADD_PROPERTY_TYPE(Refine,(0),"Part Design",(App::PropertyType)(App::Prop_None),"Refine shape (clean up redundant edges) after adding/subtracting");
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
this->Refine.setValue(hGrp->GetBool("RefineModel", false));
this->Refine.setValue(hGrp->GetBool("RefineModel", true));
ADD_PROPERTY_TYPE(UsePlacement,(0),"Part Design",(App::PropertyType)(App::Prop_None),"Apply the placement of the second ( tool ) object");
this->UsePlacement.setValue(false);

View File

@@ -78,13 +78,10 @@ Transformed::Transformed()
(App::PropertyType)(App::Prop_None),
"Refine shape (clean up redundant edges) after adding/subtracting");
// init Refine property
Base::Reference<ParameterGrp> hGrp = App::GetApplication()
.GetUserParameter()
.GetGroup("BaseApp")
->GetGroup("Preferences")
->GetGroup("Mod/PartDesign");
this->Refine.setValue(hGrp->GetBool("RefineModel", false));
//init Refine property
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
this->Refine.setValue(hGrp->GetBool("RefineModel", true));
}
void Transformed::positionBySupport()

View File

@@ -387,7 +387,7 @@ void SubShapeBinder::setupObject() {
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign");
this->Refine.setValue(hGrp->GetBool("RefineModel", false));
this->Refine.setValue(hGrp->GetBool("RefineModel", true));
}
App::DocumentObject* SubShapeBinder::getSubObject(const char* subname, PyObject** pyObj,

View File

@@ -1420,7 +1420,7 @@ class TestTopologicalNamingProblem(unittest.TestCase):
edges = [name for name in reverseMap.keys() if name.startswith("Edge")]
vertexes = [name for name in reverseMap.keys() if name.startswith("Vertex")]
self.assertEqual(len(body.Shape.childShapes()), 1)
self.assertEqual(body.Shape.childShapes()[0].ElementMapSize, 62)
self.assertEqual(body.Shape.childShapes()[0].ElementMapSize, 64)
self.assertEqual(len(reverseMap),62)
self.assertEqual(len(faces),12)
self.assertEqual(len(edges),30)

View File

@@ -519,7 +519,7 @@ class TestSketcherSolver(unittest.TestCase):
hole.DrillForDepth = 0
hole.Tapered = 0
self.Doc.recompute()
self.assertEqual(len(hole.Shape.Edges), 13)
self.assertEqual(len(hole.Shape.Edges), 12)
hole.Threaded = True
hole.ModelThread = True
body.addObject(hole)
@@ -528,8 +528,8 @@ class TestSketcherSolver(unittest.TestCase):
CreateRectangleSketch(sketch2, (0, 0), (3, 3))
body.addObject(sketch2)
self.Doc.recompute()
sketch2.addExternal("Hole", "Edge35") # Edge35 will disappear when we stop modeling threads
self.assertEqual(len(hole.Shape.Edges), 38)
sketch2.addExternal("Hole", "Edge29") # Edge29 will disappear when we stop modeling threads
self.assertEqual(len(hole.Shape.Edges), 32)
hole.ModelThread = False
hole.Refine = True
self.Doc.recompute()