clean up commands in FEM
This commit is contained in:
parent
af56b324b9
commit
0285dfede9
|
@ -633,7 +633,7 @@ void CreateFemCommands(void)
|
|||
{
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
rcCmdMgr.addCommand(new CmdFemCreateFromShape());
|
||||
rcCmdMgr.addCommand(new CmdFemCreateAnalysis());
|
||||
//rcCmdMgr.addCommand(new CmdFemCreateAnalysis());
|
||||
rcCmdMgr.addCommand(new CmdFemAddPart());
|
||||
rcCmdMgr.addCommand(new CmdFemCreateNodesSet());
|
||||
rcCmdMgr.addCommand(new CmdFemDefineNodesSet());
|
||||
|
|
|
@ -56,7 +56,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
|||
Gui::ToolBarItem* fem = new Gui::ToolBarItem(root);
|
||||
fem->setCommand("FEM");
|
||||
*fem << "Fem_CreateFromShape"
|
||||
<< "Fem_CreateAnalysis"
|
||||
<< "Fem_NewMechanicalAnalysis"
|
||||
<< "Fem_FemAddPart"
|
||||
<< "Fem_CreateNodesSet"
|
||||
<< "Fem_ConstraintFixed"
|
||||
|
@ -78,7 +78,6 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
<< "Fem_MechanicalMaterial"
|
||||
<< "Fem_NewMechanicalAnalysis"
|
||||
<< "Fem_MechanicalJobControl"
|
||||
<< "Fem_CreateAnalysis"
|
||||
<< "Fem_CreateNodesSet"
|
||||
<< "Fem_ConstraintFixed"
|
||||
<< "Fem_ConstraintForce"
|
||||
|
|
|
@ -47,7 +47,7 @@ def makeMechanicalAnalysis(name):
|
|||
class _CommandNewMechanicalAnalysis:
|
||||
"the Fem Analysis command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Fem_NewAnalysis',
|
||||
return {'Pixmap' : 'Fem_Analysis',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_Analysis","New mechanical analysis"),
|
||||
'Accel': "A",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Analysis","Create a new mechanical analysis")}
|
||||
|
@ -163,13 +163,13 @@ class _ViewProviderFemAnalysis:
|
|||
|
||||
class _JobControlTaskPanel:
|
||||
'''The editmode TaskPanel for Material objects'''
|
||||
def __init__(self,object):
|
||||
def __init__(self):
|
||||
# the panel has a tree widget that contains categories
|
||||
# for the subcomponents, such as additions, subtractions.
|
||||
# the categories are shown only if they are not empty.
|
||||
form_class, base_class = uic.loadUiType(FreeCAD.getHomePath() + "Mod/Machining_Distortion/JobControl.ui")
|
||||
form_class, base_class = uic.loadUiType(FreeCAD.getHomePath() + "Mod/Fem/MechanicalAnalysis.ui")
|
||||
|
||||
self.obj = object
|
||||
#self.obj = object
|
||||
self.formUi = form_class()
|
||||
self.form = QtGui.QWidget()
|
||||
self.formUi.setupUi(self.form)
|
||||
|
@ -177,7 +177,7 @@ class _JobControlTaskPanel:
|
|||
|
||||
#Connect Signals and Slots
|
||||
QtCore.QObject.connect(self.formUi.toolButton_chooseOutputDir, QtCore.SIGNAL("clicked()"), self.chooseOutputDir)
|
||||
QtCore.QObject.connect(self.formUi.pushButton_generate, QtCore.SIGNAL("clicked()"), self.generate)
|
||||
QtCore.QObject.connect(self.formUi.pushButton_generate, QtCore.SIGNAL("clicked()"), self.run)
|
||||
|
||||
self.update()
|
||||
|
||||
|
@ -206,8 +206,6 @@ class _JobControlTaskPanel:
|
|||
self.formUi.lineEdit_outputDir.setText(dirname)
|
||||
|
||||
def run(self):
|
||||
print "pushButton_generate"
|
||||
print self.formUi.lineEdit_outputDir.text()
|
||||
dirName = self.formUi.lineEdit_outputDir.text()
|
||||
|
||||
MeshObject = None
|
||||
|
|
|
@ -6,118 +6,37 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>194</width>
|
||||
<height>142</height>
|
||||
<width>193</width>
|
||||
<height>354</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string>Mechanical analysis</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_MaterialsInDir">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>choose...</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_SaveMat">
|
||||
<widget class="QLineEdit" name="lineEdit_outputDir"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_chooseOutputDir">
|
||||
<property name="text">
|
||||
<string>MatWeb database...</string>
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="QPushButton" name="pushButton_generate">
|
||||
<property name="text">
|
||||
<string>Run</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDoubleSpinBox" name="spinBox_young_modulus">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.989999999990687</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>70000.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Young Modulus (KPa)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QDoubleSpinBox" name="spinBox_poisson_ratio">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.300000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Poisson Ratio</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QTextEdit" name="textEdit_Output"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
|
@ -33,8 +33,9 @@ __title__="Machine-Distortion FemSetGeometryObject managment"
|
|||
__author__ = "Juergen Riegel"
|
||||
__url__ = "http://free-cad.sourceforge.net"
|
||||
|
||||
StartMat = {'FEM_youngsmodulus' :'7000.00',
|
||||
'PartDist_poissonratio' :'0.30',
|
||||
StartMat = {'General_name' :'Steel',
|
||||
'Mechanical_youngsmodulus' :'7000.00',
|
||||
'FEM_poissonratio' :'0.30',
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,8 +65,8 @@ class _CommandMechanicalMaterial:
|
|||
if (not MatObj):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Material")
|
||||
FreeCADGui.addModule("MechanicalMaterial")
|
||||
FreeCADGui.doCommand("mat = MechanicalMaterial.makeMechanicalMaterial('Material')")
|
||||
FreeCADGui.doCommand("App.activeDocument()."+FemGui.getActiveAnalysis().Name+".Member = App.activeDocument()."+FemGui.getActiveAnalysis().Name+".Member + [mat]")
|
||||
FreeCADGui.doCommand("MechanicalMaterial.makeMechanicalMaterial('MechanicalMaterial')")
|
||||
FreeCADGui.doCommand("App.activeDocument()."+FemGui.getActiveAnalysis().Name+".Member = App.activeDocument()."+FemGui.getActiveAnalysis().Name+".Member + [App.ActiveDocument.activeObject()]")
|
||||
FreeCADGui.doCommand("Gui.activeDocument().setEdit(mat.Name,0)")
|
||||
#FreeCADGui.doCommand("Fem.makeMaterial()")
|
||||
else:
|
||||
|
@ -153,8 +154,8 @@ class _MechanicalMaterialTaskPanel:
|
|||
|
||||
matmap = self.obj.Material
|
||||
|
||||
matmap['FEM_youngsmodulus'] = str(self.formUi.spinBox_young_modulus.value())
|
||||
matmap['PartDist_poissonratio'] = str(self.formUi.spinBox_poisson_ratio.value())
|
||||
matmap['Mechanical_youngsmodulus'] = str(self.formUi.spinBox_young_modulus.value())
|
||||
matmap['FEM_poissonratio'] = str(self.formUi.spinBox_poisson_ratio.value())
|
||||
|
||||
self.obj.Material = matmap
|
||||
|
||||
|
@ -163,8 +164,10 @@ class _MechanicalMaterialTaskPanel:
|
|||
"Transfer from the object to the dialog"
|
||||
matmap = self.obj.Material
|
||||
|
||||
self.formUi.spinBox_young_modulus.setValue(float(matmap['FEM_youngsmodulus']))
|
||||
self.formUi.spinBox_poisson_ratio.setValue(float(matmap['PartDist_poissonratio']))
|
||||
if matmap.has_key('Mechanical_youngsmodulus'):
|
||||
self.formUi.spinBox_young_modulus.setValue(float(matmap['Mechanical_youngsmodulus']))
|
||||
if matmap.has_key('FEM_poissonratio'):
|
||||
self.formUi.spinBox_poisson_ratio.setValue(float(matmap['FEM_poissonratio']))
|
||||
|
||||
def isAllowedAlterSelection(self):
|
||||
return False
|
||||
|
@ -204,11 +207,12 @@ class _MechanicalMaterialTaskPanel:
|
|||
def chooseMat(self,index):
|
||||
if index == 0:return
|
||||
import Material
|
||||
print index
|
||||
name = self.pathList[index-1]
|
||||
#print 'Import ', str(name)
|
||||
print 'Import ', str(name)
|
||||
|
||||
self.obj.Material = Material.importFCMat(str(name))
|
||||
#print self.obj.Material
|
||||
print self.obj.Material
|
||||
|
||||
self.transferFrom()
|
||||
|
||||
|
@ -223,22 +227,5 @@ class _MechanicalMaterialTaskPanel:
|
|||
|
||||
|
||||
|
||||
def parse_R_output(self,filename):
|
||||
file = open(str(filename))
|
||||
lines = file.readlines()
|
||||
found = False
|
||||
coeff = []
|
||||
for line in lines:
|
||||
if line[0:9] == "c0 to c5:":
|
||||
found = True
|
||||
coeff.append(float(line[15:]))
|
||||
continue
|
||||
if found and line[0:4] == "MSE:":
|
||||
found = False
|
||||
if found:
|
||||
coeff.append(float(line[15:]))
|
||||
|
||||
file.close()
|
||||
return coeff[0],coeff[1],coeff[2],coeff[3],coeff[4],coeff[5]
|
||||
|
||||
FreeCADGui.addCommand('Fem_MechanicalMaterial',_CommandMechanicalMaterial())
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string>Mechanical material</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
|
@ -81,7 +81,7 @@
|
|||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Young Modulus (KPa)</string>
|
||||
<string>Young Modulus (kPa)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Loading…
Reference in New Issue
Block a user