Part Design: Remove legacy/modern workflow checks.

This commit is contained in:
PaddleStroke
2024-10-23 11:01:12 +02:00
committed by Chris Hennes
parent 56ae35b0f2
commit b1d5d4c105
7 changed files with 21 additions and 86 deletions

View File

@@ -667,12 +667,24 @@ void SketchWorkflow::createSketch()
void SketchWorkflow::tryCreateSketch()
{
if (PartDesignGui::assureModernWorkflow(appdocument)) {
createSketchWithModernWorkflow();
auto result = shouldCreateBody();
auto shouldMakeBody = std::get<0>(result);
activeBody = std::get<1>(result);
if (shouldAbort(shouldMakeBody)) {
return;
}
// No PartDesign feature without Body past FreeCAD 0.13
else if (PartDesignGui::isLegacyWorkflow(appdocument)) {
createSketchWithLegacyWorkflow();
auto faceOrPlaneFilter = getFaceAndPlaneFilter();
SketchPreselection sketchOnFace{ guidocument, activeBody, faceOrPlaneFilter };
if (sketchOnFace.matches()) {
// create Sketch on Face or Plane
sketchOnFace.createSupport();
sketchOnFace.createSketchOnSupport(sketchOnFace.getSupport());
}
else {
SketchRequestSelection requestSelection{ guidocument, activeBody };
requestSelection.findSupport();
}
}
@@ -727,31 +739,4 @@ std::tuple<Gui::SelectionFilter, Gui::SelectionFilter> SketchWorkflow::getFaceAn
return std::make_tuple(FaceFilter, PlaneFilter);
}
void SketchWorkflow::createSketchWithModernWorkflow()
{
auto result = shouldCreateBody();
auto shouldMakeBody = std::get<0>(result);
activeBody = std::get<1>(result);
if (shouldAbort(shouldMakeBody)) {
return;
}
auto faceOrPlaneFilter = getFaceAndPlaneFilter();
SketchPreselection sketchOnFace{guidocument, activeBody, faceOrPlaneFilter};
if (sketchOnFace.matches()) {
// create Sketch on Face or Plane
sketchOnFace.createSupport();
sketchOnFace.createSketchOnSupport(sketchOnFace.getSupport());
}
else {
SketchRequestSelection requestSelection{guidocument, activeBody};
requestSelection.findSupport();
}
}
void SketchWorkflow::createSketchWithLegacyWorkflow()
{
Gui::CommandManager& cmdMgr = Gui::Application::Instance->commandManager();
cmdMgr.runCommandByName("Sketcher_NewSketch");
}