FEM: solver frame work, beside dir fix

This commit is contained in:
Bernd Hahnebach
2020-07-21 21:29:43 +02:00
parent d30862b7ba
commit 886d9656f0

View File

@@ -180,10 +180,13 @@ def getMachine(solver, path=None):
:param path:
A valid filesystem path which shall be associetad with the machine.
"""
# print(path)
_DocObserver.attach()
m = _machines.get(solver)
if m is None or not _isPathValid(m, path):
m = _createMachine(solver, path, testmode=False)
# print(m.__dir__()) # document these attributes somewhere
# print(m.directory)
return m
@@ -244,7 +247,11 @@ def _getBesideDir(solver):
def _getBesideBase(solver):
path = os.path.splitext(solver.Document.FileName)[0]
if path is None:
# doc=App.newDocument()
# doc.FileName
# the above returns an empty string in FreeCAD 0.19
# https://forum.freecadweb.org/viewtopic.php?f=10&t=48842
if path is "":
error_message = (
"Please save the file before executing the solver. "
"This must be done because the location of the working "
@@ -258,6 +265,7 @@ def _getBesideBase(solver):
error_message
)
raise MustSaveError()
# TODO may be do not abort but use a temporary directory
return path