All: Reformat according to new standard

This commit is contained in:
pre-commit-ci[bot]
2025-11-11 13:49:01 +01:00
committed by Kacper Donat
parent eafd18dac0
commit 25c3ba7338
2390 changed files with 154630 additions and 115818 deletions

View File

@@ -1,32 +1,32 @@
/**************************************************************************
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
* Copyright (c) 2022 Werner Mayer <wmayer[at]users.sourceforge.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
# include <TopoDS.hxx>
# include <TopoDS_Face.hxx>
# include <boost/signals2.hpp>
# include <map>
# include <string>
# include <vector>
# include <QMessageBox>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <boost/signals2.hpp>
#include <map>
#include <string>
#include <vector>
#include <QMessageBox>
#include "SketchWorkflow.h"
@@ -59,30 +59,26 @@
using namespace PartDesignGui;
namespace {
namespace
{
struct RejectException
{
};
struct WrongSelectionException
{
};
struct WrongSupportException
{
};
struct SupportNotPlanarException
{
};
struct MissingPlanesException
{
};
class SupportFaceValidator
@@ -90,8 +86,7 @@ class SupportFaceValidator
public:
explicit SupportFaceValidator(Gui::SelectionObject faceSelection)
: faceSelection(faceSelection)
{
}
{}
void handleSelectedBody(PartDesign::Body* activeBody)
{
@@ -112,7 +107,7 @@ public:
msg.pSubName = elements[0].c_str();
msg.pTypeName = tip->getTypeId().getName();
faceSelection = Gui::SelectionObject{msg};
faceSelection = Gui::SelectionObject {msg};
// automatically switch to 'Through' mode
setThroughModeOfBody(activeBody);
@@ -135,7 +130,7 @@ public:
}
// get the selected sub shape (a Face)
const Part::TopoShape &shape = partobject->Shape.getValue();
const Part::TopoShape& shape = partobject->Shape.getValue();
Part::TopoShape subshape(shape.getSubShape(elements[0].c_str()));
if (subshape.isNull()) {
throw WrongSupportException();
@@ -160,8 +155,9 @@ private:
void setThroughModeOfBody(PartDesign::Body* activeBody)
{
// automatically switch to 'Through' mode
PartDesignGui::ViewProviderBody* vpBody = dynamic_cast<PartDesignGui::ViewProviderBody*>
(Gui::Application::Instance->getViewProvider(activeBody));
PartDesignGui::ViewProviderBody* vpBody = dynamic_cast<PartDesignGui::ViewProviderBody*>(
Gui::Application::Instance->getViewProvider(activeBody)
);
if (vpBody) {
vpBody->DisplayModeBody.setValue("Through");
}
@@ -176,8 +172,7 @@ class SupportPlaneValidator
public:
explicit SupportPlaneValidator(Gui::SelectionObject faceSelection)
: faceSelection(faceSelection)
{
}
{}
std::string getSupport() const
{
@@ -196,15 +191,17 @@ private:
class SketchPreselection
{
public:
SketchPreselection(Gui::Document* guidocument, PartDesign::Body* activeBody,
std::tuple<Gui::SelectionFilter, Gui::SelectionFilter, Gui::SelectionFilter> filter)
SketchPreselection(
Gui::Document* guidocument,
PartDesign::Body* activeBody,
std::tuple<Gui::SelectionFilter, Gui::SelectionFilter, Gui::SelectionFilter> filter
)
: guidocument(guidocument)
, activeBody(activeBody)
, faceFilter(std::get<0>(filter))
, planeFilter(std::get<1>(filter))
, sketchFilter(std::get<2>(filter))
{
}
{}
bool matches()
{
@@ -221,11 +218,11 @@ public:
createBodyOrThrow();
// get the selected object
App::DocumentObject* selectedObject{};
App::DocumentObject* selectedObject {};
if (faceFilter.match()) {
Gui::SelectionObject faceSelObject = faceFilter.Result[0][0];
SupportFaceValidator validator{faceSelObject};
SupportFaceValidator validator {faceSelObject};
validator.handleSelectedBody(activeBody);
validator.throwIfInvalid();
@@ -258,14 +255,16 @@ public:
auto Feat = activeBody->getDocument()->getObject(FeatName.c_str());
FCMD_OBJ_CMD(Feat, "AttachmentSupport = " << supportString);
if (sketchFilter.match()) {
FCMD_OBJ_CMD(Feat,
"MapMode = '" << Attacher::AttachEngine::getModeName(Attacher::mmObjectXY)
<< "'");
FCMD_OBJ_CMD(
Feat,
"MapMode = '" << Attacher::AttachEngine::getModeName(Attacher::mmObjectXY) << "'"
);
}
else { // For Face or Plane
FCMD_OBJ_CMD(Feat,
"MapMode = '" << Attacher::AttachEngine::getModeName(Attacher::mmFlatFace)
<< "'");
FCMD_OBJ_CMD(
Feat,
"MapMode = '" << Attacher::AttachEngine::getModeName(Attacher::mmFlatFace) << "'"
);
}
Gui::Command::updateActive();
PartDesignGui::setEdit(Feat, activeBody);
@@ -275,7 +274,7 @@ private:
void createBodyOrThrow()
{
if (!activeBody) {
activeBody = PartDesignGui::getBody( /* messageIfNot = */ true );
activeBody = PartDesignGui::getBody(/* messageIfNot = */ true);
if (activeBody) {
tryAddNewBodyToActivePart();
}
@@ -287,7 +286,7 @@ private:
void tryAddNewBodyToActivePart()
{
App::Part *activePart = PartDesignGui::getActivePart();
App::Part* activePart = PartDesignGui::getActivePart();
if (activePart) {
activePart->addObject(activeBody);
}
@@ -296,12 +295,12 @@ private:
void handleIfSupportOutOfBody(App::DocumentObject* selectedObject)
{
if (!activeBody->hasObject(selectedObject)) {
if ( !selectedObject->isDerivedFrom ( App::Plane::getClassTypeId() ) ) {
if (!selectedObject->isDerivedFrom(App::Plane::getClassTypeId())) {
// TODO check here if the plane associated with right part/body (2015-09-01, Fat-Zer)
//check the prerequisites for the selected objects
//the user has to decide which option we should take if external references are used
// TODO share this with UnifiedDatumCommand() (2015-10-20, Fat-Zer)
// check the prerequisites for the selected objects
// the user has to decide which option we should take if external references are used
// TODO share this with UnifiedDatumCommand() (2015-10-20, Fat-Zer)
QDialog dia(Gui::getMainWindow());
PartDesignGui::Ui_DlgReference dlg;
dlg.setupUi(&dia);
@@ -324,8 +323,9 @@ private:
App::DocumentObject* makeCopy(App::DocumentObject* selectedObject, bool independent)
{
std::string sub;
if (faceFilter.match())
if (faceFilter.match()) {
sub = faceFilter.Result[0][0].getSubNames()[0];
}
auto copy = PartDesignGui::TaskFeaturePick::makeCopy(selectedObject, sub, independent);
addToBodyOrPart(copy);
@@ -337,11 +337,12 @@ private:
{
std::string supportString;
if (planeFilter.match()) {
supportString = Gui::Command::getObjectCmd(copy,"(",",'')");
supportString = Gui::Command::getObjectCmd(copy, "(", ",'')");
}
else {
//it is ensured that only a single face is selected, hence it must always be Face1 of the shapebinder
supportString = Gui::Command::getObjectCmd(copy,"(",",'Face1')");
// it is ensured that only a single face is selected, hence it must always be Face1 of
// the shapebinder
supportString = Gui::Command::getObjectCmd(copy, "(", ",'Face1')");
}
return supportString;
}
@@ -372,9 +373,7 @@ public:
PlaneFinder(App::Document* appdocument, PartDesign::Body* activeBody)
: appdocument(appdocument)
, activeBody(activeBody)
{
}
{}
std::vector<App::DocumentObject*> getPlanes() const
{
@@ -396,46 +395,52 @@ public:
try {
tryFindBasePlanes();
}
catch (const Base::Exception &ex) {
Base::Console().error ("%s\n", ex.what() );
catch (const Base::Exception& ex) {
Base::Console().error("%s\n", ex.what());
}
}
void findDatumPlanes()
{
App::GeoFeatureGroupExtension *geoGroup = getGroupExtensionOfBody();
const std::vector<Base::Type> types = { PartDesign::Plane::getClassTypeId(), App::Plane::getClassTypeId() };
App::GeoFeatureGroupExtension* geoGroup = getGroupExtensionOfBody();
const std::vector<Base::Type> types
= {PartDesign::Plane::getClassTypeId(), App::Plane::getClassTypeId()};
auto datumPlanes = appdocument->getObjectsOfType(types);
for (auto plane : datumPlanes) {
if (std::find(planes.begin(), planes.end(), plane) != planes.end()) {
continue; // Skip if already in planes (for base planes)
continue; // Skip if already in planes (for base planes)
}
planes.push_back ( plane );
planes.push_back(plane);
// Check whether this plane belongs to the active body
if ( activeBody->hasObject(plane, true) ) {
if ( !activeBody->isAfterInsertPoint ( plane ) ) {
if (activeBody->hasObject(plane, true)) {
if (!activeBody->isAfterInsertPoint(plane)) {
validPlaneCount++;
status.push_back(PartDesignGui::TaskFeaturePick::validFeature);
} else {
}
else {
status.push_back(PartDesignGui::TaskFeaturePick::afterTip);
}
} else {
PartDesign::Body *planeBody = PartDesign::Body::findBodyOf (plane);
if ( planeBody ) {
if ( ( geoGroup && geoGroup->hasObject ( planeBody, true ) ) ||
!App::GeoFeatureGroupExtension::getGroupOfObject (planeBody) ) {
status.push_back ( PartDesignGui::TaskFeaturePick::otherBody );
} else {
status.push_back ( PartDesignGui::TaskFeaturePick::otherPart );
}
else {
PartDesign::Body* planeBody = PartDesign::Body::findBodyOf(plane);
if (planeBody) {
if ((geoGroup && geoGroup->hasObject(planeBody, true))
|| !App::GeoFeatureGroupExtension::getGroupOfObject(planeBody)) {
status.push_back(PartDesignGui::TaskFeaturePick::otherBody);
}
} else {
if ( ( geoGroup && geoGroup->hasObject ( plane, true ) ) ||
!App::GeoFeatureGroupExtension::getGroupOfObject ( plane ) ) {
status.push_back ( PartDesignGui::TaskFeaturePick::otherPart );
} else {
status.push_back ( PartDesignGui::TaskFeaturePick::notInBody );
else {
status.push_back(PartDesignGui::TaskFeaturePick::otherPart);
}
}
else {
if ((geoGroup && geoGroup->hasObject(plane, true))
|| !App::GeoFeatureGroupExtension::getGroupOfObject(plane)) {
status.push_back(PartDesignGui::TaskFeaturePick::otherPart);
}
else {
status.push_back(PartDesignGui::TaskFeaturePick::notInBody);
}
}
}
@@ -446,15 +451,15 @@ public:
{
// Collect also shape binders consisting of a single planar face
auto shapeBinders( appdocument->getObjectsOfType(PartDesign::ShapeBinder::getClassTypeId()) );
auto binders( appdocument->getObjectsOfType(PartDesign::SubShapeBinder::getClassTypeId()) );
shapeBinders.insert(shapeBinders.end(),binders.begin(),binders.end());
auto shapeBinders(appdocument->getObjectsOfType(PartDesign::ShapeBinder::getClassTypeId()));
auto binders(appdocument->getObjectsOfType(PartDesign::SubShapeBinder::getClassTypeId()));
shapeBinders.insert(shapeBinders.end(), binders.begin(), binders.end());
for (auto binder : shapeBinders) {
// Check whether this plane belongs to the active body
if (activeBody->hasObject(binder)) {
Part::TopoShape shape = static_cast<Part::Feature*>(binder)->Shape.getShape();
if (shape.isPlanar()) {
if (!activeBody->isAfterInsertPoint (binder)) {
if (!activeBody->isAfterInsertPoint(binder)) {
validPlaneCount++;
planes.push_back(binder);
status.push_back(PartDesignGui::TaskFeaturePick::validFeature);
@@ -469,7 +474,7 @@ private:
{
auto* origin = activeBody->getOrigin();
for (auto plane : origin->planes()) {
planes.push_back (plane);
planes.push_back(plane);
status.push_back(PartDesignGui::TaskFeaturePick::basePlane);
validPlaneCount++;
}
@@ -477,9 +482,9 @@ private:
App::GeoFeatureGroupExtension* getGroupExtensionOfBody() const
{
App::GeoFeatureGroupExtension *geoGroup{nullptr};
App::GeoFeatureGroupExtension* geoGroup {nullptr};
if (activeBody) {
auto group( App::GeoFeatureGroupExtension::getGroupOfObject(activeBody) );
auto group(App::GeoFeatureGroupExtension::getGroupOfObject(activeBody));
if (group) {
geoGroup = group->getExtensionByType<App::GeoFeatureGroupExtension>();
}
@@ -502,8 +507,7 @@ public:
SketchRequestSelection(Gui::Document* guidocument, PartDesign::Body* activeBody)
: guidocument(guidocument)
, activeBody(activeBody)
{
}
{}
void findSupport()
{
@@ -528,8 +532,10 @@ private:
createBodyOrThrow();
bool useAttachment = App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/PartDesign")
->GetBool("NewSketchUseAttachmentDialog", false);
.GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/Mod/PartDesign"
)
->GetBool("NewSketchUseAttachmentDialog", false);
if (useAttachment) {
createSketchAndShowAttachment();
}
@@ -554,7 +560,7 @@ private:
void tryAddNewBodyToActivePart()
{
App::Part *activePart = PartDesignGui::getActivePart();
App::Part* activePart = PartDesignGui::getActivePart();
if (activePart) {
activePart->addObject(activeBody);
}
@@ -564,7 +570,8 @@ private:
{
auto* origin = activeBody->getOrigin();
auto* vpo = dynamic_cast<Gui::ViewProviderCoordinateSystem*>(
Gui::Application::Instance->getViewProvider(origin));
Gui::Application::Instance->getViewProvider(origin)
);
if (vpo) {
vpo->setTemporaryVisibility(Gui::DatumElement::Planes | Gui::DatumElement::Axes);
vpo->setPlaneLabelVisibility(true);
@@ -596,7 +603,9 @@ private:
Gui::Selection().clearSelection();
// Open attachment dialog
auto* vps = dynamic_cast<SketcherGui::ViewProviderSketch*>(Gui::Application::Instance->getViewProvider(sketch));
auto* vps = dynamic_cast<SketcherGui::ViewProviderSketch*>(
Gui::Application::Instance->getViewProvider(sketch)
);
vps->showAttachmentEditor(onAccept, onReject);
}
@@ -604,7 +613,8 @@ private:
{
auto* origin = partDesignBody->getOrigin();
auto* vpo = dynamic_cast<Gui::ViewProviderCoordinateSystem*>(
Gui::Application::Instance->getViewProvider(origin));
Gui::Application::Instance->getViewProvider(origin)
);
if (vpo) {
vpo->resetTemporaryVisibility();
vpo->resetTemporarySize();
@@ -626,7 +636,8 @@ private:
unsigned validPlaneCount = planeFinder.countValidPlanes();
for (auto& plane : planes) {
auto* planeViewProvider = Gui::Application::Instance->getViewProvider<Gui::ViewProviderPlane>(plane);
auto* planeViewProvider
= Gui::Application::Instance->getViewProvider<Gui::ViewProviderPlane>(plane);
// skip updating planes from coordinate systems
if (!planeViewProvider || !planeViewProvider->getRole().empty()) {
@@ -634,7 +645,9 @@ private:
}
planeViewProvider->setLabelVisibility(true);
planeViewProvider->setTemporaryScale(Gui::ViewParams::instance()->getDatumTemporaryScaleFactor());
planeViewProvider->setTemporaryScale(
Gui::ViewParams::instance()->getDatumTemporaryScaleFactor()
);
}
//
@@ -645,7 +658,8 @@ private:
auto restorePlaneVisibility = [planes]() {
for (auto& plane : planes) {
auto* planeViewProvider = Gui::Application::Instance->getViewProvider<Gui::ViewProviderPlane>(plane);
auto* planeViewProvider
= Gui::Application::Instance->getViewProvider<Gui::ViewProviderPlane>(plane);
if (!planeViewProvider) {
continue;
}
@@ -656,13 +670,15 @@ private:
};
// Determines if user made a valid selection in dialog
auto acceptFunction = [restorePlaneVisibility](const std::vector<App::DocumentObject*>& features) -> bool {
auto acceptFunction =
[restorePlaneVisibility](const std::vector<App::DocumentObject*>& features) -> bool {
restorePlaneVisibility();
return !features.empty();
};
// Called by dialog when user hits "OK" and accepter returns true
auto processFunction = [documentOfBody, partDesignBody](const std::vector<App::DocumentObject*>& features) {
auto processFunction = [documentOfBody,
partDesignBody](const std::vector<App::DocumentObject*>& features) {
SketchRequestSelection::createSketch(documentOfBody, partDesignBody, features);
};
@@ -671,8 +687,9 @@ private:
auto rejectFunction = [docname, restorePlaneVisibility]() {
restorePlaneVisibility();
Gui::Document* document = Gui::Application::Instance->getDocument(docname.c_str());
if (document)
if (document) {
document->abortCommand();
}
};
//
@@ -690,15 +707,22 @@ private:
Gui::Selection().clearSelection();
// Show dialog and let user pick plane
Gui::Control().showDialog(new PartDesignGui::TaskDlgFeaturePick(planes, status, acceptFunction,
processFunction, true, rejectFunction));
Gui::Control().showDialog(new PartDesignGui::TaskDlgFeaturePick(
planes,
status,
acceptFunction,
processFunction,
true,
rejectFunction
));
}
}
void checkForShownDialog()
{
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
PartDesignGui::TaskDlgFeaturePick *pickDlg = qobject_cast<PartDesignGui::TaskDlgFeaturePick *>(dlg);
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
PartDesignGui::TaskDlgFeaturePick* pickDlg
= qobject_cast<PartDesignGui::TaskDlgFeaturePick*>(dlg);
if (dlg && !pickDlg) {
QMessageBox msgBox(Gui::getMainWindow());
msgBox.setText(QObject::tr("A dialog is already open in the task panel"));
@@ -719,8 +743,11 @@ private:
}
}
static void createSketch(App::Document* documentOfBody, PartDesign::Body* partDesignBody,
const std::vector<App::DocumentObject*>& features)
static void createSketch(
App::Document* documentOfBody,
PartDesign::Body* partDesignBody,
const std::vector<App::DocumentObject*>& features
)
{
// may happen when the user switched to an empty document while the
// dialog is open
@@ -733,7 +760,8 @@ private:
std::string supportString;
if (lcs) {
supportString = Gui::Command::getObjectCmd(lcs, "(") + ",['" + plane->getNameInDocument() + "'])";
supportString = Gui::Command::getObjectCmd(lcs, "(") + ",['"
+ plane->getNameInDocument() + "'])";
}
else {
supportString = Gui::Command::getObjectCmd(plane, "(", ",[''])");
@@ -744,11 +772,14 @@ private:
doc->openTransaction(QT_TRANSLATE_NOOP("Command", "New Sketch"));
}
FCMD_OBJ_CMD(partDesignBody,"newObject('Sketcher::SketchObject','" << FeatName << "')");
FCMD_OBJ_CMD(partDesignBody, "newObject('Sketcher::SketchObject','" << FeatName << "')");
auto Feat = doc->getObject(FeatName.c_str());
FCMD_OBJ_CMD(Feat,"AttachmentSupport = " << supportString);
FCMD_OBJ_CMD(Feat,"MapMode = '" << Attacher::AttachEngine::getModeName(Attacher::mmFlatFace)<<"'");
Gui::Command::updateActive(); // Make sure the AttachmentSupport's Placement property is updated
FCMD_OBJ_CMD(Feat, "AttachmentSupport = " << supportString);
FCMD_OBJ_CMD(
Feat,
"MapMode = '" << Attacher::AttachEngine::getModeName(Attacher::mmFlatFace) << "'"
);
Gui::Command::updateActive(); // Make sure the AttachmentSupport's Placement property is updated
PartDesignGui::setEdit(Feat, partDesignBody);
}
@@ -757,7 +788,7 @@ private:
PartDesign::Body* activeBody;
};
}
} // namespace
SketchWorkflow::SketchWorkflow(Gui::Document* document)
: guidocument(document)
@@ -771,23 +802,34 @@ void SketchWorkflow::createSketch()
tryCreateSketch();
}
catch (const RejectException&) {
}
catch (const WrongSelectionException&) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Several sub-elements selected"),
QObject::tr("Select a single face as support for a sketch!"));
QMessageBox::warning(
Gui::getMainWindow(),
QObject::tr("Several sub-elements selected"),
QObject::tr("Select a single face as support for a sketch!")
);
}
catch (const WrongSupportException&) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No support face selected"),
QObject::tr("Select a face as support for a sketch!"));
QMessageBox::warning(
Gui::getMainWindow(),
QObject::tr("No support face selected"),
QObject::tr("Select a face as support for a sketch!")
);
}
catch (const SupportNotPlanarException&) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No planar support"),
QObject::tr("Need a planar face as support for a sketch!"));
QMessageBox::warning(
Gui::getMainWindow(),
QObject::tr("No planar support"),
QObject::tr("Need a planar face as support for a sketch!")
);
}
catch (const MissingPlanesException&) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No valid planes in this document"),
QObject::tr("Create a plane first or select a face to sketch on"));
QMessageBox::warning(
Gui::getMainWindow(),
QObject::tr("No valid planes in this document"),
QObject::tr("Create a plane first or select a face to sketch on")
);
}
}
@@ -809,22 +851,23 @@ void SketchWorkflow::tryCreateSketch()
sketchOnFace.createSketchOnSupport(sketchOnFace.getSupport());
}
else {
SketchRequestSelection requestSelection{ guidocument, activeBody };
SketchRequestSelection requestSelection {guidocument, activeBody};
requestSelection.findSupport();
}
}
std::tuple<bool, PartDesign::Body*> SketchWorkflow::shouldCreateBody()
{
auto shouldMakeBody{false};
auto shouldMakeBody {false};
// We need either an active Body, or for there to be no Body
// objects (in which case, just make one) to make a new sketch.
// If we are inside a link, we need to use its placement.
App::DocumentObject *topParent;
PartDesign::Body *pdBody = PartDesignGui::getBody(/* messageIfNot = */ false, true, true, &topParent);
App::DocumentObject* topParent;
PartDesign::Body* pdBody
= PartDesignGui::getBody(/* messageIfNot = */ false, true, true, &topParent);
if (pdBody && topParent->isLink()) {
auto *xLink = dynamic_cast<App::Link *>(topParent);
auto* xLink = dynamic_cast<App::Link*>(topParent);
pdBody->Placement.setValue(xLink->Placement.getValue());
}
if (!pdBody) {
@@ -855,8 +898,8 @@ std::tuple<Gui::SelectionFilter, Gui::SelectionFilter, Gui::SelectionFilter> Ske
// a new sketch.
// See https://forum.freecad.org/viewtopic.php?f=3&t=44070
Gui::SelectionFilter FaceFilter ("SELECT Part::Feature SUBELEMENT Face COUNT 1");
Gui::SelectionFilter PlaneFilter ("SELECT App::Plane COUNT 1", activeBody);
Gui::SelectionFilter FaceFilter("SELECT Part::Feature SUBELEMENT Face COUNT 1");
Gui::SelectionFilter PlaneFilter("SELECT App::Plane COUNT 1", activeBody);
Gui::SelectionFilter PlaneFilter2("SELECT PartDesign::Plane COUNT 1", activeBody);
Gui::SelectionFilter SketchFilter("SELECT Part::Part2DObject COUNT 1", activeBody);