From 67714c5025f53470a9f0fd7d170f049445703a7b Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Fri, 5 Jun 2015 11:12:54 +0100 Subject: [PATCH] FEM: Temporary dir is only used by ccxInpWriter, so move it there Signed-off-by: Przemo Firszt --- src/Mod/Fem/MechanicalAnalysis.py | 5 +---- src/Mod/Fem/ccxInpWriter.py | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Mod/Fem/MechanicalAnalysis.py b/src/Mod/Fem/MechanicalAnalysis.py index e3b318c75..f45c5e1b0 100644 --- a/src/Mod/Fem/MechanicalAnalysis.py +++ b/src/Mod/Fem/MechanicalAnalysis.py @@ -247,9 +247,6 @@ class _JobControlTaskPanel: self.CalculixBinary = FreeCAD.getHomePath() + 'bin/ccx.exe' else: self.CalculixBinary = 'ccx' - self.TempDir = FreeCAD.ActiveDocument.TransientDir.replace('\\', '/') + '/FemAnl_' + object.Uid[-4:] - if not os.path.isdir(self.TempDir): - os.mkdir(self.TempDir) self.obj = object self.Calculix = QtCore.QProcess() @@ -376,7 +373,7 @@ class _JobControlTaskPanel: QApplication.setOverrideCursor(Qt.WaitCursor) try: import ccxInpWriter as iw - inp_writer = iw.inp_writer(self.TempDir, self.MeshObject, self.MaterialObjects, + inp_writer = iw.inp_writer(self.obj, self.MeshObject, self.MaterialObjects, self.FixedObjects, self.ForceObjects, self.PressureObjects) self.base_name = inp_writer.write_calculix_input_file() if self.base_name != "": diff --git a/src/Mod/Fem/ccxInpWriter.py b/src/Mod/Fem/ccxInpWriter.py index 4b427eb24..094253fcb 100644 --- a/src/Mod/Fem/ccxInpWriter.py +++ b/src/Mod/Fem/ccxInpWriter.py @@ -6,13 +6,16 @@ import sys class inp_writer: - def __init__(self, dir_name, mesh_obj, mat_obj, fixed_obj, force_obj, pressure_obj): + def __init__(self, obj, mesh_obj, mat_obj, fixed_obj, force_obj, pressure_obj): self.mesh_object = mesh_obj self.material_objects = mat_obj self.fixed_objects = fixed_obj self.force_objects = force_obj self.pressure_objects = pressure_obj - self.base_name = dir_name + '/' + self.mesh_object.Name + self.dir_name = FreeCAD.ActiveDocument.TransientDir.replace('\\', '/') + '/FemAnl_' + obj.Uid[-4:] + if not os.path.isdir(self.dir_name): + os.mkdir(self.dir_name) + self.base_name = self.dir_name + '/' + self.mesh_object.Name self.file_name = self.base_name + '.inp' print 'CalculiX .inp file will be written to: ', self.file_name