Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CenterOfMass: FreeCAD hangs if you try to take the centre of mass of a centre of mass #179

Open
jes opened this issue Oct 31, 2024 · 1 comment

Comments

@jes
Copy link

jes commented Oct 31, 2024

Example video: https://www.youtube.com/watch?v=IgP_59iBCRo

  • Make any object in FreeCAD
  • Calculate its centre of mass and tick the eye icon to make it visible
  • Close the centre of mass panel
  • Select the CenterOfMass object and click the CenterOfMass toolbar button
  • FreeCAD hangs

The full output in my terminal window is:

jes@longjohn:~$ freecad
FreeCAD 0.21.2, Libs: 0.21.2R33771 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2023
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
FreeCAD wouldn't be possible without FreeCAD community.
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

Adding snap-specific PYTHONPATH to sys.path: /home/jes/snap/freecad/common/.local/lib/python3.8/site-packages:/snap/freecad/908/lib/python3.8/site-packages:/snap/freecad/908/usr/lib/python3/dist-packages
Qt: Session management error: Could not open network socket
connect failed: No such file or directory
Loading CenterOfMass 0.7.6 ...
/home/jes/snap/freecad/common/CenterOfMass.FCMacro:307: DeprecationWarning: an integer is required (got type PySide2.QtCore.Qt.AlignmentFlag).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  label_comboUnit.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
/home/jes/snap/freecad/common/CenterOfMass.FCMacro:320: DeprecationWarning: an integer is required (got type PySide2.QtCore.Qt.AlignmentFlag).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  label_defaultDensity.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
Looking for material cards according to User parameter:BaseApp/Preferences/Mod/Material/Resources
  /snap/freecad/908/usr/share/Mod/Material/StandardMaterial
  /home/jes/snap/freecad/common/Material
Loading CenterOfMass 0.7.6 ...
Ignored invalid object from selection
/home/jes/snap/freecad/common/CenterOfMass.FCMacro:307: DeprecationWarning: an integer is required (got type PySide2.QtCore.Qt.AlignmentFlag).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  label_comboUnit.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
/home/jes/snap/freecad/common/CenterOfMass.FCMacro:320: DeprecationWarning: an integer is required (got type PySide2.QtCore.Qt.AlignmentFlag).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  label_defaultDensity.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
Looking for material cards according to User parameter:BaseApp/Preferences/Mod/Material/Resources
  /snap/freecad/908/usr/share/Mod/Material/StandardMaterial
  /home/jes/snap/freecad/common/Material
Traceback (most recent call last):
  File "/home/jes/snap/freecad/common/CenterOfMass.FCMacro", line 1253, in <module>
    myWidget = CenterofmassDock()
  File "/home/jes/snap/freecad/common/CenterOfMass.FCMacro", line 111, in __init__
    self.child = CenterofmassWidget(self)
  File "/home/jes/snap/freecad/common/CenterOfMass.FCMacro", line 269, in __init__
    self.init_solids(objs)
  File "/home/jes/snap/freecad/common/CenterOfMass.FCMacro", line 517, in init_solids
    self.find_all_centerOfMass(objs)
  File "/home/jes/snap/freecad/common/CenterOfMass.FCMacro", line 810, in find_all_centerOfMass
    if hasattr(objs[sol], 'CenterOfGravity'):
<class 'RuntimeError'>: Cannot get center of gravity
^C^C^C^C^CTraceback (most recent call last):
  File "/home/jes/snap/freecad/common/CenterOfMass.FCMacro", line 544, in on_focusChanged
    def on_focusChanged(self, oldWidget, nowWidget):
KeyboardInterrupt
Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x43090) [0x7466e0c5e090]
#1  0x7466de5a0390 in QV4::MemoryManager::allocString(unsigned long) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5+0x20
#2  0x7466de60f7c2 in QV4::ExecutionEngine::newString(QString const&) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5+0x42
#3  0x7466de619364 in QV4::ExecutionEngine::throwError(QString const&) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Qml.so.5+0x14
#4  0x7466dfedd882 in PySide::SignalManager::qt_metacall(QObject*, QMetaObject::Call, int, void**) from /snap/freecad/908/usr/lib/x86_64-linux-gnu/libpyside2.cpython-38-x86_64-linux-gnu.so.5.14+0x272
#5  /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x2ec37c) [0x7466e130b37c]
#6  0x7466e1e5d5af in QApplication::focusChanged(QWidget*, QWidget*) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x4f
#7  0x7466e1e653c8 in QApplicationPrivate::setFocusWidget(QWidget*, Qt::FocusReason) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x108
#8  0x7466e1e9bfdf in QWidget::setFocus(Qt::FocusReason) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x12f
#9  0x7466e1e659c2 in QApplication::setActiveWindow(QWidget*) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x482
#10  0x7466e1e65a43 in QApplicationPrivate::notifyActiveWindowChange(QWindow*) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x43
#11  0x7466e16f6115 in QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent*) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x385
#12  0x7466e16fadbc in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x19c
#13  0x7466e16d16dc in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0xac
#14  /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/../../../libQt5XcbQpa.so.5(+0x79e5e) [0x7466dad45e5e]
#15  /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x27d) [0x7466dec9317d]
#16  /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52400) [0x7466dec93400]
#17  /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x33) [0x7466dec934a3]
#18  0x7466e132ef82 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x62
#19  0x7466e12d2bab in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x12b
#20  0x7466e12dad54 in QCoreApplication::exec() from /snap/freecad/908/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x94
#21  0x7466e37c0af1 in Gui::Application::runApplication() from /snap/freecad/908/usr/lib/libFreeCADGui.so+0x1b51
#22  /snap/freecad/908/usr/bin/FreeCAD(+0xa380) [0x6231b22f7380]
#23  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7466e0c3f083]
#24  /snap/freecad/908/usr/bin/FreeCAD(+0xa72e) [0x6231b22f772e]
@galou
Copy link
Collaborator

galou commented Nov 22, 2024

@s-quirin you should not be responsible for a FreeCAD crash but there may be a way to avoid it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants