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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user