FEM: Add option to define ccx path in Preferences

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
Przemo Firszt
2015-04-08 15:14:45 +01:00
committed by wmayer
parent 800a0a7b67
commit 1f96d235ff
3 changed files with 38 additions and 7 deletions

View File

@@ -90,6 +90,30 @@
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="l_ccx_binary">
<property name="text">
<string>ccx binary</string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefFileChooser" name="fc_ccx_binary">
<property name="toolTip">
<string>Leave blank to use default CalculiX ccx binary file</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>ccxBinaryPath</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Fem</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>

View File

@@ -45,12 +45,14 @@ void DlgSettingsFemImp::saveSettings()
{
cb_int_editor->onSave();
fc_ext_editor->onSave();
fc_ccx_binary->onSave();
}
void DlgSettingsFemImp::loadSettings()
{
cb_int_editor->onRestore();
fc_ext_editor->onRestore();
fc_ccx_binary->onRestore();
}
/**

View File

@@ -205,20 +205,25 @@ class _JobControlTaskPanel:
# for the subcomponents, such as additions, subtractions.
# the categories are shown only if they are not empty.
self.form=FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/MechanicalAnalysis.ui")
from platform import system
if system() == 'Linux':
self.CalculixBinary = 'ccx'
elif system() == 'Windows':
self.CalculixBinary = FreeCAD.getHomePath() + 'bin/ccx.exe'
self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
ccx_binary = self.fem_prefs.GetString("ccxBinaryPath","")
if ccx_binary:
self.CalculixBinary = ccx_binary
print "Using ccx binary path from FEM preferences: {}".format(ccx_binary)
else:
self.CalculixBinary = 'ccx'
from platform import system
if system() == 'Linux':
self.CalculixBinary = 'ccx'
elif system() == 'Windows':
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.params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
self.Calculix = QtCore.QProcess()
self.Timer = QtCore.QTimer()
self.Timer.start(300)