Assembly: Adds a pre-solve when creating joint, preventing wrong orthogonal solutions from solver.

This commit is contained in:
Paddle
2024-01-08 22:12:42 +01:00
committed by PaddleStroke
parent ae0d404c4c
commit fc5a1f1b24
17 changed files with 367 additions and 123 deletions

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
# /****************************************************************************
# /**************************************************************************
# *
# Copyright (c) 2023 Ondsel <development@ondsel.com> *
# *
@@ -19,7 +19,7 @@
# License along with FreeCAD. If not, see *
# <https://www.gnu.org/licenses/>. *
# *
# ***************************************************************************/
# **************************************************************************/
import os
import FreeCAD as App
@@ -254,16 +254,15 @@ class CommandToggleGrounded:
# If you select 2 solids (bodies for example) within an assembly.
# There'll be a single sel but 2 SubElementNames.
for sub in sel.SubElementNames:
full_element_name = UtilsAssembly.getFullElementName(sel.ObjectName, sub)
obj = UtilsAssembly.getObject(full_element_name)
part_containing_obj = UtilsAssembly.getContainingPart(full_element_name, obj)
# Only objects within the assembly.
objs_names, element_name = UtilsAssembly.getObjsNamesAndElement(sel.ObjectName, sub)
if assembly.Name not in objs_names:
continue
full_element_name = UtilsAssembly.getFullElementName(sel.ObjectName, sub)
obj = UtilsAssembly.getObject(full_element_name)
part_containing_obj = UtilsAssembly.getContainingPart(full_element_name, obj)
# Check if part is grounded and if so delete the joint.
for joint in joint_group.Group:
if (