From 2a28ad5cef3700df41bfad61b852c633a6ca031e Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Fri, 11 Mar 2022 09:14:12 +0800 Subject: [PATCH] PD: add SubShapeBinder 'Refine' property Respect setting in BaseApp/Preferences/Mod/PartDesign/RefineModel --- src/Mod/PartDesign/App/ShapeBinder.cpp | 11 ++++++++++- src/Mod/PartDesign/App/ShapeBinder.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Mod/PartDesign/App/ShapeBinder.cpp b/src/Mod/PartDesign/App/ShapeBinder.cpp index 15d9681071..7da57a68ee 100644 --- a/src/Mod/PartDesign/App/ShapeBinder.cpp +++ b/src/Mod/PartDesign/App/ShapeBinder.cpp @@ -335,6 +335,9 @@ SubShapeBinder::SubShapeBinder() " 'CopyOnChange'. Those properties will not longer be kept in sync between the\n" " binder and the binding object"); + ADD_PROPERTY_TYPE(Refine,(true),"Base",(App::PropertyType)(App::Prop_None), + "Refine shape (clean up redundant edges) after adding/subtracting"); + Context.setScope(App::LinkScope::Hidden); ADD_PROPERTY_TYPE(_Version,(0),"Base",(App::PropertyType)( @@ -352,6 +355,10 @@ SubShapeBinder::~SubShapeBinder() { void SubShapeBinder::setupObject() { _Version.setValue(2); checkPropertyStatus(); + + Base::Reference hGrp = App::GetApplication().GetUserParameter() + .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/PartDesign"); + this->Refine.setValue(hGrp->GetBool("RefineModel", false)); } App::DocumentObject *SubShapeBinder::getSubObject(const char *subname, PyObject **pyObj, @@ -689,7 +696,6 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) { } if(solids.size()) { result = solid.fuse(solids); - result = result.makeRefine(); fused = true; } else if (!solid.isNull()) { // wrap the single solid in compound to keep its placement @@ -708,6 +714,9 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) { }catch(...){} } + if (Refine.getValue()) + result = result.makeRefine(); + result.setPlacement(Placement.getValue()); Shape.setValue(result); } diff --git a/src/Mod/PartDesign/App/ShapeBinder.h b/src/Mod/PartDesign/App/ShapeBinder.h index e284bd8efd..d91ac69a18 100644 --- a/src/Mod/PartDesign/App/ShapeBinder.h +++ b/src/Mod/PartDesign/App/ShapeBinder.h @@ -98,6 +98,7 @@ public: App::PropertyXLink Context; App::PropertyInteger _Version; App::PropertyEnumeration BindCopyOnChange; + App::PropertyBool Refine; enum UpdateOption { UpdateNone = 0,