MOD: assembly clean (#20557)

* MOD: assembly clean

clean code

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

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

* Update AssemblyLink.cpp

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
mosfet80
2025-04-14 18:05:55 +02:00
committed by GitHub
parent 6c3d85221d
commit 3eabb0a29b
8 changed files with 0 additions and 61 deletions

View File

@@ -491,8 +491,6 @@ JointGroup* AssemblyLink::ensureJointGroup()
jGroup = new JointGroup();
getDocument()->addObject(jGroup, tr("Joints").toStdString().c_str());
// we want to add jgroup at the start, so we don't use
// addObject(jGroup);
std::vector<DocumentObject*> grp = Group.getValues();
grp.insert(grp.begin(), jGroup);
Group.setValues(grp);

View File

@@ -49,9 +49,6 @@ class TestTEMPLATE(unittest.TestCase):
"""
pass
# Close geometry document without saving
# FreeCAD.closeDocument(FreeCAD.ActiveDocument.Name)
# Setup and tear down methods called before and after each unit test
def setUp(self):
"""setUp()...

View File

@@ -175,7 +175,6 @@ class Simulation:
def execute(self, feaPy):
"""Do something when doing a recomputation, this method is mandatory"""
# App.Console.PrintMessage("Recompute Python Box feature\n")
pass
def getAssembly(self, feaPy):
@@ -329,7 +328,6 @@ class Motion:
def execute(self, feaPy):
"""Do something when doing a recomputation, this method is mandatory"""
# App.Console.PrintMessage("Recompute Python Box feature\n")
pass
def getSimulation(self, feaPy):

View File

@@ -38,7 +38,6 @@ if App.GuiUp:
import UtilsAssembly
import Preferences
# translate = App.Qt.translate
__title__ = "Assembly Command Create Exploded View"
__author__ = "Ondsel"

View File

@@ -30,7 +30,6 @@ from PySide.QtWidgets import QFileDialog
if App.GuiUp:
import FreeCADGui as Gui
# translate = App.Qt.translate
__title__ = "Assembly Command Create Assembly"
__author__ = "Ondsel"

View File

@@ -36,7 +36,6 @@ import UtilsAssembly
import Preferences
import CommandCreateJoint
# translate = App.Qt.translate
__title__ = "Assembly Command Insert Component"
__author__ = "Ondsel"
@@ -145,8 +144,6 @@ class TaskAssemblyInsertLink(QtCore.QObject):
def accept(self):
self.deactivated()
# if self.partMoving:
# self.endMove()
Gui.addModule("UtilsAssembly")
commands = "assembly = UtilsAssembly.activeAssembly()\n"
for insertionItem in self.insertionStack:
@@ -179,9 +176,6 @@ class TaskAssemblyInsertLink(QtCore.QObject):
def reject(self):
self.deactivated()
# if self.partMoving:
# self.dismissPart()
App.closeActiveTransaction(True)
return True
@@ -335,9 +329,6 @@ class TaskAssemblyInsertLink(QtCore.QObject):
item.setExpanded(not item.isExpanded())
return
# if self.partMoving:
# self.endMove()
# check that the current document had been saved or that it's the same document as that of the selected part
if not self.doc == selectedPart.Document:
if self.doc.FileName == "":
@@ -434,11 +425,7 @@ class TaskAssemblyInsertLink(QtCore.QObject):
Gui.Selection.clearSelection()
Gui.Selection.addSelection(self.doc.Name, addedObject.Name, "")
# Start moving the part if user brings mouse on view
# self.initMove()
item.setSelected(False)
# self.form.partList.setItemSelected(item, False)
if len(self.insertionStack) == 1 and not UtilsAssembly.isAssemblyGrounded():
self.handleFirstInsertion()
@@ -481,7 +468,6 @@ class TaskAssemblyInsertLink(QtCore.QObject):
self.groundedObj = self.insertionStack[0]["addedObject"]
self.groundedJoint = CommandCreateJoint.createGroundedJoint(self.groundedObj)
# self.endMove()
def increment_counter(self, item):
text = item.text(0)
@@ -514,24 +500,6 @@ class TaskAssemblyInsertLink(QtCore.QObject):
item.setText(0, new_text)
# def initMove(self):
# self.callbackMove = self.view.addEventCallback("SoLocation2Event", self.moveMouse)
# self.callbackClick = self.view.addEventCallback("SoMouseButtonEvent", self.clickMouse)
# self.callbackKey = self.view.addEventCallback("SoKeyboardEvent", self.KeyboardEvent)
# self.partMoving = True
# def endMove(self):
# self.view.removeEventCallback("SoLocation2Event", self.callbackMove)
# self.view.removeEventCallback("SoMouseButtonEvent", self.callbackClick)
# self.view.removeEventCallback("SoKeyboardEvent", self.callbackKey)
# self.partMoving = False
# self.doc.recompute()
# # Gui.Selection.removeSelectionGate()
# def moveMouse(self, info):
# newPos = self.view.getPoint(*info["Position"])
# self.insertionStack[-1]["addedObject"].Placement.Base = newPos
"""def clickMouse(self, info):
if info["Button"] == "BUTTON1" and info["State"] == "DOWN":
Gui.Selection.clearSelection()
@@ -559,24 +527,8 @@ class TaskAssemblyInsertLink(QtCore.QObject):
elif info["Button"] == "BUTTON2" and info["State"] == "DOWN":
self.dismissPart()"""
# 3D view keyboard handler
# def KeyboardEvent(self, info):
# if info["State"] == "UP" and info["Key"] == "ESCAPE":
# self.dismissPart()
# def dismissPart(self):
# self.endMove()
# stack_item = self.insertionStack.pop()
# self.totalTranslation -= stack_item["translation"]
# UtilsAssembly.removeObjAndChilds(stack_item["addedObject"])
# self.decrement_counter(stack_item["item"])
# Taskbox keyboard event handler
def eventFilter(self, watched, event):
# if watched == self.form and event.type() == QtCore.QEvent.KeyPress:
# if event.key() == QtCore.Qt.Key_Escape and self.partMoving:
# self.dismissPart()
# return True # Consume the event
if event.type() == QtCore.QEvent.ContextMenu and watched is self.form.partList:
item = watched.itemAt(event.pos())
@@ -587,8 +539,6 @@ class TaskAssemblyInsertLink(QtCore.QObject):
stack_item = self.insertionStack[i]
if stack_item["item"] == item:
# if self.partMoving:
# self.endMove()
self.totalTranslation -= stack_item["translation"]
obj = stack_item["addedObject"]

View File

@@ -33,7 +33,6 @@ if App.GuiUp:
import UtilsAssembly
import Assembly_rc
# translate = App.Qt.translate
__title__ = "Assembly Command to Solve Assembly"
__author__ = "Ondsel"

View File

@@ -109,7 +109,6 @@ def number_of_components_in(assembly):
if not obj.isDerivedFrom("App::GeoFeature"):
continue
# if obj.isDerivedFrom("App::DatumElement") or obj.isDerivedFrom("App::LocalCoordinateSystem"):
if obj.isDerivedFrom("App::Origin"):
# after https://github.com/FreeCAD/FreeCAD/pull/16675 merges,
# replace the App::Origin test by the one above