Start Gui for Displacement Post-Processing
This commit is contained in:
parent
a1c5d981a5
commit
f92d310ac3
|
@ -44,6 +44,9 @@ public:
|
|||
|
||||
bool doubleClicked(void);
|
||||
|
||||
// shows solid in the tree
|
||||
virtual bool isShow(void) const{return true;}
|
||||
|
||||
};
|
||||
|
||||
typedef ViewProviderPythonFeatureT<ViewProviderMaterialObject> ViewProviderMaterialObjectPython;
|
||||
|
|
|
@ -57,7 +57,7 @@ const char* FininessEnums[]= {"VeryCoarse","Coarse","Moderate","Fine","VeryFine"
|
|||
FemMeshShapeNetgenObject::FemMeshShapeNetgenObject()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(MaxSize,(1000), "MeshParams",Prop_None,"Maximum element size");
|
||||
ADD_PROPERTY_TYPE(SecondOrder,(false), "MeshParams",Prop_None,"Create quadric elements");
|
||||
ADD_PROPERTY_TYPE(SecondOrder,(true), "MeshParams",Prop_None,"Create quadric elements");
|
||||
ADD_PROPERTY_TYPE(Fininess,(2), "MeshParams",Prop_None,"Fininess level of the mesh");
|
||||
Fininess.setEnums(FininessEnums);
|
||||
ADD_PROPERTY_TYPE(GrowthRate,(0.3), "MeshParams",Prop_None," allows to define how much the linear dimensions of two adjacent cells can differ");
|
||||
|
|
|
@ -16,6 +16,7 @@ INSTALL(
|
|||
MechanicalMaterial.py
|
||||
MechanicalMaterial.ui
|
||||
MechanicalAnalysis.ui
|
||||
ShowDisplacement.ui
|
||||
DESTINATION
|
||||
Mod/Fem
|
||||
)
|
||||
|
|
|
@ -56,14 +56,21 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
|||
Gui::ToolBarItem* fem = new Gui::ToolBarItem(root);
|
||||
fem->setCommand("FEM");
|
||||
*fem << "Fem_CreateFromShape"
|
||||
<< "Fem_NewMechanicalAnalysis"
|
||||
<< "Fem_FemAddPart"
|
||||
<< "Fem_CreateNodesSet"
|
||||
<< "Fem_ConstraintFixed"
|
||||
<< "Fem_ConstraintForce"
|
||||
<< "Fem_ConstraintBearing"
|
||||
<< "Fem_ConstraintGear"
|
||||
<< "Fem_ConstraintPulley";
|
||||
<< "Separator"
|
||||
<< "Fem_MechanicalMaterial"
|
||||
<< "Fem_NewMechanicalAnalysis"
|
||||
<< "Fem_MechanicalJobControl"
|
||||
<< "Separator"
|
||||
<< "Fem_CreateNodesSet"
|
||||
<< "Separator"
|
||||
<< "Fem_ConstraintFixed"
|
||||
<< "Fem_ConstraintForce"
|
||||
<< "Fem_ConstraintBearing"
|
||||
<< "Fem_ConstraintGear"
|
||||
<< "Fem_ConstraintPulley"
|
||||
<< "Separator"
|
||||
<< "Fem_ShowStressResult"
|
||||
<< "Fem_ShowDisplacementResult";
|
||||
return root;
|
||||
}
|
||||
|
||||
|
@ -75,15 +82,22 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
root->insertItem(item, fem);
|
||||
fem->setCommand("&FEM");
|
||||
*fem << "Fem_CreateFromShape"
|
||||
<< "Separator"
|
||||
<< "Fem_MechanicalMaterial"
|
||||
<< "Fem_NewMechanicalAnalysis"
|
||||
<< "Fem_MechanicalJobControl"
|
||||
<< "Separator"
|
||||
<< "Fem_CreateNodesSet"
|
||||
<< "Separator"
|
||||
<< "Fem_ConstraintFixed"
|
||||
<< "Fem_ConstraintForce"
|
||||
<< "Fem_ConstraintBearing"
|
||||
<< "Fem_ConstraintGear"
|
||||
<< "Fem_ConstraintPulley";
|
||||
<< "Fem_ConstraintPulley"
|
||||
<< "Separator"
|
||||
<< "Fem_ShowStressResult"
|
||||
<< "Fem_ShowDisplacementResult"
|
||||
;
|
||||
|
||||
return root;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ class _CommandMechanicalJobControl:
|
|||
return {'Pixmap' : 'Fem_NewAnalysis',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_JobControl","Start calculation"),
|
||||
'Accel': "A",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Analysis","Dialog to start the calculation of the machanical anlysis")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_JobControl","Dialog to start the calculation of the machanical anlysis")}
|
||||
|
||||
def Activated(self):
|
||||
import FemGui
|
||||
|
@ -101,6 +101,57 @@ class _CommandMechanicalJobControl:
|
|||
return FreeCADGui.ActiveDocument != None and FemGui.getActiveAnalysis() != None
|
||||
|
||||
|
||||
class _CommandMechanicalShowStress:
|
||||
"the Fem JobControl command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Fem_ResultStress',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_ResultStress","Show stress result"),
|
||||
'Accel': "A",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_ResultStress","Show stress result")}
|
||||
|
||||
def Activated(self):
|
||||
import FemGui
|
||||
|
||||
taskd = _JobControlTaskPanel(FemGui.getActiveAnalysis())
|
||||
#taskd.obj = vobj.Object
|
||||
taskd.update()
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
|
||||
|
||||
def IsActive(self):
|
||||
import FemGui
|
||||
return FreeCADGui.ActiveDocument != None and FemGui.getActiveAnalysis() != None
|
||||
|
||||
|
||||
class _CommandMechanicalShowDisplacement:
|
||||
"the Fem JobControl command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Fem_ResultDisplacement',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_ResultDisplacement","Show displacement result"),
|
||||
'Accel': "A",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_ResultDisplacement","Show displacement result")}
|
||||
|
||||
def Activated(self):
|
||||
import FemGui
|
||||
DisplacementObject = None
|
||||
for i in FemGui.getActiveAnalysis().Member:
|
||||
if i.isDerivedFrom("Fem::FemResultVector"):
|
||||
DisplacementObject = i
|
||||
if not DisplacementObject:
|
||||
QtGui.QMessageBox.critical(None, "Missing prerequisit","No displacement result in active Analysis")
|
||||
return
|
||||
|
||||
taskd = _DisplacementControlTaskPanel(FemGui.getActiveAnalysis())
|
||||
#taskd.obj = vobj.Object
|
||||
taskd.update()
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
|
||||
|
||||
def IsActive(self):
|
||||
import FemGui
|
||||
return FreeCADGui.ActiveDocument != None and FemGui.getActiveAnalysis() != None
|
||||
|
||||
|
||||
|
||||
class _FemAnalysis:
|
||||
"The Material object"
|
||||
|
@ -134,7 +185,7 @@ class _ViewProviderFemAnalysis:
|
|||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/Fem_FemMesh.svg"
|
||||
return ":/icons/Fem_Analysis.svg"
|
||||
|
||||
|
||||
def attach(self, vobj):
|
||||
|
@ -150,10 +201,17 @@ class _ViewProviderFemAnalysis:
|
|||
return
|
||||
|
||||
def doubleClicked(self,vobj):
|
||||
taskd = _JobControlTaskPanel(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
taskd.update()
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
import FemGui
|
||||
if FemGui.getActiveAnalysis() == None:
|
||||
if FreeCADGui.activeWorkbench().name() != 'FemWorkbench':
|
||||
FreeCADGui.activateWorkbench("FemWorkbench")
|
||||
FemGui.setActiveAnalysis(self.Object)
|
||||
return True
|
||||
else:
|
||||
taskd = _JobControlTaskPanel(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
taskd.update()
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
|
||||
|
@ -233,25 +291,72 @@ class _JobControlTaskPanel:
|
|||
return
|
||||
matmap = MathObject.Material
|
||||
|
||||
IsoNodeObject = None
|
||||
FixedObject = None
|
||||
for i in FemGui.getActiveAnalysis().Member:
|
||||
if i.isDerivedFrom("Fem::FemSetNodesObject"):
|
||||
IsoNodeObject = i
|
||||
if not IsoNodeObject:
|
||||
QtGui.QMessageBox.critical(None, "Missing prerequisit","No Isostatic nodes defined in the Analysis")
|
||||
if i.isDerivedFrom("Fem::ConstraintFixed"):
|
||||
FixedObject = i
|
||||
if not FixedObject:
|
||||
QtGui.QMessageBox.critical(None, "Missing prerequisit","No fixed-constraint nodes defined in the Analysis")
|
||||
return
|
||||
IsoNodes = IsoNodeObject.Nodes
|
||||
|
||||
ForceObject = None
|
||||
for i in FemGui.getActiveAnalysis().Member:
|
||||
if i.isDerivedFrom("Fem::ConstraintForce"):
|
||||
ForceObject = i
|
||||
if not ForceObject:
|
||||
QtGui.QMessageBox.critical(None, "Missing prerequisit","No force-constraint nodes defined in the Analysis")
|
||||
return
|
||||
|
||||
|
||||
filename_without_suffix = MeshObject.Name
|
||||
#current_file_name
|
||||
|
||||
young_modulus = float(matmap['FEM_youngsmodulus'])
|
||||
poisson_ratio = float(matmap['PartDist_poissonratio'])
|
||||
#young_modulus = float(matmap['FEM_youngsmodulus'])
|
||||
#poisson_ratio = float(matmap['FEM_poissonratio'])
|
||||
|
||||
|
||||
class _DisplacementControlTaskPanel:
|
||||
'''The control for the displacement post-processing'''
|
||||
def __init__(self,object):
|
||||
# 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/Fem/ShowDisplacement.ui")
|
||||
|
||||
self.obj = object
|
||||
self.formUi = form_class()
|
||||
self.form = QtGui.QWidget()
|
||||
self.formUi.setupUi(self.form)
|
||||
|
||||
#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.run)
|
||||
|
||||
self.update()
|
||||
|
||||
|
||||
|
||||
def getStandardButtons(self):
|
||||
return int(QtGui.QDialogButtonBox.Close)
|
||||
|
||||
def update(self):
|
||||
'fills the widgets'
|
||||
#self.formUi.lineEdit_outputDir.setText(self.params.GetString("JobDir",'/'))
|
||||
return
|
||||
|
||||
def accept(self):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
|
||||
|
||||
def reject(self):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_NewMechanicalAnalysis',_CommandNewMechanicalAnalysis())
|
||||
FreeCADGui.addCommand('Fem_MechanicalJobControl',_CommandMechanicalJobControl())
|
||||
FreeCADGui.addCommand('Fem_ShowStressResult',_CommandMechanicalShowStress())
|
||||
FreeCADGui.addCommand('Fem_ShowDisplacementResult',_CommandMechanicalShowDisplacement())
|
||||
|
|
123
src/Mod/Fem/ShowDisplacement.ui
Normal file
123
src/Mod/Fem/ShowDisplacement.ui
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ShowDisplacement</class>
|
||||
<widget class="QWidget" name="ShowDisplacement">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>193</width>
|
||||
<height>354</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Mechanical analysis</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_UseColor">
|
||||
<property name="text">
|
||||
<string>Use color</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Max:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_Max">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Avg:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_Max_2">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Factor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>168</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollBar" name="verticalScrollBar">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user