Assembly: Isolate grounded objects on selection (#24952)

* Assembly: Isolate grounded objects on selection

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update ViewProviderAssembly.cpp

* Update ViewProviderAssembly.cpp

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
This commit is contained in:
PaddleStroke
2026-02-12 09:43:46 +01:00
committed by GitHub
parent 379179ce2b
commit 6abb2b447f

View File

@@ -1221,8 +1221,8 @@ void ViewProviderAssembly::onSelectionChanged(const Gui::SelectionChanges& msg)
auto selection = Gui::Selection().getSelection();
if (selection.size() == 1) {
App::DocumentObject* obj = selection[0].pObject;
// A simple way to identify a joint is to check for its "JointType" property.
if (obj && obj->getPropertyByName("JointType")) {
if (obj
&& (obj->getPropertyByName("JointType") || obj->getPropertyByName("ObjectToGround"))) {
isolateJointReferences(obj);
return;
}
@@ -1517,6 +1517,18 @@ void ViewProviderAssembly::isolateJointReferences(App::DocumentObject* joint, Is
return;
}
if (auto* prop = joint->getPropertyByName<App::PropertyLink>("ObjectToGround")) {
auto* groundedObj = prop->getValue();
isolatedJoint = joint;
isolatedJointVisibilityBackup = joint->Visibility.getValue();
joint->Visibility.setValue(true);
std::set<App::DocumentObject*> isolateSet = {groundedObj};
isolateComponents(isolateSet, mode);
return;
}
App::DocumentObject* part1 = getMovingPartFromRef(joint, "Reference1");
App::DocumentObject* part2 = getMovingPartFromRef(joint, "Reference2");
if (!part1 || !part2) {