Reload Workbenches for Development

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
usbhub
Posts: 280
Joined: Tue Apr 02, 2019 8:22 pm
Location: Earth

Re: Reload Workbenches for Development

Post by usbhub »

wmayer wrote: Mon Mar 23, 2020 8:14 pm

Code: Select all

import FreeCADGui
from PySide import QtGui,QtCore
args = QtGui.QApplication.arguments()[1:]
if FreeCADGui.getMainWindow().close():
    QtCore.QProcess.startDetached(QtGui.QApplication.applicationFilePath(),args)
This restarts the FreeCAD process with the same arguments it has been started before. If in your running FreeCAD instance you have manually created a new document you want to restore then you must extend the above code snippet. Save the document under a certain file path and add it to args.
Cool, that works fine :)
Post Reply