| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | __title__ = "FreeCAD FEM solver base object" |
| | __author__ = "Markus Hovorka" |
| | __url__ = "https://www.freecad.org" |
| |
|
| | |
| | |
| |
|
| |
|
| | import FreeCAD as App |
| |
|
| | from . import run |
| | from femtools.errors import MustSaveError |
| | from femtools.errors import DirectoryDoesNotExistError |
| |
|
| | if App.GuiUp: |
| | from PySide import QtGui |
| | import FreeCADGui as Gui |
| | from . import solver_taskpanel |
| |
|
| |
|
| | class Proxy: |
| |
|
| | BaseType = "Fem::FemSolverObjectPython" |
| |
|
| | def __init__(self, obj): |
| | obj.Proxy = self |
| | obj.addExtension("App::GroupExtensionPython") |
| |
|
| | def createMachine(self, obj, directory, testmode): |
| | raise NotImplementedError() |
| |
|
| | def createEquation(self, obj, eqId): |
| | raise NotImplementedError() |
| |
|
| | def isSupported(self, equation): |
| | raise NotImplementedError() |
| |
|
| | def addEquation(self, obj, eqId): |
| | obj.addObject(self.createEquation(obj.Document, eqId)) |
| |
|
| | def editSupported(self): |
| | return False |
| |
|
| | def edit(self, directory): |
| | raise NotImplementedError() |
| |
|
| | def execute(self, obj): |
| | return True |
| |
|
| |
|
| | class ViewProxy: |
| | """Proxy for FemSolverElmers View Provider.""" |
| |
|
| | def __init__(self, vobj): |
| | vobj.Proxy = self |
| | vobj.addExtension("Gui::ViewProviderGroupExtensionPython") |
| |
|
| | def setEdit(self, vobj, mode=0): |
| | try: |
| | machine = run.getMachine(vobj.Object) |
| | except MustSaveError: |
| | error_message = ( |
| | "Please save the file before opening the task panel. " |
| | "This must be done because the location of the working " |
| | 'directory is set to "Beside *.FCStd File".' |
| | ) |
| | App.Console.PrintError(error_message + "\n") |
| | QtGui.QMessageBox.critical(Gui.getMainWindow(), "Can't open Task Panel", error_message) |
| | return False |
| | except DirectoryDoesNotExistError: |
| | error_message = "Selected working directory doesn't exist." |
| | App.Console.PrintError(error_message + "\n") |
| | QtGui.QMessageBox.critical(Gui.getMainWindow(), "Can't open Task Panel", error_message) |
| | return False |
| | task = solver_taskpanel.ControlTaskPanel(machine) |
| | Gui.Control.showDialog(task) |
| | return True |
| |
|
| | def unsetEdit(self, vobj, mode=0): |
| | Gui.Control.closeDialog() |
| |
|
| | def doubleClicked(self, vobj): |
| | if Gui.Control.activeDialog(): |
| | Gui.Control.closeDialog() |
| | vobj.Document.setEdit(vobj.Object.Name) |
| | return True |
| |
|
| | def attach(self, vobj): |
| | pass |
| |
|
| |
|
| | |
| |
|