Gui: Add ability to disable single-solid rule by default

This commit is contained in:
Kacper Donat
2024-05-11 16:46:32 +02:00
committed by Adrián Insaurralde Avalos
parent e4ed0d883f
commit 302706be38
4 changed files with 56 additions and 7 deletions

View File

@@ -712,4 +712,4 @@ void DlgSettingsGeneral::attachObserver()
handlers.addHandler(ParamKey(hDockWindows->GetGroup("DAGView"), "Enabled"), applyDockWidget);
}
#include "moc_DlgSettingsGeneral.cpp"
#include "moc_DlgSettingsGeneral.cpp"

View File

@@ -60,6 +60,7 @@ void DlgSettingsGeneral::saveSettings()
ui->checkBooleanRefine->onSave();
ui->checkSketchBaseRefine->onSave();
ui->checkObjectNaming->onSave();
ui->checkAllowCompoundBody->onSave();
}
void DlgSettingsGeneral::loadSettings()
@@ -68,6 +69,7 @@ void DlgSettingsGeneral::loadSettings()
ui->checkBooleanRefine->onRestore();
ui->checkSketchBaseRefine->onRestore();
ui->checkObjectNaming->onRestore();
ui->checkAllowCompoundBody->onRestore();
}
/**

View File

@@ -13,8 +13,8 @@
<property name="windowTitle">
<string>General</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Model settings</string>
@@ -62,14 +62,17 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Object naming</string>
<property name="enabled">
<bool>true</bool>
</property>
<property name="visible">
<bool>false</bool>
</property>
<property name="title">
<string>Object naming</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="Gui::PrefCheckBox" name="checkObjectNaming">
@@ -87,7 +90,45 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<item>
<widget class="QGroupBox" name="groupBoxExperimental">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Experimental</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="warningLabel">
<property name="text">
<string>These settings are experimental and may result in decreased stability, more problems and undefined behaviors.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkAllowCompoundBody">
<property name="text">
<string>Allow multiple solids in Part Design Body by default (experimental)</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>AllowCompoundDefault</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/PartDesign</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>

View File

@@ -180,6 +180,12 @@ bool Feature::isSingleSolidRuleSatisfied(const TopoDS_Shape& shape, TopAbs_Shape
Feature::SingleSolidRuleMode Feature::singleSolidRuleMode()
{
auto body = getFeatureBody();
// When the feature is not part of an body (which should not happen) let's stay with the default
if (!body) {
return SingleSolidRuleMode::Enforced;
}
auto areCompoundSolidsAllowed = body->AllowCompound.getValue();
return areCompoundSolidsAllowed ? SingleSolidRuleMode::Disabled : SingleSolidRuleMode::Enforced;