PartDesign: Allow customization of Helix preview modes

This commit is contained in:
David Osterberg
2021-02-18 09:16:35 +01:00
committed by wmayer
parent ba5c438ec2
commit 34a44073c1
3 changed files with 23 additions and 10 deletions

View File

@@ -479,28 +479,41 @@ void TaskHelixParameters::getReferenceAxis(App::DocumentObject*& obj, std::vecto
}
}
bool TaskHelixParameters::showPreview(PartDesign::Helix* helix)
{
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/PartDesign");
if ((hGrp->GetBool("SubractiveHelixPreview", true) && helix->getAddSubType() == PartDesign::FeatureAddSub::Subtractive) ||
(hGrp->GetBool("AdditiveHelixPreview", false) && helix->getAddSubType() == PartDesign::FeatureAddSub::Additive)) {
return true;
}
return false;
}
void TaskHelixParameters::startReferenceSelection(App::DocumentObject* profile, App::DocumentObject* base)
{
PartDesign::ProfileBased* pcHelix = dynamic_cast<PartDesign::Helix*>(vp->getObject());
if (pcHelix->getAddSubType() == PartDesign::FeatureAddSub::Subtractive) {
PartDesign::Helix* pcHelix = dynamic_cast<PartDesign::Helix*>(vp->getObject());
if (pcHelix && showPreview(pcHelix)) {
Gui::Document* doc = vp->getDocument();
if (doc) {
doc->setHide(profile->getNameInDocument());
}
} else {
}
else {
TaskSketchBasedParameters::startReferenceSelection(profile, base);
}
}
void TaskHelixParameters::finishReferenceSelection(App::DocumentObject* profile, App::DocumentObject* base)
{
PartDesign::ProfileBased* pcHelix = dynamic_cast<PartDesign::Helix*>(vp->getObject());
if (pcHelix->getAddSubType() == PartDesign::FeatureAddSub::Subtractive) {
PartDesign::Helix* pcHelix = dynamic_cast<PartDesign::Helix*>(vp->getObject());
if (pcHelix && showPreview(pcHelix)) {
Gui::Document* doc = vp->getDocument();
if (doc) {
doc->setShow(profile->getNameInDocument());
}
} else {
}
else {
TaskSketchBasedParameters::finishReferenceSelection(profile, base);
}
}