PartDesign: Helix: fix preview

This commit is contained in:
David Osterberg
2021-02-17 00:57:56 +01:00
committed by wwmayer
parent bb73b571f7
commit b0773e2b99
4 changed files with 57 additions and 14 deletions

View File

@@ -92,6 +92,27 @@ const QString TaskSketchBasedParameters::onAddSelection(const Gui::SelectionChan
return refStr;
}
void TaskSketchBasedParameters::startReferenceSelection(App::DocumentObject* profile, App::DocumentObject* base)
{
Gui::Document* doc = vp->getDocument();
if (doc) {
doc->setHide(profile->getNameInDocument());
if (base)
doc->setShow(base->getNameInDocument());
}
}
void TaskSketchBasedParameters::finishReferenceSelection(App::DocumentObject* profile, App::DocumentObject* base)
{
Gui::Document* doc = vp->getDocument();
if (doc) {
doc->setShow(profile->getNameInDocument());
if (base)
doc->setHide(base->getNameInDocument());
}
}
void TaskSketchBasedParameters::onSelectReference(const bool pressed, const bool edge, const bool face, const bool planar) {
// Note: Even if there is no solid, App::Plane and Part::Datum can still be selected
@@ -101,27 +122,18 @@ void TaskSketchBasedParameters::onSelectReference(const bool pressed, const bool
App::DocumentObject* prevSolid = pcSketchBased->getBaseObject( /* silent =*/ true );
if (pressed) {
Gui::Document* doc = vp->getDocument();
if (doc) {
doc->setHide(pcSketchBased->getNameInDocument());
if (prevSolid)
doc->setShow(prevSolid->getNameInDocument());
}
startReferenceSelection(pcSketchBased, prevSolid);
Gui::Selection().clearSelection();
Gui::Selection().addSelectionGate
(new ReferenceSelection(prevSolid, edge, face, planar));
} else {
Gui::Selection().rmvSelectionGate();
Gui::Document* doc = vp->getDocument();
if (doc) {
doc->setShow(pcSketchBased->getNameInDocument());
if (prevSolid)
doc->setHide(prevSolid->getNameInDocument());
}
finishReferenceSelection(pcSketchBased, prevSolid);
}
}
}
void TaskSketchBasedParameters::exitSelectionMode()
{
onSelectReference(false, false, false, false);