FEM: move python modules:
- object modules to new PyObjects directory - Gui modules to new PyGui directory
This commit is contained in:
179
src/Mod/Fem/PyGui/FemCommands.py
Normal file
179
src/Mod/Fem/PyGui/FemCommands.py
Normal file
@@ -0,0 +1,179 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2015 - FreeCAD Developers *
|
||||
# * Author (c) 2015 - Przemo Fiszt < przemo@firszt.eu> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Fem Commands"
|
||||
__author__ = "Przemo Firszt"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## \addtogroup FEM
|
||||
# @{
|
||||
|
||||
import FreeCAD
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class FemCommands(object):
|
||||
def __init__(self):
|
||||
self.resources = {'Pixmap': 'fem-frequency-analysis',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_Command", "Default Fem Command MenuText"),
|
||||
'Accel': "",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Command", "Default Fem Command ToolTip")}
|
||||
# FIXME add option description
|
||||
self.is_active = None
|
||||
|
||||
def GetResources(self):
|
||||
return self.resources
|
||||
|
||||
def IsActive(self):
|
||||
if not self.is_active:
|
||||
active = False
|
||||
elif self.is_active == 'with_document':
|
||||
active = FreeCADGui.ActiveDocument is not None
|
||||
elif self.is_active == 'with_analysis':
|
||||
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc()
|
||||
elif self.is_active == 'with_results':
|
||||
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.results_present()
|
||||
elif self.is_active == 'with_selresult':
|
||||
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.result_selected()
|
||||
elif self.is_active == 'with_part_feature':
|
||||
active = FreeCADGui.ActiveDocument is not None and self.part_feature_selected()
|
||||
elif self.is_active == 'with_femmesh':
|
||||
active = FreeCADGui.ActiveDocument is not None and self.femmesh_selected()
|
||||
elif self.is_active == 'with_gmsh_femmesh':
|
||||
active = FreeCADGui.ActiveDocument is not None and self.gmsh_femmesh_selected()
|
||||
elif self.is_active == 'with_femmesh_andor_res':
|
||||
active = FreeCADGui.ActiveDocument is not None and self.with_femmesh_andor_res_selected()
|
||||
elif self.is_active == 'with_material':
|
||||
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.material_selected()
|
||||
elif self.is_active == 'with_solver':
|
||||
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.solver_selected()
|
||||
elif self.is_active == 'with_analysis_without_solver':
|
||||
active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and not self.analysis_has_solver()
|
||||
return active
|
||||
|
||||
def results_present(self):
|
||||
results = False
|
||||
analysis_members = FemGui.getActiveAnalysis().Member
|
||||
for o in analysis_members:
|
||||
if o.isDerivedFrom('Fem::FemResultObject'):
|
||||
results = True
|
||||
return results
|
||||
|
||||
def result_selected(self):
|
||||
result_is_in_active_analysis = False
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("Fem::FemResultObject"):
|
||||
for o in FemGui.getActiveAnalysis().Member:
|
||||
if o == sel[0]:
|
||||
result_is_in_active_analysis = True
|
||||
break
|
||||
if result_is_in_active_analysis:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def part_feature_selected(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("Part::Feature"):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def femmesh_selected(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("Fem::FemMeshObject"):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def gmsh_femmesh_selected(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and hasattr(sel[0], "Proxy") and sel[0].Proxy.Type == "FemMeshGmsh":
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def material_selected(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("App::MaterialObjectPython"):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def with_femmesh_andor_res_selected(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("Fem::FemMeshObject"):
|
||||
return True
|
||||
elif len(sel) == 2:
|
||||
if(sel[0].isDerivedFrom("Fem::FemMeshObject")):
|
||||
if(sel[1].isDerivedFrom("Fem::FemResultObject")):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
elif(sel[1].isDerivedFrom("Fem::FemMeshObject")):
|
||||
if(sel[0].isDerivedFrom("Fem::FemResultObject")):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
def active_analysis_in_active_doc(self):
|
||||
return FemGui.getActiveAnalysis().Document is FreeCAD.ActiveDocument
|
||||
|
||||
def solver_selected(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("Fem::FemSolverObjectPython"):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def analysis_has_solver(self):
|
||||
solver = False
|
||||
analysis_members = FemGui.getActiveAnalysis().Member
|
||||
for o in analysis_members:
|
||||
if o.isDerivedFrom("Fem::FemSolverObjectPython"):
|
||||
solver = True
|
||||
if solver is True:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def hide_meshes_show_parts_constraints(self):
|
||||
if FreeCAD.GuiUp:
|
||||
for acnstrmesh in FemGui.getActiveAnalysis().Member:
|
||||
if "Constraint" in acnstrmesh.TypeId:
|
||||
acnstrmesh.ViewObject.Visibility = True
|
||||
if "Mesh" in acnstrmesh.TypeId:
|
||||
aparttoshow = acnstrmesh.Name.replace("_Mesh", "")
|
||||
for apart in FreeCAD.activeDocument().Objects:
|
||||
if aparttoshow == apart.Name:
|
||||
apart.ViewObject.Visibility = True
|
||||
acnstrmesh.ViewObject.Visibility = False # OvG: Hide meshes and show constraints and meshed part e.g. on purging results
|
||||
|
||||
# @}
|
||||
381
src/Mod/Fem/PyGui/TaskPanelFemBeamSection.ui
Normal file
381
src/Mod/Fem/PyGui/TaskPanelFemBeamSection.ui
Normal file
@@ -0,0 +1,381 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Beam section parameter</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Cross section parameter</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="_2">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="cb_crosssectiontype"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QStackedWidget" name="widget_stack">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_all">
|
||||
<layout class="QGridLayout" name="_3">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<layout class="QFormLayout" name="formLayout_1">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_rec_width">
|
||||
<property name="text">
|
||||
<string>Width: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::InputField" name="if_rec_width">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>1000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="l_rec_height">
|
||||
<property name="text">
|
||||
<string>Height: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::InputField" name="if_rec_height">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>1000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_remaining">
|
||||
<layout class="QGridLayout" name="_5">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::InputField" name="if_circ_diameter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>1000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_circ_diameter">
|
||||
<property name="text">
|
||||
<string>Diameter: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_referenced">
|
||||
<layout class="QGridLayout" name="gridLayout_11">
|
||||
<item row="0" column="0">
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_pipe_diameter">
|
||||
<property name="text">
|
||||
<string>Diameter: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::InputField" name="if_pipe_diameter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>1000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="l_pipe_thickness">
|
||||
<property name="text">
|
||||
<string>Thickness:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::InputField" name="if_pipe_thickness">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>1000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_1">
|
||||
<property name="title">
|
||||
<string>References</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_label_text_1">
|
||||
<property name="text">
|
||||
<string>Leave blank to choose all remaining shapes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Reference">
|
||||
<property name="text">
|
||||
<string>Add reference</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="list_References"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>l_label_text_1</zorder>
|
||||
<zorder>pushButton_Reference</zorder>
|
||||
<zorder>list_References</zorder>
|
||||
<zorder>verticalSpacer</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::InputField</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/InputField.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>cb_crosssectiontype</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>widget_stack</receiver>
|
||||
<slot>setCurrentIndex(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>245</x>
|
||||
<y>45</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>245</x>
|
||||
<y>126</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
597
src/Mod/Fem/PyGui/TaskPanelFemMaterial.ui
Executable file
597
src/Mod/Fem/PyGui/TaskPanelFemMaterial.ui
Executable file
@@ -0,0 +1,597 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FemMaterial</class>
|
||||
<widget class="QWidget" name="FemMaterial">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>396</width>
|
||||
<height>834</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>FEM material</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_desc">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>1677215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Material</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_category">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Category</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cb_materials">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>choose...</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="l_mat_description">
|
||||
<property name="text">
|
||||
<string>Material Description</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_references">
|
||||
<property name="title">
|
||||
<string>References</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_label_text_1">
|
||||
<property name="text">
|
||||
<string>Leave blank to choose all remaining shapes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Reference">
|
||||
<property name="text">
|
||||
<string>Add reference</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="list_References"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="rb_standard">
|
||||
<property name="text">
|
||||
<string>Face, Edge</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QRadioButton" name="rb_solid">
|
||||
<property name="text">
|
||||
<string>Body (3D)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_label_text_5">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Selection</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_basic">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>1677215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Basic Properties</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_27">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_20">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Density </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="Gui::InputField" name="input_fd_density">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>8000 kg/m^3</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">kg/m^3</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_mechanical">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>1677215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Mechanical Properties</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Young's Modulus:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::InputField" name="input_fd_young_modulus">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>200 GPa</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">Pa</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Poisson Ratio:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<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>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.300000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_fluidic">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>1677215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Fluidic Properties</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_17">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_10">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>Kinematic viscosity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::InputField" name="input_fd_kinematic_viscosity">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.000001 m^2/s</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>0.000001000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>1000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">m^2/s</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_thermal">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>1677215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Thermal Properties</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Thermal Conductivity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::InputField" name="input_fd_thermal_conductivity">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>50 W/m/K</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">W/m/K</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_expansion_coefficient">
|
||||
<property name="text">
|
||||
<string>Expansion Coefficient:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::InputField" name="input_fd_expansion_coefficient">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>12 um/m/K</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">m/m/K</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>Specific Heat:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::InputField" name="input_fd_specific_heat">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>500 J/kg/K</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>2050000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">J/kg/K</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_vol_expansion_coefficient">
|
||||
<property name="text">
|
||||
<string>Vol Expansion Coeff</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="Gui::InputField" name="input_fd_vol_expansion_coefficient">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.001 m/m/K</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>0.001000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">m/m/K</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_external">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>1677215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>External material resources</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_saveas">
|
||||
<property name="text">
|
||||
<string>save customed material</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_MatWeb">
|
||||
<property name="text">
|
||||
<string>MatWeb database...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::InputField</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/InputField.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
193
src/Mod/Fem/PyGui/TaskPanelFemMeshGmsh.ui
Normal file
193
src/Mod/Fem/PyGui/TaskPanelFemMeshGmsh.ui
Normal file
@@ -0,0 +1,193 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GmshMesh</class>
|
||||
<widget class="QWidget" name="GmshMesh">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>413</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>FEM Mesh by GMSH </string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb01_mesh_params">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>1677215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>FEM Mesh Parameter</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_1">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_dimension">
|
||||
<property name="text">
|
||||
<string>Mesh element dimension:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cb_dimension"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="l_max">
|
||||
<property name="text">
|
||||
<string>Max element size (0.0 = Auto):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::InputField" name="if_max">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>1000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="l_min">
|
||||
<property name="text">
|
||||
<string>Min element size (0.0 = Auto):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="Gui::InputField" name="if_min">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>1000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb03_run_gmsh">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>1677215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>GMSH</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout" name="gl_actions">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_time">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="te_output">
|
||||
<property name="lineWrapMode">
|
||||
<enum>QTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::InputField</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/InputField.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
120
src/Mod/Fem/PyGui/TaskPanelFemMeshGroup.ui
Normal file
120
src/Mod/Fem/PyGui/TaskPanelFemMeshGroup.ui
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Mesh group</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>1677215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Identifier used for mesh export</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_1">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="rb_name">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="rb_label">
|
||||
<property name="text">
|
||||
<string>Label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_1">
|
||||
<property name="title">
|
||||
<string>References</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Reference">
|
||||
<property name="text">
|
||||
<string>Add reference</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="list_References"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="rb_solid">
|
||||
<property name="text">
|
||||
<string>Solid</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="rb_standard">
|
||||
<property name="text">
|
||||
<string>Face, Edge, Vertex</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="l_label_text_5">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Selection</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
154
src/Mod/Fem/PyGui/TaskPanelFemMeshRegion.ui
Normal file
154
src/Mod/Fem/PyGui/TaskPanelFemMeshRegion.ui
Normal file
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Mesh region</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>1677215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Parameter</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_1">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_max">
|
||||
<property name="text">
|
||||
<string>Max element size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::InputField" name="if_elelen">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>1000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_1">
|
||||
<property name="title">
|
||||
<string>References</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Reference">
|
||||
<property name="text">
|
||||
<string>Add reference</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="list_References"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="rb_solid">
|
||||
<property name="text">
|
||||
<string>Solid</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="rb_standard">
|
||||
<property name="text">
|
||||
<string>Face, Edge, Vertex</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="l_label_text_5">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Selection</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::InputField</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/InputField.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
136
src/Mod/Fem/PyGui/TaskPanelFemShellThickness.ui
Normal file
136
src/Mod/Fem/PyGui/TaskPanelFemShellThickness.ui
Normal file
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Shell thickness parameter</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>1677215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Parameter</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_1">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::InputField" name="if_thickness">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" stdset="0">
|
||||
<double>1000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
<property name="decimals" stdset="0">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="l_thickness">
|
||||
<property name="text">
|
||||
<string>Thickness: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_1">
|
||||
<property name="title">
|
||||
<string>References</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_label_text_1">
|
||||
<property name="text">
|
||||
<string>Leave blank to choose all remaining shapes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Reference">
|
||||
<property name="text">
|
||||
<string>Add reference</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="list_References"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::InputField</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/InputField.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
152
src/Mod/Fem/PyGui/TaskPanelFemSolverCalculix.ui
Normal file
152
src/Mod/Fem/PyGui/TaskPanelFemSolverCalculix.ui
Normal file
@@ -0,0 +1,152 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SolverCalculix</class>
|
||||
<widget class="QWidget" name="SolverCalculix">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>347</width>
|
||||
<height>458</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Mechanical analysis</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_working_dir">
|
||||
<property name="title">
|
||||
<string>Working directory</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_working_dir">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tb_choose_working_dir">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_analysis_type">
|
||||
<property name="title">
|
||||
<string>Analysis type</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="Gui::PrefRadioButton" name="rb_static_analysis">
|
||||
<property name="text">
|
||||
<string>Static</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::PrefRadioButton" name="rb_frequency_analysis">
|
||||
<property name="text">
|
||||
<string>Frequency</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="Gui::PrefRadioButton" name="rb_thermomech_analysis">
|
||||
<property name="text">
|
||||
<string>Thermo mechanical</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gl_actions">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pb_write_inp">
|
||||
<property name="text">
|
||||
<string>Write .inp file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pb_edit_inp">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit .inp file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="pb_run_ccx">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Run Calculix</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit_Output">
|
||||
<property name="lineWrapMode">
|
||||
<enum>QTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="l_time">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::PrefRadioButton</class>
|
||||
<extends>QRadioButton</extends>
|
||||
<header>Gui/PrefWidgets.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
484
src/Mod/Fem/PyGui/TaskPanelShowResult.ui
Normal file
484
src/Mod/Fem/PyGui/TaskPanelShowResult.ui
Normal file
@@ -0,0 +1,484 @@
|
||||
<?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>446</width>
|
||||
<height>620</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Show result</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_result_type">
|
||||
<property name="title">
|
||||
<string>Result type</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0">
|
||||
<widget class="QRadioButton" name="rb_z_displacement">
|
||||
<property name="text">
|
||||
<string>Z displacement</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QRadioButton" name="rb_y_displacement">
|
||||
<property name="text">
|
||||
<string>Y displacement</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QRadioButton" name="rb_x_displacement">
|
||||
<property name="text">
|
||||
<string>X displacement</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="rb_none">
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QRadioButton" name="rb_abs_displacement">
|
||||
<property name="text">
|
||||
<string>Abs displacement</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QRadioButton" name="rb_max_shear_stress">
|
||||
<property name="text">
|
||||
<string>Max shear stress(Tresca)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QRadioButton" name="rb_minprin">
|
||||
<property name="text">
|
||||
<string>Min Principal stress</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="rb_maxprin">
|
||||
<property name="text">
|
||||
<string>Max Principal stress</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="rb_vm_stress">
|
||||
<property name="text">
|
||||
<string>Von Mises stress</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="rb_temperature">
|
||||
<property name="text">
|
||||
<string>Temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Avg:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::InputField" name="le_avg">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Max:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::InputField" name="le_max">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::InputField" name="le_min">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">mm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Min:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_displacement">
|
||||
<property name="title">
|
||||
<string>Displacement</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_show_displacement">
|
||||
<property name="text">
|
||||
<string>Show</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollBar" name="hsb_displacement_factor">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Factor:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sb_displacement_factor">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>99999</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Slider max:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="sb_displacement_factor_max">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>99999</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_displacement_2">
|
||||
<property name="title">
|
||||
<string>User defined equation</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="calculate">
|
||||
<property name="text">
|
||||
<string>Calculate and plot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="user_def_eq">
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:11pt;">P1-P3 # Stress intensity stress equation. Available values are numpy array format. Calculation np.funtion can be used on available values. </span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="user_def_head_1">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" text-decoration: underline;">Available result types:</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="user_def_head_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>displacement (x,y,z) and strain (ex,ey,ez)</p></body></html></string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="user_def_head_3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>stresses (sx,sy,sz) and principal stresses (P1,P2,P3)</p></body></html></string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>240</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Gui::InputField</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>Gui/InputField.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>cb_show_displacement</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>label_3</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>90</x>
|
||||
<y>232</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>68</x>
|
||||
<y>269</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cb_show_displacement</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>sb_displacement_factor</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>112</x>
|
||||
<y>240</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>124</x>
|
||||
<y>269</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cb_show_displacement</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>label_7</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>95</x>
|
||||
<y>238</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>86</x>
|
||||
<y>309</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cb_show_displacement</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>sb_displacement_factor_max</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>161</x>
|
||||
<y>237</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>159</x>
|
||||
<y>302</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cb_show_displacement</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>hsb_displacement_factor</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>48</x>
|
||||
<y>241</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>36</x>
|
||||
<y>345</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
60
src/Mod/Fem/PyGui/_CommandAnalysis.py
Normal file
60
src/Mod/Fem/PyGui/_CommandAnalysis.py
Normal file
@@ -0,0 +1,60 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Command New Analysis"
|
||||
__author__ = "Juergen Riegel"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandAnalysis
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandAnalysis(FemCommands):
|
||||
"the Fem_Analysis command definition"
|
||||
def __init__(self):
|
||||
super(_CommandAnalysis, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-analysis',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_Analysis", "Analysis container"),
|
||||
'Accel': "N, A",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_Analysis", "Creates a analysis container with standard solver CalculiX")}
|
||||
self.is_active = 'with_document'
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Analysis")
|
||||
FreeCADGui.addModule("FemGui")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand("ObjectsFem.makeAnalysis('Analysis')")
|
||||
FreeCADGui.doCommand("FemGui.setActiveAnalysis(App.activeDocument().ActiveObject)")
|
||||
FreeCADGui.doCommand("ObjectsFem.makeSolverCalculix('CalculiX')")
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [App.activeDocument().ActiveObject]")
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if (len(sel) == 1):
|
||||
if(sel[0].isDerivedFrom("Fem::FemMeshObject")):
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [App.activeDocument()." + sel[0].Name + "]")
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
|
||||
FreeCADGui.addCommand('Fem_Analysis', _CommandAnalysis())
|
||||
52
src/Mod/Fem/PyGui/_CommandBeamSection.py
Normal file
52
src/Mod/Fem/PyGui/_CommandBeamSection.py
Normal file
@@ -0,0 +1,52 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2015 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_CommandBeamSection"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandBeamSection
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandBeamSection(FemCommands):
|
||||
"The Fem_BeamSection command definition"
|
||||
def __init__(self):
|
||||
super(_CommandBeamSection, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-beam-section',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_BeamSection", "Beam cross section"),
|
||||
'Accel': "C, B",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_BeamSection", "Creates a FEM beam cross section")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FemBeamSection")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [ObjectsFem.makeBeamSection()]")
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_BeamSection', _CommandBeamSection())
|
||||
56
src/Mod/Fem/PyGui/_CommandClearMesh.py
Normal file
56
src/Mod/Fem/PyGui/_CommandClearMesh.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Clear the FemMesh of a FEM mesh object"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandClearMesh
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandClearMesh(FemCommands):
|
||||
"clear the FEM mesh"
|
||||
def __init__(self):
|
||||
super(_CommandClearMesh, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-femmesh-clear-mesh',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_ClearMesh", "Clear FEM mesh"),
|
||||
# 'Accel': "Z, Z",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_ClearMesh", "Clear the Mesh of a FEM mesh object")}
|
||||
self.is_active = 'with_femmesh'
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("Fem::FemMeshObject"):
|
||||
FreeCAD.ActiveDocument.openTransaction("Clear FEM mesh")
|
||||
FreeCADGui.addModule("Fem")
|
||||
FreeCADGui.doCommand("App.ActiveDocument." + sel[0].Name + ".FemMesh = Fem.FemMesh()")
|
||||
FreeCADGui.doCommand("App.ActiveDocument.recompute()")
|
||||
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
|
||||
FreeCADGui.addCommand('Fem_ClearMesh', _CommandClearMesh())
|
||||
52
src/Mod/Fem/PyGui/_CommandConstraintSelfWeight.py
Normal file
52
src/Mod/Fem/PyGui/_CommandConstraintSelfWeight.py
Normal file
@@ -0,0 +1,52 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Command constraint self weight"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandConstraintSelfWeight
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandConstraintSelfWeight(FemCommands):
|
||||
"The Fem_ConstraintSelfWeight command definition"
|
||||
def __init__(self):
|
||||
super(_CommandConstraintSelfWeight, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-constraint-selfweight',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_ConstraintSelfWeight", "Constraint self weigt"),
|
||||
'Accel': "C, W",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_ConstraintSelfWeight", "Creates a FEM constraint self weigt")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FemConstraintSelfWeight")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [ObjectsFem.makeConstraintSelfWeight()]")
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_ConstraintSelfWeight', _CommandConstraintSelfWeight())
|
||||
50
src/Mod/Fem/PyGui/_CommandControlSolver.py
Normal file
50
src/Mod/Fem/PyGui/_CommandControlSolver.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Command Control Solver"
|
||||
__author__ = "Juergen Riegel"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandControlSolver
|
||||
# \ingroup FEM
|
||||
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandControlSolver(FemCommands):
|
||||
"the Fem_ControlSolver command definition"
|
||||
def __init__(self):
|
||||
super(_CommandControlSolver, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-control-solver',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_ControlSolver", "Solver job control"),
|
||||
'Accel': "S, C",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_ControlSolver", "Changes solver attributes and runs the calculations for the selected solver")}
|
||||
self.is_active = 'with_solver'
|
||||
|
||||
def Activated(self):
|
||||
solver_obj = FreeCADGui.Selection.getSelection()[0]
|
||||
FreeCADGui.ActiveDocument.setEdit(solver_obj, 0)
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_ControlSolver', _CommandControlSolver())
|
||||
80
src/Mod/Fem/PyGui/_CommandFEMMesh2Mesh.py
Normal file
80
src/Mod/Fem/PyGui/_CommandFEMMesh2Mesh.py
Normal file
@@ -0,0 +1,80 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Command FEMMesh to Mesh"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandFemMesh2Mesh
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandFemMesh2Mesh(FemCommands):
|
||||
# the Fem_FemMesh2Mesh command definition
|
||||
def __init__(self):
|
||||
super(_CommandFemMesh2Mesh, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-femmesh-to-mesh',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_FemMesh2Mesh", "FEM mesh to mesh"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_FemMesh2Mesh", "Convert the surface of a FEM mesh to a mesh")}
|
||||
self.is_active = 'with_femmesh_andor_res'
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FEM mesh")
|
||||
FreeCADGui.addModule("FemGui")
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if (len(sel) == 1):
|
||||
if(sel[0].isDerivedFrom("Fem::FemMeshObject")):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Mesh from FEMMesh")
|
||||
FreeCADGui.addModule("FemMesh2Mesh")
|
||||
FreeCADGui.doCommand("out_mesh = FemMesh2Mesh.femmesh_2_mesh(App.ActiveDocument." + sel[0].Name + ".FemMesh)")
|
||||
FreeCADGui.addModule("Mesh")
|
||||
FreeCADGui.doCommand("Mesh.show(Mesh.Mesh(out_mesh))")
|
||||
FreeCADGui.doCommand("App.ActiveDocument." + sel[0].Name + ".ViewObject.hide()")
|
||||
if (len(sel) == 2):
|
||||
femmesh = None
|
||||
res = None
|
||||
if(sel[0].isDerivedFrom("Fem::FemMeshObject")):
|
||||
if(sel[1].isDerivedFrom("Fem::FemResultObject")):
|
||||
femmesh = sel[0]
|
||||
res = sel[1]
|
||||
elif(sel[1].isDerivedFrom("Fem::FemMeshObject")):
|
||||
if(sel[0].isDerivedFrom("Fem::FemResultObject")):
|
||||
femmesh = sel[1]
|
||||
res = sel[0]
|
||||
if femmesh and res:
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Mesh from FEMMesh")
|
||||
FreeCADGui.addModule("FemMesh2Mesh")
|
||||
FreeCADGui.doCommand("out_mesh = FemMesh2Mesh.femmesh_2_mesh(App.ActiveDocument." + femmesh.Name + ".FemMesh, App.ActiveDocument." + res.Name + ")")
|
||||
FreeCADGui.addModule("Mesh")
|
||||
FreeCADGui.doCommand("Mesh.show(Mesh.Mesh(out_mesh))")
|
||||
FreeCADGui.doCommand("App.ActiveDocument." + femmesh.Name + ".ViewObject.hide()")
|
||||
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_FemMesh2Mesh', _CommandFemMesh2Mesh())
|
||||
58
src/Mod/Fem/PyGui/_CommandMaterialFluid.py
Normal file
58
src/Mod/Fem/PyGui/_CommandMaterialFluid.py
Normal file
@@ -0,0 +1,58 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_CommandFluidMaterial"
|
||||
__author__ = "Juergen Riegel, Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandMaterial
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandMaterialFluid(FemCommands):
|
||||
"the Fem_MaterialFluid command definition"
|
||||
def __init__(self):
|
||||
super(_CommandMaterialFluid, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-material-fluid',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_MaterialFluid", "FEM material for Fluid"),
|
||||
'Accel': "M, M",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_MaterialFluid", "Creates a FEM material for Fluid")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
femDoc = FemGui.getActiveAnalysis().Document
|
||||
if FreeCAD.ActiveDocument is not femDoc:
|
||||
FreeCADGui.setActiveDocument(femDoc)
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Fluid Material")
|
||||
FreeCADGui.addModule("FemMaterial")
|
||||
FreeCADGui.doCommand("FemMaterial.makeFluidMaterial('FluidMaterial')")
|
||||
FreeCADGui.doCommand("App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member = App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member + [App.ActiveDocument.ActiveObject]")
|
||||
FreeCADGui.doCommand("Gui.activeDocument().setEdit(App.ActiveDocument.ActiveObject.Name)")
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_MaterialFluid', _CommandMaterialFluid())
|
||||
77
src/Mod/Fem/PyGui/_CommandMaterialMechanicalNonlinear.py
Normal file
77
src/Mod/Fem/PyGui/_CommandMaterialMechanicalNonlinear.py
Normal file
@@ -0,0 +1,77 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Command nonlinear mechanical material"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandMaterialMechanicalNonLinear
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandMaterialMechanicalNonlinear(FemCommands):
|
||||
"The Fem_MaterialMechanicalNonlinear command definition"
|
||||
def __init__(self):
|
||||
super(_CommandMaterialMechanicalNonlinear, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-material-nonlinear',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_MaterialMechanicalNonlinear", "Nonlinear mechanical material"),
|
||||
'Accel': "C, W",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_MaterialMechanicalNonlinear", "Creates a nonlinear mechanical material")}
|
||||
self.is_active = 'with_material'
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("App::MaterialObjectPython"):
|
||||
lin_mat_obj = sel[0]
|
||||
# check if an nonlinear material exists which is based on the selected material already
|
||||
allow_nonlinear_material = True
|
||||
for o in FreeCAD.ActiveDocument.Objects:
|
||||
if hasattr(o, "Proxy") and o.Proxy is not None and o.Proxy.Type == "FemMaterialMechanicalNonlinear" and o.LinearBaseMaterial == lin_mat_obj:
|
||||
FreeCAD.Console.PrintError(o.Name + ' is based on the selected material: ' + lin_mat_obj.Name + '. Only one nonlinear object for each material allowed.\n')
|
||||
allow_nonlinear_material = False
|
||||
break
|
||||
if allow_nonlinear_material:
|
||||
string_lin_mat_obj = "App.ActiveDocument.getObject('" + lin_mat_obj.Name + "')"
|
||||
command_to_run = "FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [ObjectsFem.makeMaterialMechanicalNonlinear(" + string_lin_mat_obj + ")]"
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FemMaterialMechanicalNonlinear")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand(command_to_run)
|
||||
# set the material nonlinear property of the solver to nonlinear if only one solver is available and if this solver is a CalculiX solver
|
||||
solver_object = None
|
||||
for m in FemGui.getActiveAnalysis().Member:
|
||||
if m.isDerivedFrom('Fem::FemSolverObjectPython'):
|
||||
if not solver_object:
|
||||
solver_object = m
|
||||
else:
|
||||
# we do not change the material nonlinear attribut if we have more than one solver
|
||||
solver_object = None
|
||||
break
|
||||
if solver_object and solver_object.SolverType == 'FemSolverCalculix':
|
||||
solver_object.MaterialNonlinearity = "nonlinear"
|
||||
|
||||
FreeCADGui.addCommand('Fem_MaterialMechanicalNonlinear', _CommandMaterialMechanicalNonlinear())
|
||||
58
src/Mod/Fem/PyGui/_CommandMaterialSolid.py
Normal file
58
src/Mod/Fem/PyGui/_CommandMaterialSolid.py
Normal file
@@ -0,0 +1,58 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_CommandSolidMaterial"
|
||||
__author__ = "Juergen Riegel, Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandMaterial
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandMaterialSolid(FemCommands):
|
||||
"the Fem_MaterialSolid command definition"
|
||||
def __init__(self):
|
||||
super(_CommandMaterialSolid, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-material',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_MaterialSolid", "FEM material for solid"),
|
||||
'Accel': "M, M",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_MaterialSolid", "Creates a FEM material for solid")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
femDoc = FemGui.getActiveAnalysis().Document
|
||||
if FreeCAD.ActiveDocument is not femDoc:
|
||||
FreeCADGui.setActiveDocument(femDoc)
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Solid Material")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand("ObjectsFem.makeMaterialSolid('SolidMaterial')")
|
||||
FreeCADGui.doCommand("App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member = App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member + [App.ActiveDocument.ActiveObject]")
|
||||
FreeCADGui.doCommand("Gui.activeDocument().setEdit(App.ActiveDocument.ActiveObject.Name)")
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_MaterialSolid', _CommandMaterialSolid())
|
||||
64
src/Mod/Fem/PyGui/_CommandMeshGmshFromShape.py
Normal file
64
src/Mod/Fem/PyGui/_CommandMeshGmshFromShape.py
Normal file
@@ -0,0 +1,64 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Command GMSH Mesh From Shape"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandMeshGmshFromShape
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandMeshGmshFromShape(FemCommands):
|
||||
# the Fem_MeshGmshFromShape command definition
|
||||
def __init__(self):
|
||||
super(_CommandMeshGmshFromShape, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-femmesh-gmsh-from-shape',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_MeshGmshFromShape", "FEM mesh from shape by GMSH"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_MeshGmshFromShape", "Create a FEM mesh from a shape by GMSH mesher")}
|
||||
self.is_active = 'with_part_feature'
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FEM mesh by GMSH")
|
||||
FreeCADGui.addModule("FemGui")
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if (len(sel) == 1):
|
||||
if(sel[0].isDerivedFrom("Part::Feature")):
|
||||
mesh_obj_name = sel[0].Name + "_Mesh"
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand("ObjectsFem.makeMeshGmsh('" + mesh_obj_name + "')")
|
||||
FreeCADGui.doCommand("App.ActiveDocument.ActiveObject.Part = App.ActiveDocument." + sel[0].Name)
|
||||
if FemGui.getActiveAnalysis():
|
||||
FreeCADGui.addModule("FemGui")
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [App.ActiveDocument.ActiveObject]")
|
||||
FreeCADGui.doCommand("Gui.ActiveDocument.setEdit(App.ActiveDocument.ActiveObject.Name)")
|
||||
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_MeshGmshFromShape', _CommandMeshGmshFromShape())
|
||||
57
src/Mod/Fem/PyGui/_CommandMeshGroup.py
Normal file
57
src/Mod/Fem/PyGui/_CommandMeshGroup.py
Normal file
@@ -0,0 +1,57 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_CommandMeshGroup"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandMeshGroup
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandMeshGroup(FemCommands):
|
||||
"The Fem_MeshGroup command definition"
|
||||
def __init__(self):
|
||||
super(_CommandMeshGroup, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-femmesh-from-shape',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_MeshGroup", "FEM mesh group"),
|
||||
'Accel': "M, G",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_MeshGroup", "Creates a FEM mesh group")}
|
||||
self.is_active = 'with_gmsh_femmesh'
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FemMeshGroup")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if (len(sel) == 1):
|
||||
sobj = sel[0]
|
||||
if len(sel) == 1 and hasattr(sobj, "Proxy") and sobj.Proxy.Type == "FemMeshGmsh":
|
||||
FreeCADGui.doCommand("ObjectsFem.makeMeshGroup(App.ActiveDocument." + sobj.Name + ")")
|
||||
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
|
||||
FreeCADGui.addCommand('Fem_MeshGroup', _CommandMeshGroup())
|
||||
62
src/Mod/Fem/PyGui/_CommandMeshNetgenFromShape.py
Normal file
62
src/Mod/Fem/PyGui/_CommandMeshNetgenFromShape.py
Normal file
@@ -0,0 +1,62 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Command Mesh Netgen From Shape"
|
||||
__author__ = "Juergen Riegel"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandMeshNetgenFromShape
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandMeshNetgenFromShape(FemCommands):
|
||||
# the Fem_MeshNetgenFromShape command definition
|
||||
def __init__(self):
|
||||
super(_CommandMeshNetgenFromShape, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-femmesh-netgen-from-shape',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_MeshFromShape", "FEM mesh from shape by Netgen"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_MeshFromShape", "Create a FEM volume mesh from a solid or face shape by Netgen internal mesher")}
|
||||
self.is_active = 'with_part_feature'
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FEM mesh Netgen")
|
||||
FreeCADGui.addModule("FemGui")
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if (len(sel) == 1):
|
||||
if(sel[0].isDerivedFrom("Part::Feature")):
|
||||
FreeCADGui.doCommand("App.activeDocument().addObject('Fem::FemMeshShapeNetgenObject', '" + sel[0].Name + "_Mesh')")
|
||||
FreeCADGui.doCommand("App.activeDocument().ActiveObject.Shape = App.activeDocument()." + sel[0].Name)
|
||||
if FemGui.getActiveAnalysis():
|
||||
FreeCADGui.addModule("FemGui")
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [App.ActiveDocument.ActiveObject]")
|
||||
FreeCADGui.doCommand("Gui.activeDocument().setEdit(App.ActiveDocument.ActiveObject.Name)")
|
||||
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_MeshNetgenFromShape', _CommandMeshNetgenFromShape())
|
||||
57
src/Mod/Fem/PyGui/_CommandMeshRegion.py
Normal file
57
src/Mod/Fem/PyGui/_CommandMeshRegion.py
Normal file
@@ -0,0 +1,57 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_CommandMeshRegion"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandMeshRegion
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandMeshRegion(FemCommands):
|
||||
"The Fem_MeshRegion command definition"
|
||||
def __init__(self):
|
||||
super(_CommandMeshRegion, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-femmesh-region',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_MeshRegion", "FEM mesh region"),
|
||||
'Accel': "M, R",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_MeshRegion", "Creates a FEM mesh region")}
|
||||
self.is_active = 'with_gmsh_femmesh'
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FemMeshRegion")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if (len(sel) == 1):
|
||||
sobj = sel[0]
|
||||
if len(sel) == 1 and hasattr(sobj, "Proxy") and sobj.Proxy.Type == "FemMeshGmsh":
|
||||
FreeCADGui.doCommand("ObjectsFem.makeMeshRegion(App.ActiveDocument." + sobj.Name + ")")
|
||||
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
|
||||
FreeCADGui.addCommand('Fem_MeshRegion', _CommandMeshRegion())
|
||||
58
src/Mod/Fem/PyGui/_CommandPrintMeshInfo.py
Normal file
58
src/Mod/Fem/PyGui/_CommandPrintMeshInfo.py
Normal file
@@ -0,0 +1,58 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Print info of FEM mesh object"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandPrintMeshInfo
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandPrintMeshInfo(FemCommands):
|
||||
"Print FEM mesh info"
|
||||
def __init__(self):
|
||||
super(_CommandPrintMeshInfo, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-femmesh-print-info',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_PrintMeshInfo", "Print FEM mesh info"),
|
||||
# 'Accel': "Z, Z",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_PrintMeshInfo", "Print FEM mesh info")}
|
||||
self.is_active = 'with_femmesh'
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("Fem::FemMeshObject"):
|
||||
FreeCAD.ActiveDocument.openTransaction("Print FEM mesh info")
|
||||
FreeCADGui.doCommand("print(App.ActiveDocument." + sel[0].Name + ".FemMesh)")
|
||||
|
||||
FreeCADGui.addModule("PySide")
|
||||
FreeCADGui.doCommand("mesh_info = str(App.ActiveDocument." + sel[0].Name + ".FemMesh)")
|
||||
FreeCADGui.doCommand("PySide.QtGui.QMessageBox.information(None, 'FEM Mesh Info', mesh_info)")
|
||||
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
|
||||
FreeCADGui.addCommand('Fem_PrintMeshInfo', _CommandPrintMeshInfo())
|
||||
52
src/Mod/Fem/PyGui/_CommandPurgeResults.py
Normal file
52
src/Mod/Fem/PyGui/_CommandPurgeResults.py
Normal file
@@ -0,0 +1,52 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Command Purge Fem Results"
|
||||
__author__ = "Juergen Riegel"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandPurgeResults
|
||||
# \ingroup FEM
|
||||
|
||||
from FemCommands import FemCommands
|
||||
import FemTools
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandPurgeResults(FemCommands):
|
||||
# the Fem_PurgeResults command definition
|
||||
def __init__(self):
|
||||
super(_CommandPurgeResults, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-purge-results',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_PurgeResults", "Purge results"),
|
||||
'Accel': "S, S",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_PurgeResults", "Purges all results from active analysis")}
|
||||
self.is_active = 'with_results'
|
||||
|
||||
def Activated(self):
|
||||
fea = FemTools.FemTools()
|
||||
fea.reset_all()
|
||||
self.hide_meshes_show_parts_constraints()
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_PurgeResults', _CommandPurgeResults())
|
||||
80
src/Mod/Fem/PyGui/_CommandRunSolver.py
Normal file
80
src/Mod/Fem/PyGui/_CommandRunSolver.py
Normal file
@@ -0,0 +1,80 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Command Run Solver"
|
||||
__author__ = "Juergen Riegel"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandRunSolver
|
||||
# \ingroup FEM
|
||||
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
|
||||
class _CommandRunSolver(FemCommands):
|
||||
# the Fem_RunSolver command definition
|
||||
def __init__(self):
|
||||
super(_CommandRunSolver, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-run-solver',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_RunAnalysis", "Run solver calculations"),
|
||||
'Accel': "R, C",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_RunAnalysis", "Runs the calculations for the selected solver")}
|
||||
self.is_active = 'with_solver'
|
||||
|
||||
def Activated(self):
|
||||
def load_results(ret_code):
|
||||
if ret_code == 0:
|
||||
self.fea.load_results()
|
||||
else:
|
||||
print ("CalculiX failed ccx finished with error {}".format(ret_code))
|
||||
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if len(sel) == 1 and sel[0].isDerivedFrom("Fem::FemSolverObjectPython"):
|
||||
self.solver = sel[0]
|
||||
if self.solver.SolverType == "FemSolverCalculix":
|
||||
import FemToolsCcx
|
||||
self.fea = FemToolsCcx.FemToolsCcx(None, self.solver)
|
||||
self.fea.reset_mesh_purge_results_checked()
|
||||
message = self.fea.check_prerequisites()
|
||||
if message:
|
||||
QtGui.QMessageBox.critical(None, "Missing prerequisite", message)
|
||||
return
|
||||
self.fea.finished.connect(load_results)
|
||||
QtCore.QThreadPool.globalInstance().start(self.fea)
|
||||
elif self.solver.SolverType == "FemSolverZ88":
|
||||
import FemToolsZ88
|
||||
self.fea = FemToolsZ88.FemToolsZ88(None, self.solver)
|
||||
self.fea.reset_mesh_purge_results_checked()
|
||||
message = self.fea.check_prerequisites()
|
||||
if message:
|
||||
QtGui.QMessageBox.critical(None, "Missing prerequisite", message)
|
||||
return
|
||||
self.fea.run() # test z88
|
||||
# self.fea.finished.connect(load_results)
|
||||
# QtCore.QThreadPool.globalInstance().start(self.fea)
|
||||
else:
|
||||
QtGui.QMessageBox.critical(None, "Not known solver type", message)
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_RunSolver', _CommandRunSolver())
|
||||
52
src/Mod/Fem/PyGui/_CommandShellThickness.py
Normal file
52
src/Mod/Fem/PyGui/_CommandShellThickness.py
Normal file
@@ -0,0 +1,52 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2015 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_CommandShellThickness"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandShellThickness
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandShellThickness(FemCommands):
|
||||
"The Fem_ShellThickness command definition"
|
||||
def __init__(self):
|
||||
super(_CommandShellThickness, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-shell-thickness',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_ShellThickness", "Shell plate thickness"),
|
||||
'Accel': "C, S",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_ShellThickness", "Creates a FEM shell plate thickness")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FemShellThickness")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [ObjectsFem.makeShellThickness()]")
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_ShellThickness', _CommandShellThickness())
|
||||
57
src/Mod/Fem/PyGui/_CommandShowResult.py
Normal file
57
src/Mod/Fem/PyGui/_CommandShowResult.py
Normal file
@@ -0,0 +1,57 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Command Show Result"
|
||||
__author__ = "Juergen Riegel, Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandShowResult
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD Command show results for FEM workbench
|
||||
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandShowResult(FemCommands):
|
||||
"the Fem show reslult command definition"
|
||||
def __init__(self):
|
||||
super(_CommandShowResult, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-result',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_ShowResult", "Show result"),
|
||||
'Accel': "S, R",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_ShowResult", "Shows and visualizes selected result data")}
|
||||
self.is_active = 'with_selresult'
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if (len(sel) == 1):
|
||||
if sel[0].isDerivedFrom("Fem::FemResultObject"):
|
||||
self.result_object = sel[0]
|
||||
|
||||
import _ViewProviderFemResultMechanical
|
||||
if _ViewProviderFemResultMechanical.is_result_obj_valid(self.result_object):
|
||||
self.result_object.ViewObject.startEditing()
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_ShowResult', _CommandShowResult())
|
||||
62
src/Mod/Fem/PyGui/_CommandSolverCalculix.py
Normal file
62
src/Mod/Fem/PyGui/_CommandSolverCalculix.py
Normal file
@@ -0,0 +1,62 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2015 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_CommandSolverCalculix"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandSolverCalculix
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandSolverCalculix(FemCommands):
|
||||
"The Fem_SolverCalculix command definition"
|
||||
def __init__(self):
|
||||
super(_CommandSolverCalculix, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-solver',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_SolverCalculix", "Solver CalculiX"),
|
||||
'Accel': "S, C",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_SolverCalculix", "Creates a FEM solver CalculiX")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
has_nonlinear_material_obj = False
|
||||
for m in FemGui.getActiveAnalysis().Member:
|
||||
if hasattr(m, "Proxy") and m.Proxy.Type == "FemMaterialMechanicalNonlinear":
|
||||
has_nonlinear_material_obj = True
|
||||
FreeCAD.ActiveDocument.openTransaction("Create SolverCalculix")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
if has_nonlinear_material_obj:
|
||||
FreeCADGui.doCommand("solver = ObjectsFem.makeSolverCalculix()")
|
||||
FreeCADGui.doCommand("solver.MaterialNonlinearity = 'nonlinear'")
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [solver]")
|
||||
else:
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [ObjectsFem.makeSolverCalculix()]")
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_SolverCalculix', _CommandSolverCalculix())
|
||||
52
src/Mod/Fem/PyGui/_CommandSolverZ88.py
Normal file
52
src/Mod/Fem/PyGui/_CommandSolverZ88.py
Normal file
@@ -0,0 +1,52 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_CommandSolverZ88"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package CommandSolverZ88
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandSolverZ88(FemCommands):
|
||||
"The Fem_SolverZ88 command definition"
|
||||
def __init__(self):
|
||||
super(_CommandSolverZ88, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-solver',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_SolverZ88", "Solver Z88"),
|
||||
'Accel': "S, Z",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_SolverZ88", "Creates a FEM solver Z88")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create SolverZ88")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [ObjectsFem.makeSolverZ88()]")
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Fem_SolverZ88', _CommandSolverZ88())
|
||||
181
src/Mod/Fem/PyGui/_TaskPanelFemBeamSection.py
Normal file
181
src/Mod/Fem/PyGui/_TaskPanelFemBeamSection.py
Normal file
@@ -0,0 +1,181 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2015 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_TaskPanelFemBeamSection"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package TaskPanelFemBeamSection
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from PySide import QtGui
|
||||
from PySide import QtCore
|
||||
import _FemBeamSection
|
||||
|
||||
|
||||
class _TaskPanelFemBeamSection:
|
||||
'''The TaskPanel for editing References property of FemBeamSection objects'''
|
||||
def __init__(self, obj):
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
self.sel_server = None
|
||||
self.obj = obj
|
||||
|
||||
self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/TaskPanelFemBeamSection.ui")
|
||||
QtCore.QObject.connect(self.form.cb_crosssectiontype, QtCore.SIGNAL("activated(int)"), self.sectiontype_changed)
|
||||
QtCore.QObject.connect(self.form.if_rec_height, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.rec_height_changed)
|
||||
QtCore.QObject.connect(self.form.if_rec_width, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.rec_width_changed)
|
||||
QtCore.QObject.connect(self.form.if_circ_diameter, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.circ_diameter_changed)
|
||||
QtCore.QObject.connect(self.form.if_pipe_diameter, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.pipe_diameter_changed)
|
||||
QtCore.QObject.connect(self.form.if_pipe_thickness, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.pipe_thickness_changed)
|
||||
QtCore.QObject.connect(self.form.pushButton_Reference, QtCore.SIGNAL("clicked()"), self.add_references)
|
||||
self.form.list_References.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||
self.form.list_References.connect(self.form.list_References, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.references_list_right_clicked)
|
||||
|
||||
self.form.cb_crosssectiontype.addItems(_FemBeamSection._FemBeamSection.known_beam_types)
|
||||
|
||||
self.get_beamsection_props()
|
||||
self.update()
|
||||
|
||||
def accept(self):
|
||||
self.set_beamsection_props()
|
||||
if self.sel_server:
|
||||
FreeCADGui.Selection.removeObserver(self.sel_server)
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return True
|
||||
|
||||
def reject(self):
|
||||
if self.sel_server:
|
||||
FreeCADGui.Selection.removeObserver(self.sel_server)
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
return True
|
||||
|
||||
def get_beamsection_props(self):
|
||||
self.references = []
|
||||
if self.obj.References:
|
||||
self.tuplereferences = self.obj.References
|
||||
self.get_references()
|
||||
self.SectionType = self.obj.SectionType
|
||||
self.RectHeight = self.obj.RectHeight
|
||||
self.RectWidth = self.obj.RectWidth
|
||||
self.CircDiameter = self.obj.CircDiameter
|
||||
self.PipeDiameter = self.obj.PipeDiameter
|
||||
self.PipeThickness = self.obj.PipeThickness
|
||||
|
||||
def set_beamsection_props(self):
|
||||
self.obj.References = self.references
|
||||
self.obj.SectionType = self.SectionType
|
||||
self.obj.RectHeight = self.RectHeight
|
||||
self.obj.RectWidth = self.RectWidth
|
||||
self.obj.CircDiameter = self.CircDiameter
|
||||
self.obj.PipeDiameter = self.PipeDiameter
|
||||
self.obj.PipeThickness = self.PipeThickness
|
||||
|
||||
def update(self):
|
||||
'fills the widgets'
|
||||
index_crosssectiontype = self.form.cb_crosssectiontype.findText(self.SectionType)
|
||||
self.form.cb_crosssectiontype.setCurrentIndex(index_crosssectiontype)
|
||||
self.form.if_rec_height.setText(self.RectHeight.UserString)
|
||||
self.form.if_rec_width.setText(self.RectWidth.UserString)
|
||||
self.form.if_circ_diameter.setText(self.CircDiameter.UserString)
|
||||
self.form.if_pipe_diameter.setText(self.PipeDiameter.UserString)
|
||||
self.form.if_pipe_thickness.setText(self.PipeThickness.UserString)
|
||||
self.rebuild_list_References()
|
||||
|
||||
def sectiontype_changed(self, index):
|
||||
if index < 0:
|
||||
return
|
||||
self.form.cb_crosssectiontype.setCurrentIndex(index)
|
||||
self.SectionType = str(self.form.cb_crosssectiontype.itemText(index)) # form returns unicode
|
||||
|
||||
def rec_height_changed(self, base_quantity_value):
|
||||
self.RectHeight = base_quantity_value
|
||||
|
||||
def rec_width_changed(self, base_quantity_value):
|
||||
self.RectWidth = base_quantity_value
|
||||
|
||||
def circ_diameter_changed(self, base_quantity_value):
|
||||
self.CircDiameter = base_quantity_value
|
||||
|
||||
def pipe_diameter_changed(self, base_quantity_value):
|
||||
self.PipeDiameter = base_quantity_value
|
||||
|
||||
def pipe_thickness_changed(self, base_quantity_value):
|
||||
self.PipeThickness = base_quantity_value
|
||||
|
||||
def get_references(self):
|
||||
for ref in self.tuplereferences:
|
||||
for elem in ref[1]:
|
||||
self.references.append((ref[0], elem))
|
||||
|
||||
def references_list_right_clicked(self, QPos):
|
||||
self.form.contextMenu = QtGui.QMenu()
|
||||
menu_item = self.form.contextMenu.addAction("Remove Reference")
|
||||
if not self.references:
|
||||
menu_item.setDisabled(True)
|
||||
self.form.connect(menu_item, QtCore.SIGNAL("triggered()"), self.remove_reference)
|
||||
parentPosition = self.form.list_References.mapToGlobal(QtCore.QPoint(0, 0))
|
||||
self.form.contextMenu.move(parentPosition + QPos)
|
||||
self.form.contextMenu.show()
|
||||
|
||||
def remove_reference(self):
|
||||
if not self.references:
|
||||
return
|
||||
currentItemName = str(self.form.list_References.currentItem().text())
|
||||
for ref in self.references:
|
||||
refname_to_compare_listentry = ref[0].Name + ':' + ref[1]
|
||||
if refname_to_compare_listentry == currentItemName:
|
||||
self.references.remove(ref)
|
||||
self.rebuild_list_References()
|
||||
|
||||
def add_references(self):
|
||||
'''Called if Button add_reference is triggered'''
|
||||
# in constraints EditTaskPanel the selection is active as soon as the taskpanel is open
|
||||
# here the addReference button EditTaskPanel has to be triggered to start selection mode
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
# start SelectionObserver and parse the function to add the References to the widget
|
||||
print_message = "Select Edges by single click on them to add them to the list"
|
||||
import FemSelectionObserver
|
||||
self.sel_server = FemSelectionObserver.FemSelectionObserver(self.selectionParser, print_message)
|
||||
|
||||
def selectionParser(self, selection):
|
||||
# print('selection: ', selection[0].Shape.ShapeType, ' ', selection[0].Name, ' ', selection[1])
|
||||
if hasattr(selection[0], "Shape"):
|
||||
if selection[1]:
|
||||
elt = selection[0].Shape.getElement(selection[1])
|
||||
if elt.ShapeType == 'Edge':
|
||||
if selection not in self.references:
|
||||
self.references.append(selection)
|
||||
self.rebuild_list_References()
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage(selection[0].Name + ' --> ' + selection[1] + ' is in reference list already!\n')
|
||||
|
||||
def rebuild_list_References(self):
|
||||
self.form.list_References.clear()
|
||||
items = []
|
||||
for ref in self.references:
|
||||
item_name = ref[0].Name + ':' + ref[1]
|
||||
items.append(item_name)
|
||||
for listItemName in sorted(items):
|
||||
self.form.list_References.addItem(listItemName)
|
||||
572
src/Mod/Fem/PyGui/_TaskPanelFemMaterial.py
Normal file
572
src/Mod/Fem/PyGui/_TaskPanelFemMaterial.py
Normal file
@@ -0,0 +1,572 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_TaskPanelFemMaterial"
|
||||
__author__ = "Juergen Riegel, Bernd Hahnebach, Qingfeng Xia"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package TaskPanelFemMaterial
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from PySide import QtGui
|
||||
from PySide.QtGui import QFileDialog
|
||||
# from PySide.QtGui import QMessageBox
|
||||
from PySide import QtCore
|
||||
import Units
|
||||
|
||||
|
||||
class _TaskPanelFemMaterial:
|
||||
'''The editmode TaskPanel for FemMaterial objects'''
|
||||
def __init__(self, obj):
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
self.sel_server = None
|
||||
self.obj = obj
|
||||
self.selection_mode_solid = False
|
||||
self.selection_mode_std_print_message = "Select Faces and Edges by single click on them to add them to the list."
|
||||
self.selection_mode_solid_print_message = "Select Solids by single click on a Face or Edge which belongs to the Solid, to add the Solid to the list."
|
||||
self.material = self.obj.Material
|
||||
self.references = []
|
||||
if self.obj.References:
|
||||
self.tuplereferences = self.obj.References
|
||||
self.get_references()
|
||||
self.references_shape_type = None
|
||||
|
||||
self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/TaskPanelFemMaterial.ui")
|
||||
QtCore.QObject.connect(self.form.pushButton_MatWeb, QtCore.SIGNAL("clicked()"), self.goto_MatWeb)
|
||||
QtCore.QObject.connect(self.form.pushButton_saveas, QtCore.SIGNAL("clicked()"), self.export_material)
|
||||
QtCore.QObject.connect(self.form.cb_materials, QtCore.SIGNAL("activated(int)"), self.choose_material)
|
||||
QtCore.QObject.connect(self.form.pushButton_Reference, QtCore.SIGNAL("clicked()"), self.add_references)
|
||||
QtCore.QObject.connect(self.form.rb_standard, QtCore.SIGNAL("toggled(bool)"), self.choose_selection_mode_standard)
|
||||
QtCore.QObject.connect(self.form.rb_solid, QtCore.SIGNAL("toggled(bool)"), self.choose_selection_mode_solid)
|
||||
# basic properties must be provided
|
||||
QtCore.QObject.connect(self.form.input_fd_density, QtCore.SIGNAL("valueChanged(double)"), self.density_changed)
|
||||
# mechanical properties
|
||||
QtCore.QObject.connect(self.form.input_fd_young_modulus, QtCore.SIGNAL("valueChanged(double)"), self.ym_changed)
|
||||
QtCore.QObject.connect(self.form.spinBox_poisson_ratio, QtCore.SIGNAL("valueChanged(double)"), self.pr_changed)
|
||||
# thermal properties
|
||||
QtCore.QObject.connect(self.form.input_fd_thermal_conductivity, QtCore.SIGNAL("valueChanged(double)"), self.tc_changed)
|
||||
QtCore.QObject.connect(self.form.input_fd_expansion_coefficient, QtCore.SIGNAL("valueChanged(double)"), self.tec_changed)
|
||||
QtCore.QObject.connect(self.form.input_fd_specific_heat, QtCore.SIGNAL("valueChanged(double)"), self.sh_changed)
|
||||
# fluidic properties, only volumetric thermal expansion coeff makes sense
|
||||
QtCore.QObject.connect(self.form.input_fd_kinematic_viscosity, QtCore.SIGNAL("valueChanged(double)"), self.kinematic_viscosity_changed)
|
||||
QtCore.QObject.connect(self.form.input_fd_vol_expansion_coefficient, QtCore.SIGNAL("valueChanged(double)"), self.vtec_changed)
|
||||
|
||||
# hide some groupBox according to material category
|
||||
self.form.label_category.setText(self.obj.Category)
|
||||
if self.obj.Category == 'Fluid':
|
||||
self.form.groupBox_mechanical.setVisible(0)
|
||||
self.form.label_expansion_coefficient.setVisible(0)
|
||||
self.form.input_fd_expansion_coefficient.setVisible(0)
|
||||
else:
|
||||
self.form.groupBox_fluidic.setVisible(0)
|
||||
self.form.label_vol_expansion_coefficient.setVisible(0)
|
||||
self.form.input_fd_vol_expansion_coefficient.setVisible(0)
|
||||
|
||||
self.form.list_References.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||
self.form.list_References.connect(self.form.list_References, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.references_list_right_clicked)
|
||||
|
||||
self.import_materials()
|
||||
previous_mat_path = self.get_material_path(self.material)
|
||||
if not previous_mat_path:
|
||||
material_name = self.get_material_name(self.material)
|
||||
if material_name != 'None':
|
||||
FreeCAD.Console.PrintMessage("Previously used material cannot be found in material directories. Using transient material.\n")
|
||||
self.add_transient_material(self.material)
|
||||
index = self.form.cb_materials.findData(material_name)
|
||||
else:
|
||||
if not self.material:
|
||||
index = self.form.cb_materials.findText(material_name)
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage("None material was previously used. Reload values.\n")
|
||||
self.add_transient_material(self.material)
|
||||
index = self.form.cb_materials.findData(material_name)
|
||||
self.choose_material(index)
|
||||
else:
|
||||
index = self.form.cb_materials.findData(previous_mat_path)
|
||||
self.choose_material(index)
|
||||
self.has_equal_references_shape_types()
|
||||
self.rebuild_list_References()
|
||||
|
||||
def accept(self):
|
||||
# print(self.material)
|
||||
self.remove_active_sel_server()
|
||||
if self.has_equal_references_shape_types():
|
||||
self.obj.Material = self.material
|
||||
self.obj.References = self.references
|
||||
doc = FreeCADGui.getDocument(self.obj.Document)
|
||||
doc.resetEdit()
|
||||
doc.Document.recompute()
|
||||
|
||||
def reject(self):
|
||||
self.remove_active_sel_server()
|
||||
doc = FreeCADGui.getDocument(self.obj.Document)
|
||||
doc.resetEdit()
|
||||
|
||||
def remove_active_sel_server(self):
|
||||
if self.sel_server:
|
||||
FreeCADGui.Selection.removeObserver(self.sel_server)
|
||||
|
||||
def choose_selection_mode_standard(self, state):
|
||||
self.selection_mode_solid = not state
|
||||
if self.sel_server and not self.selection_mode_solid:
|
||||
print(self.selection_mode_std_print_message)
|
||||
|
||||
def choose_selection_mode_solid(self, state):
|
||||
self.selection_mode_solid = state
|
||||
if self.sel_server and self.selection_mode_solid:
|
||||
print(self.selection_mode_solid_print_message)
|
||||
|
||||
def get_references(self):
|
||||
for ref in self.tuplereferences:
|
||||
for elem in ref[1]:
|
||||
self.references.append((ref[0], elem))
|
||||
|
||||
def has_equal_references_shape_types(self):
|
||||
import FemMeshTools
|
||||
if not self.references:
|
||||
self.references_shape_type = None
|
||||
for ref in self.references:
|
||||
r = FemMeshTools.get_element(ref[0], ref[1]) # the method getElement(element) does not return Solid elements
|
||||
# print(' ReferenceShape : ', r.ShapeType, ', ', ref[0].Name, ', ', ref[0].Label, ' --> ', ref[1])
|
||||
if self.references_shape_type is None:
|
||||
self.references_shape_type = r.ShapeType
|
||||
if r.ShapeType != self.references_shape_type:
|
||||
FreeCAD.Console.PrintError('Different ShapeTypes in Reference List not allowed\n')
|
||||
return False
|
||||
return True
|
||||
|
||||
def goto_MatWeb(self):
|
||||
import webbrowser
|
||||
webbrowser.open("http://matweb.com")
|
||||
|
||||
def check_material_keys(self):
|
||||
if 'Density' not in self.material:
|
||||
print('Density not found in material data of: ' + self.material['Name'])
|
||||
self.material['Density'] = '0 kg/m^3'
|
||||
if self.obj.Category == 'Solid':
|
||||
# mechanical properties
|
||||
if 'YoungsModulus' not in self.material:
|
||||
print('YoungsModulus not found in material data of: ' + self.material['Name'])
|
||||
self.material['YoungsModulus'] = '0 MPa'
|
||||
if 'PoissonRatio' not in self.material:
|
||||
print('PoissonRatio not found in material data of: ' + self.material['Name'])
|
||||
self.material['PoissonRatio'] = '0'
|
||||
if self.obj.Category == 'Fluid':
|
||||
# Fluidic properties
|
||||
if 'KinematicViscosity' not in self.material:
|
||||
print('KinematicViscosity not found in material data of: ' + self.material['Name'])
|
||||
self.material['KineticViscosity'] = '0 m^2/s'
|
||||
if 'VolumetricThermalExpansionCoefficient' not in self.material:
|
||||
print('VolumetricThermalExpansionCoefficient not found in material data of: ' + self.material['Name'])
|
||||
self.material['VolumetricThermalExpansionCoefficient'] = '0 m/m/K'
|
||||
# Thermal properties
|
||||
if 'ThermalConductivity' not in self.material:
|
||||
print('ThermalConductivity not found in material data of: ' + self.material['Name'])
|
||||
self.material['ThermalConductivity'] = '0 W/m/K'
|
||||
if 'ThermalExpansionCoefficient' not in self.material:
|
||||
print('ThermalExpansionCoefficient not found in material data of: ' + self.material['Name'])
|
||||
self.material['ThermalExpansionCoefficient'] = '0 um/m/K'
|
||||
if 'SpecificHeat' not in self.material:
|
||||
print('SpecificHeat not found in material data of: ' + self.material['Name'])
|
||||
self.material['SpecificHeat'] = '0 J/kg/K'
|
||||
# Electromagnetic properties
|
||||
|
||||
def ym_changed(self, value):
|
||||
# FreeCADs standard unit for stress is kPa
|
||||
old_ym = Units.Quantity(self.material['YoungsModulus']).getValueAs("kPa")
|
||||
variation = 0.001
|
||||
if value:
|
||||
if not (1 - variation < float(old_ym) / value < 1 + variation):
|
||||
# YoungsModulus has changed
|
||||
material = self.material
|
||||
material['YoungsModulus'] = unicode(value) + " kPa"
|
||||
self.material = material
|
||||
|
||||
def density_changed(self, value):
|
||||
# FreeCADs standard unit for density is kg/mm^3
|
||||
old_density = Units.Quantity(self.material['Density']).getValueAs("kg/m^3")
|
||||
variation = 0.001
|
||||
if value:
|
||||
if not (1 - variation < float(old_density) / value < 1 + variation):
|
||||
# density has changed
|
||||
material = self.material
|
||||
value_in_kg_per_m3 = value * 1e9
|
||||
material['Density'] = unicode(value_in_kg_per_m3) + " kg/m^3" # SvdW:Keep density in SI units for easier readability
|
||||
self.material = material
|
||||
|
||||
def pr_changed(self, value):
|
||||
old_pr = Units.Quantity(self.material['PoissonRatio'])
|
||||
variation = 0.001
|
||||
if value:
|
||||
if not (1 - variation < float(old_pr) / value < 1 + variation):
|
||||
# PoissonRatio has changed
|
||||
material = self.material
|
||||
material['PoissonRatio'] = unicode(value)
|
||||
self.material = material
|
||||
|
||||
def tc_changed(self, value):
|
||||
old_tc = Units.Quantity(self.material['ThermalConductivity']).getValueAs("W/m/K")
|
||||
variation = 0.001
|
||||
if value:
|
||||
if not (1 - variation < float(old_tc) / value < 1 + variation):
|
||||
# ThermalConductivity has changed
|
||||
material = self.material
|
||||
value_in_W_per_mK = value * 1e-3 # To compensate for use of SI units
|
||||
material['ThermalConductivity'] = unicode(value_in_W_per_mK) + " W/m/K"
|
||||
self.material = material
|
||||
|
||||
def tec_changed(self, value):
|
||||
old_tec = Units.Quantity(self.material['ThermalExpansionCoefficient']).getValueAs("um/m/K")
|
||||
variation = 0.001
|
||||
if value:
|
||||
if not (1 - variation < float(old_tec) / value < 1 + variation):
|
||||
# ThermalExpansionCoefficient has changed
|
||||
material = self.material
|
||||
value_in_um_per_mK = value * 1e6 # To compensate for use of SI units
|
||||
material['ThermalExpansionCoefficient'] = unicode(value_in_um_per_mK) + " um/m/K"
|
||||
self.material = material
|
||||
|
||||
def sh_changed(self, value):
|
||||
old_sh = Units.Quantity(self.material['SpecificHeat']).getValueAs("J/kg/K")
|
||||
variation = 0.001
|
||||
if value:
|
||||
if not (1 - variation < float(old_sh) / value < 1 + variation):
|
||||
# SpecificHeat has changed
|
||||
material = self.material
|
||||
value_in_J_per_kgK = value * 1e-6 # To compensate for use of SI units
|
||||
material['SpecificHeat'] = unicode(value_in_J_per_kgK) + " J/kg/K"
|
||||
self.material = material
|
||||
|
||||
################ fluidic #########################
|
||||
def vtec_changed(self, value):
|
||||
old_vtec = Units.Quantity(self.material['VolumetricThermalExpansionCoefficient']).getValueAs("m/m/K")
|
||||
variation = 0.001
|
||||
if value:
|
||||
if not (1 - variation < float(old_vtec) / value < 1 + variation):
|
||||
# VolumetricThermalExpansionCoefficient has changed
|
||||
material = self.material
|
||||
value_in_one_per_K = value
|
||||
material['VolumetricThermalExpansionCoefficient'] = unicode(value_in_one_per_K) + " m/m/K"
|
||||
self.material = material
|
||||
|
||||
def kinematic_viscosity_changed(self, value):
|
||||
old_nu = Units.Quantity(self.material['KinematicViscosity']).getValueAs("m^2/s")
|
||||
variation = 0.000001
|
||||
if value:
|
||||
if not (1 - variation < float(old_nu) / value < 1 + variation):
|
||||
# KinematicViscosity has changed
|
||||
material = self.material
|
||||
value_in_m2_per_second = value
|
||||
material['KinematicViscosity'] = unicode(value_in_m2_per_second) + " m^2/s"
|
||||
self.material = material
|
||||
|
||||
def choose_material(self, index):
|
||||
if index < 0:
|
||||
return
|
||||
mat_file_path = self.form.cb_materials.itemData(index)
|
||||
self.material = self.materials[mat_file_path]
|
||||
self.form.cb_materials.setCurrentIndex(index)
|
||||
self.check_material_keys()
|
||||
self.set_mat_params_in_combo_box(self.material)
|
||||
gen_mat_desc = ""
|
||||
if 'Description' in self.material:
|
||||
gen_mat_desc = self.material['Description']
|
||||
self.form.l_mat_description.setText(gen_mat_desc)
|
||||
|
||||
def get_material_name(self, material):
|
||||
if 'Name' in self.material:
|
||||
return self.material['Name']
|
||||
else:
|
||||
return 'None'
|
||||
|
||||
def get_material_path(self, material):
|
||||
for a_mat in self.materials:
|
||||
unmatched_items = set(self.materials[a_mat].items()) ^ set(material.items())
|
||||
if len(unmatched_items) == 0:
|
||||
return a_mat
|
||||
return ""
|
||||
|
||||
def set_mat_params_in_combo_box(self, matmap):
|
||||
if 'YoungsModulus' in matmap:
|
||||
ym_new_unit = "MPa"
|
||||
ym = FreeCAD.Units.Quantity(matmap['YoungsModulus'])
|
||||
ym_with_new_unit = ym.getValueAs(ym_new_unit)
|
||||
self.form.input_fd_young_modulus.setText("{} {}".format(ym_with_new_unit, ym_new_unit))
|
||||
if 'PoissonRatio' in matmap:
|
||||
self.form.spinBox_poisson_ratio.setValue(float(matmap['PoissonRatio']))
|
||||
# Fluidic properties
|
||||
if 'KinematicViscosity' in matmap:
|
||||
nu_new_unit = "m^2/s"
|
||||
nu = FreeCAD.Units.Quantity(matmap['KinematicViscosity'])
|
||||
nu_with_new_unit = nu.getValueAs(nu_new_unit)
|
||||
self.form.input_fd_kinematic_viscosity.setText("{} {}".format(nu_with_new_unit, nu_new_unit))
|
||||
# For isotropic materials the volumetric thermal expansion coefficient is three times the linear coefficient:
|
||||
if 'VolumetricThermalExpansionCoefficient' in matmap: # linear, only for solid
|
||||
vtec_new_unit = "m/m/K"
|
||||
vtec = FreeCAD.Units.Quantity(matmap['VolumetricThermalExpansionCoefficient'])
|
||||
vtec_with_new_unit = vtec.getValueAs(vtec_new_unit)
|
||||
self.form.input_fd_vol_expansion_coefficient.setText("{} {}".format(vtec_with_new_unit, vtec_new_unit))
|
||||
|
||||
if 'Density' in matmap:
|
||||
density_new_unit = "kg/m^3"
|
||||
density = FreeCAD.Units.Quantity(matmap['Density'])
|
||||
density_with_new_unit = density.getValueAs(density_new_unit)
|
||||
self.form.input_fd_density.setText("{} {}".format(density_with_new_unit, density_new_unit))
|
||||
# thermal properties
|
||||
if 'ThermalConductivity' in matmap:
|
||||
tc_new_unit = "W/m/K"
|
||||
tc = FreeCAD.Units.Quantity(matmap['ThermalConductivity'])
|
||||
tc_with_new_unit = tc.getValueAs(tc_new_unit)
|
||||
self.form.input_fd_thermal_conductivity.setText("{} {}".format(tc_with_new_unit, tc_new_unit))
|
||||
if 'ThermalExpansionCoefficient' in matmap: # linear, only for solid
|
||||
tec_new_unit = "um/m/K"
|
||||
tec = FreeCAD.Units.Quantity(matmap['ThermalExpansionCoefficient'])
|
||||
tec_with_new_unit = tec.getValueAs(tec_new_unit)
|
||||
self.form.input_fd_expansion_coefficient.setText("{} {}".format(tec_with_new_unit, tec_new_unit))
|
||||
if 'SpecificHeat' in matmap:
|
||||
sh_new_unit = "J/kg/K"
|
||||
sh = FreeCAD.Units.Quantity(matmap['SpecificHeat'])
|
||||
sh_with_new_unit = sh.getValueAs(sh_new_unit)
|
||||
self.form.input_fd_specific_heat.setText("{} {}".format(sh_with_new_unit, sh_new_unit))
|
||||
|
||||
def add_transient_material(self, material):
|
||||
material_name = self.get_material_name(material)
|
||||
self.form.cb_materials.addItem(QtGui.QIcon(":/icons/help-browser.svg"), material_name, material_name)
|
||||
self.materials[material_name] = material
|
||||
|
||||
######################## material import and export ###################
|
||||
def import_materials(self):
|
||||
self.materials = {}
|
||||
self.pathList = []
|
||||
self.form.cb_materials.clear()
|
||||
|
||||
self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General")
|
||||
if self.obj.Category == 'Fluid':
|
||||
self.import_fluid_materials()
|
||||
else:
|
||||
self.import_solid_materials()
|
||||
|
||||
def import_solid_materials(self):
|
||||
use_built_in_materials = self.fem_prefs.GetBool("UseBuiltInMaterials", True)
|
||||
if use_built_in_materials:
|
||||
system_mat_dir = FreeCAD.getResourceDir() + "/Mod/Material/StandardMaterial"
|
||||
self.add_mat_dir(system_mat_dir, ":/icons/freecad.svg")
|
||||
|
||||
use_mat_from_config_dir = self.fem_prefs.GetBool("UseMaterialsFromConfigDir", True)
|
||||
if use_mat_from_config_dir:
|
||||
user_mat_dirname = FreeCAD.getUserAppDataDir() + "Materials"
|
||||
self.add_mat_dir(user_mat_dirname, ":/icons/preferences-general.svg")
|
||||
|
||||
use_mat_from_custom_dir = self.fem_prefs.GetBool("UseMaterialsFromCustomDir", True)
|
||||
if use_mat_from_custom_dir:
|
||||
custom_mat_dir = self.fem_prefs.GetString("CustomMaterialsDir", "")
|
||||
self.add_mat_dir(custom_mat_dir, ":/icons/user.svg")
|
||||
|
||||
def import_fluid_materials(self):
|
||||
#use_built_in_materials = self.fem_prefs.GetBool("UseBuiltInMaterials", True)
|
||||
#if use_built_in_materials:
|
||||
system_mat_dir = FreeCAD.getResourceDir() + "/Mod/Material/FluidMaterial"
|
||||
self.add_mat_dir(system_mat_dir, ":/icons/freecad.svg")
|
||||
|
||||
use_mat_from_config_dir = self.fem_prefs.GetBool("UseMaterialsFromConfigDir", True)
|
||||
if use_mat_from_config_dir:
|
||||
user_mat_dirname = FreeCAD.getUserAppDataDir() + "FluidMaterial"
|
||||
self.add_mat_dir(user_mat_dirname, ":/icons/preferences-general.svg")
|
||||
|
||||
use_mat_from_custom_dir = self.fem_prefs.GetBool("UseMaterialsFromCustomDir", True)
|
||||
if use_mat_from_custom_dir:
|
||||
custom_mat_dir = self.fem_prefs.GetString("CustomMaterialsDir", "")
|
||||
self.add_mat_dir(custom_mat_dir, ":/icons/user.svg")
|
||||
|
||||
def add_mat_dir(self, mat_dir, icon):
|
||||
import glob
|
||||
import os
|
||||
import Material
|
||||
mat_file_extension = ".FCMat"
|
||||
ext_len = len(mat_file_extension)
|
||||
dir_path_list = glob.glob(mat_dir + '/*' + mat_file_extension)
|
||||
self.pathList = self.pathList + dir_path_list
|
||||
material_name_list = []
|
||||
for a_path in dir_path_list:
|
||||
material_name = os.path.basename(a_path[:-ext_len])
|
||||
self.materials[a_path] = Material.importFCMat(a_path)
|
||||
material_name_list.append([material_name, a_path])
|
||||
material_name_list.sort()
|
||||
for mat in material_name_list:
|
||||
self.form.cb_materials.addItem(QtGui.QIcon(icon), mat[0], mat[1])
|
||||
|
||||
def export_FCMat(self, fileName, matDict):
|
||||
"""
|
||||
Write a material dictionary to a FCMat file, a version without group support, with Python3
|
||||
<https://github.com/FreeCAD/FreeCAD/blob/master/src/Mod/Material/Material.py>
|
||||
"""
|
||||
try:
|
||||
import ConfigParser as configparser
|
||||
except:
|
||||
import configparser # Python 3
|
||||
# himport string
|
||||
Config = configparser.ConfigParser()
|
||||
Config.optionxform = str # disable conversion all uppercase leter in key into lower case
|
||||
|
||||
# ignore creating group, just fill all into group 'FCMat'
|
||||
grp = 'FCMat'
|
||||
if not Config.has_section(grp):
|
||||
Config.add_section(grp)
|
||||
for x in matDict.keys():
|
||||
Config.set(grp, x, matDict[x])
|
||||
|
||||
Preamble = "# This is a FreeCAD material-card file\n\n"
|
||||
# Writing our configuration file to 'example.cfg'
|
||||
with open(fileName, 'wb') as configfile:
|
||||
configfile.write(Preamble)
|
||||
Config.write(configfile)
|
||||
|
||||
def export_material(self):
|
||||
import os
|
||||
if self.obj.Category == 'Fluid':
|
||||
MaterialDir = 'FluidMaterial'
|
||||
else:
|
||||
MaterialDir = 'Material'
|
||||
_UseMaterialsFromCustomDir = self.fem_prefs.GetBool("UseMaterialsFromCustomDir", True)
|
||||
_dir = self.fem_prefs.GetString("CustomMaterialsDir", "")
|
||||
if _UseMaterialsFromCustomDir and _dir != "" and os.path.isdir(_dir):
|
||||
TargetDir = self.fem_prefs.GetString("CustomMaterialsDir", "")
|
||||
elif self.fem_prefs.GetBool("UseMaterialsFromConfigDir", True):
|
||||
TargetDir = FreeCAD.getUserAppDataDir() + os.path.sep + MaterialDir # $HOME/.FreeCAD
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage("Customed material saving directory is not setup in Fem preference")
|
||||
if not os.path.exists(TargetDir):
|
||||
os.mkdir(TargetDir)
|
||||
|
||||
saveName, Filter = QFileDialog.getSaveFileName(None, "Save a Material property file", TargetDir, "*.FCMat")
|
||||
if not saveName == "":
|
||||
print(saveName)
|
||||
knownMaterials = [self.form.cb_materials.itemText(i) for i in range(self.form.cb_materials.count())]
|
||||
material_name = os.path.basename(saveName[:-len('.FCMat')])
|
||||
if material_name not in knownMaterials:
|
||||
self.export_FCMat(saveName, self.obj.Material)
|
||||
FreeCAD.Console.PrintMessage("Sucessfully save the Material property file: " + saveName + "\n")
|
||||
else:
|
||||
self.export_FCMat(saveName, self.obj.Material)
|
||||
FreeCAD.Console.PrintMessage("Sucessfully overwritren the Material property file: " + saveName + "\n")
|
||||
"""
|
||||
msgBox = QMessageBox()
|
||||
msgBox.setText("FcMat file name {} has existed in {} or system folder, overwriting?\n".format(saveName, TargetDir))
|
||||
msgBox.addButton(QMessageBox.Yes)
|
||||
msgBox.addButton(QMessageBox.No)
|
||||
msgBox.setDefaultButton(QMessageBox.No)
|
||||
ret = msgBox.exec_()
|
||||
if ret == QMessageBox.Yes:
|
||||
self.export_FCMat(saveName, self.obj.Material)
|
||||
FreeCAD.Console.PrintMessage("Sucessfully overwritren the Material property file: "+ saveName + "\n")
|
||||
"""
|
||||
|
||||
###################geometry reference selection #################
|
||||
def references_list_right_clicked(self, QPos):
|
||||
self.form.contextMenu = QtGui.QMenu()
|
||||
menu_item = self.form.contextMenu.addAction("Remove Reference")
|
||||
if not self.references:
|
||||
menu_item.setDisabled(True)
|
||||
self.form.connect(menu_item, QtCore.SIGNAL("triggered()"), self.remove_reference)
|
||||
parentPosition = self.form.list_References.mapToGlobal(QtCore.QPoint(0, 0))
|
||||
self.form.contextMenu.move(parentPosition + QPos)
|
||||
self.form.contextMenu.show()
|
||||
|
||||
def remove_reference(self):
|
||||
if not self.references:
|
||||
return
|
||||
currentItemName = str(self.form.list_References.currentItem().text())
|
||||
for ref in self.references:
|
||||
if ref[1]:
|
||||
refname_to_compare_listentry = ref[0].Name + ':' + ref[1]
|
||||
else:
|
||||
refname_to_compare_listentry = ref[0].Name
|
||||
if refname_to_compare_listentry == currentItemName:
|
||||
self.references.remove(ref)
|
||||
self.rebuild_list_References()
|
||||
|
||||
def add_references(self):
|
||||
'''Called if Button add_reference is triggered'''
|
||||
# in constraints EditTaskPanel the selection is active as soon as the taskpanel is open
|
||||
# here the addReference button EditTaskPanel has to be triggered to start selection mode
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
# start SelectionObserver and parse the function to add the References to the widget
|
||||
if self.selection_mode_solid: # print message on button click
|
||||
print_message = self.selection_mode_solid_print_message
|
||||
else:
|
||||
print_message = self.selection_mode_std_print_message
|
||||
import FemSelectionObserver
|
||||
self.sel_server = FemSelectionObserver.FemSelectionObserver(self.selectionParser, print_message)
|
||||
|
||||
def selectionParser(self, selection):
|
||||
print('selection: ', selection[0].Shape.ShapeType, ' --> ', selection[0].Name, ' --> ', selection[1])
|
||||
if hasattr(selection[0], "Shape") and selection[1]:
|
||||
elt = selection[0].Shape.getElement(selection[1])
|
||||
if self.selection_mode_solid:
|
||||
# in solid selection mode use edges and faces for selection of a solid
|
||||
solid_to_add = None
|
||||
if elt.ShapeType == 'Edge':
|
||||
found_edge = False
|
||||
for i, s in enumerate(selection[0].Shape.Solids):
|
||||
for e in s.Edges:
|
||||
if elt.isSame(e):
|
||||
if not found_edge:
|
||||
solid_to_add = str(i + 1)
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage('Edge belongs to more than one solid\n')
|
||||
solid_to_add = None
|
||||
found_edge = True
|
||||
elif elt.ShapeType == 'Face':
|
||||
found_face = False
|
||||
for i, s in enumerate(selection[0].Shape.Solids):
|
||||
for e in s.Faces:
|
||||
if elt.isSame(e):
|
||||
if not found_face:
|
||||
solid_to_add = str(i + 1)
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage('Face belongs to more than one solid\n')
|
||||
solid_to_add = None
|
||||
found_edge = True
|
||||
if solid_to_add:
|
||||
selection = (selection[0], 'Solid' + solid_to_add)
|
||||
print('selection element changed to Solid: ', selection[0].Shape.ShapeType, ' ', selection[0].Name, ' ', selection[1])
|
||||
else:
|
||||
return
|
||||
if selection not in self.references:
|
||||
self.references.append(selection)
|
||||
self.rebuild_list_References()
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage(selection[0].Name + ' --> ' + selection[1] + ' is in reference list already!\n')
|
||||
|
||||
def rebuild_list_References(self):
|
||||
self.form.list_References.clear()
|
||||
items = []
|
||||
for ref in self.references:
|
||||
if ref[1]:
|
||||
item_name = ref[0].Name + ':' + ref[1]
|
||||
else:
|
||||
item_name = ref[0].Name
|
||||
items.append(item_name)
|
||||
for listItemName in sorted(items):
|
||||
self.form.list_References.addItem(listItemName)
|
||||
176
src/Mod/Fem/PyGui/_TaskPanelFemMeshGmsh.py
Normal file
176
src/Mod/Fem/PyGui/_TaskPanelFemMeshGmsh.py
Normal file
@@ -0,0 +1,176 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_TaskPanelFemMeshGmsh"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package TaskPanelFemMeshGmsh
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import time
|
||||
import _FemMeshGmsh
|
||||
import FreeCADGui
|
||||
from PySide import QtGui
|
||||
from PySide import QtCore
|
||||
from PySide.QtCore import Qt
|
||||
from PySide.QtGui import QApplication
|
||||
|
||||
|
||||
class _TaskPanelFemMeshGmsh:
|
||||
'''The TaskPanel for editing References property of FemMeshGmsh objects and creation of new FEM mesh'''
|
||||
def __init__(self, obj):
|
||||
self.mesh_obj = obj
|
||||
self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/TaskPanelFemMeshGmsh.ui")
|
||||
|
||||
self.Timer = QtCore.QTimer()
|
||||
self.Timer.start(100) # 100 milli seconds
|
||||
self.gmsh_runs = False
|
||||
self.console_message_gmsh = ''
|
||||
|
||||
QtCore.QObject.connect(self.form.if_max, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.max_changed)
|
||||
QtCore.QObject.connect(self.form.if_min, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.min_changed)
|
||||
QtCore.QObject.connect(self.form.cb_dimension, QtCore.SIGNAL("activated(int)"), self.choose_dimension)
|
||||
QtCore.QObject.connect(self.Timer, QtCore.SIGNAL("timeout()"), self.update_timer_text)
|
||||
|
||||
self.form.cb_dimension.addItems(_FemMeshGmsh._FemMeshGmsh.known_element_dimensions)
|
||||
|
||||
self.get_mesh_params()
|
||||
self.get_active_analysis()
|
||||
self.update()
|
||||
|
||||
def getStandardButtons(self):
|
||||
return int(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Apply | QtGui.QDialogButtonBox.Cancel)
|
||||
# show a OK, a apply and a Cancel button
|
||||
# def reject() is called on Cancel button
|
||||
# def clicked(self, button) is needed, to access the apply button
|
||||
|
||||
def accept(self):
|
||||
self.set_mesh_params()
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return True
|
||||
|
||||
def reject(self):
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return True
|
||||
|
||||
def clicked(self, button):
|
||||
if button == QtGui.QDialogButtonBox.Apply:
|
||||
self.set_mesh_params()
|
||||
self.run_gmsh()
|
||||
|
||||
def get_mesh_params(self):
|
||||
self.clmax = self.mesh_obj.CharacteristicLengthMax
|
||||
self.clmin = self.mesh_obj.CharacteristicLengthMin
|
||||
self.dimension = self.mesh_obj.ElementDimension
|
||||
|
||||
def set_mesh_params(self):
|
||||
self.mesh_obj.CharacteristicLengthMax = self.clmax
|
||||
self.mesh_obj.CharacteristicLengthMin = self.clmin
|
||||
self.mesh_obj.ElementDimension = self.dimension
|
||||
|
||||
def update(self):
|
||||
'fills the widgets'
|
||||
self.form.if_max.setText(self.clmax.UserString)
|
||||
self.form.if_min.setText(self.clmin.UserString)
|
||||
index_dimension = self.form.cb_dimension.findText(self.dimension)
|
||||
self.form.cb_dimension.setCurrentIndex(index_dimension)
|
||||
|
||||
def console_log(self, message="", color="#000000"):
|
||||
self.console_message_gmsh = self.console_message_gmsh + '<font color="#0000FF">{0:4.1f}:</font> <font color="{1}">{2}</font><br>'.\
|
||||
format(time.time() - self.Start, color, message.encode('utf-8', 'replace'))
|
||||
self.form.te_output.setText(self.console_message_gmsh)
|
||||
self.form.te_output.moveCursor(QtGui.QTextCursor.End)
|
||||
|
||||
def update_timer_text(self):
|
||||
# print('timer1')
|
||||
if self.gmsh_runs:
|
||||
print('timer2')
|
||||
# print('Time: {0:4.1f}: '.format(time.time() - self.Start))
|
||||
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
|
||||
|
||||
def max_changed(self, base_quantity_value):
|
||||
self.clmax = base_quantity_value
|
||||
|
||||
def min_changed(self, base_quantity_value):
|
||||
self.clmin = base_quantity_value
|
||||
|
||||
def choose_dimension(self, index):
|
||||
if index < 0:
|
||||
return
|
||||
self.form.cb_dimension.setCurrentIndex(index)
|
||||
self.dimension = str(self.form.cb_dimension.itemText(index)) # form returns unicode
|
||||
|
||||
def run_gmsh(self):
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
partsh = self.obj.Part
|
||||
if partsh.Shape.ShapeType == "Compound":
|
||||
error_message = "The mesh to shape is a Compound, GMSH could return unexpected meshes for Compounds. It is strongly recommended to extract the shape to mesh from the Compound and use this one."
|
||||
FreeCAD.Console.PrintError(error_message + "\n")
|
||||
if hasattr(partsh, "Proxy") and (partsh.Proxy.Type == "FeatureBooleanFragments" or partsh.Proxy.Type == "FeatureSlice" or partsh.Proxy.Type == "FeatureXOR"): # other part obj might not have a Proxy
|
||||
error_message = "The mesh to shape is a boolean split tools Compound, GMSH could return unexpected meshes for a boolean split tools Compound. It is strongly recommended to extract the shape to mesh from the Compound and use this one."
|
||||
FreeCAD.Console.PrintError(error_message + "\n")
|
||||
QtGui.QMessageBox.critical(None, "Shape to mesh is a Compound", error_message)
|
||||
self.Start = time.time()
|
||||
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
|
||||
self.console_message_gmsh = ''
|
||||
self.gmsh_runs = True
|
||||
self.console_log("We gone start ...")
|
||||
self.get_active_analysis()
|
||||
import FemGmshTools
|
||||
gmsh_mesh = FemGmshTools.FemGmshTools(self.obj, self.analysis)
|
||||
self.console_log("Start GMSH ...")
|
||||
error = ''
|
||||
try:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except:
|
||||
import sys
|
||||
print("Unexpected error when creating mesh: ", sys.exc_info()[0])
|
||||
if error:
|
||||
print(error)
|
||||
self.console_log('GMSH had warnings ...')
|
||||
self.console_log(error, '#FF0000')
|
||||
else:
|
||||
self.console_log('Clean run of GMSH')
|
||||
self.console_log("GMSH done!")
|
||||
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
|
||||
self.Timer.stop()
|
||||
self.update()
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
||||
def get_active_analysis(self):
|
||||
import FemGui
|
||||
self.analysis = FemGui.getActiveAnalysis()
|
||||
if self.analysis:
|
||||
for m in FemGui.getActiveAnalysis().Member:
|
||||
if m.Name == self.mesh_obj.Name:
|
||||
print('Active analysis found: ' + self.analysis.Name)
|
||||
return
|
||||
else:
|
||||
# print('Mesh is not member of active analysis, means no group meshing')
|
||||
self.analysis = None # no group meshing
|
||||
else:
|
||||
# print('No active analyis, means no group meshing')
|
||||
self.analysis = None # no group meshing
|
||||
190
src/Mod/Fem/PyGui/_TaskPanelFemMeshGroup.py
Normal file
190
src/Mod/Fem/PyGui/_TaskPanelFemMeshGroup.py
Normal file
@@ -0,0 +1,190 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_TaskPanelFemMeshGroup"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package TaskPanelFemMeshGroup
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from PySide import QtGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _TaskPanelFemMeshGroup:
|
||||
'''The TaskPanel for editing References property of FemMeshGroup objects'''
|
||||
def __init__(self, obj):
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
self.sel_server = None
|
||||
self.obj = obj
|
||||
self.selection_mode_solid = False
|
||||
self.selection_mode_std_print_message = "Select Faces, Edges and Vertices by single click on them to add them to the list."
|
||||
self.selection_mode_solid_print_message = "Select Solids by single click on a Face or Edge which belongs to the Solid, to add the Solid to the list."
|
||||
|
||||
self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/TaskPanelFemMeshGroup.ui")
|
||||
QtCore.QObject.connect(self.form.rb_name, QtCore.SIGNAL("toggled(bool)"), self.choose_exportidentifier_name)
|
||||
QtCore.QObject.connect(self.form.rb_label, QtCore.SIGNAL("toggled(bool)"), self.choose_exportidentifier_label)
|
||||
QtCore.QObject.connect(self.form.rb_standard, QtCore.SIGNAL("toggled(bool)"), self.choose_selection_mode_standard)
|
||||
QtCore.QObject.connect(self.form.rb_solid, QtCore.SIGNAL("toggled(bool)"), self.choose_selection_mode_solid)
|
||||
QtCore.QObject.connect(self.form.pushButton_Reference, QtCore.SIGNAL("clicked()"), self.add_references)
|
||||
self.form.list_References.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||
self.form.list_References.connect(self.form.list_References, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.references_list_right_clicked)
|
||||
|
||||
self.get_meshgroup_props()
|
||||
self.update()
|
||||
|
||||
def accept(self):
|
||||
self.set_meshgroup_props()
|
||||
if self.sel_server:
|
||||
FreeCADGui.Selection.removeObserver(self.sel_server)
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return True
|
||||
|
||||
def reject(self):
|
||||
if self.sel_server:
|
||||
FreeCADGui.Selection.removeObserver(self.sel_server)
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
return True
|
||||
|
||||
def get_meshgroup_props(self):
|
||||
self.use_label = self.obj.UseLabel
|
||||
self.references = []
|
||||
if self.obj.References:
|
||||
self.tuplereferences = self.obj.References
|
||||
self.get_references()
|
||||
|
||||
def set_meshgroup_props(self):
|
||||
self.obj.References = self.references
|
||||
self.obj.UseLabel = self.use_label
|
||||
|
||||
def update(self):
|
||||
'fills the widgets'
|
||||
self.form.rb_name.setChecked(not self.use_label)
|
||||
self.form.rb_label.setChecked(self.use_label)
|
||||
self.rebuild_list_References()
|
||||
|
||||
def choose_exportidentifier_name(self, state):
|
||||
self.use_label = not state
|
||||
|
||||
def choose_exportidentifier_label(self, state):
|
||||
self.use_label = state
|
||||
|
||||
def choose_selection_mode_standard(self, state):
|
||||
self.selection_mode_solid = not state
|
||||
if self.sel_server and not self.selection_mode_solid:
|
||||
print(self.selection_mode_std_print_message)
|
||||
|
||||
def choose_selection_mode_solid(self, state):
|
||||
self.selection_mode_solid = state
|
||||
if self.sel_server and self.selection_mode_solid:
|
||||
print(self.selection_mode_solid_print_message)
|
||||
|
||||
def get_references(self):
|
||||
for ref in self.tuplereferences:
|
||||
for elem in ref[1]:
|
||||
self.references.append((ref[0], elem))
|
||||
|
||||
def references_list_right_clicked(self, QPos):
|
||||
self.form.contextMenu = QtGui.QMenu()
|
||||
menu_item = self.form.contextMenu.addAction("Remove Reference")
|
||||
if not self.references:
|
||||
menu_item.setDisabled(True)
|
||||
self.form.connect(menu_item, QtCore.SIGNAL("triggered()"), self.remove_reference)
|
||||
parentPosition = self.form.list_References.mapToGlobal(QtCore.QPoint(0, 0))
|
||||
self.form.contextMenu.move(parentPosition + QPos)
|
||||
self.form.contextMenu.show()
|
||||
|
||||
def remove_reference(self):
|
||||
if not self.references:
|
||||
return
|
||||
currentItemName = str(self.form.list_References.currentItem().text())
|
||||
for ref in self.references:
|
||||
refname_to_compare_listentry = ref[0].Name + ':' + ref[1]
|
||||
if refname_to_compare_listentry == currentItemName:
|
||||
self.references.remove(ref)
|
||||
self.rebuild_list_References()
|
||||
|
||||
def add_references(self):
|
||||
'''Called if Button add_reference is triggered'''
|
||||
# in constraints EditTaskPanel the selection is active as soon as the taskpanel is open
|
||||
# here the addReference button EditTaskPanel has to be triggered to start selection mode
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
# start SelectionObserver and parse the function to add the References to the widget
|
||||
if self.selection_mode_solid: # print message on button click
|
||||
print_message = self.selection_mode_solid_print_message
|
||||
else:
|
||||
print_message = self.selection_mode_std_print_message
|
||||
import FemSelectionObserver
|
||||
self.sel_server = FemSelectionObserver.FemSelectionObserver(self.selectionParser, print_message)
|
||||
|
||||
def selectionParser(self, selection):
|
||||
print('selection: ', selection[0].Shape.ShapeType, ' ', selection[0].Name, ' ', selection[1])
|
||||
if hasattr(selection[0], "Shape") and selection[1]:
|
||||
elt = selection[0].Shape.getElement(selection[1])
|
||||
if self.selection_mode_solid:
|
||||
# in solid selection mode use edges and faces for selection of a solid
|
||||
solid_to_add = None
|
||||
if elt.ShapeType == 'Edge':
|
||||
found_edge = False
|
||||
for i, s in enumerate(selection[0].Shape.Solids):
|
||||
for e in s.Edges:
|
||||
if elt.isSame(e):
|
||||
if not found_edge:
|
||||
solid_to_add = str(i + 1)
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage('Edge belongs to more than one solid\n')
|
||||
solid_to_add = None
|
||||
found_edge = True
|
||||
elif elt.ShapeType == 'Face':
|
||||
found_face = False
|
||||
for i, s in enumerate(selection[0].Shape.Solids):
|
||||
for e in s.Faces:
|
||||
if elt.isSame(e):
|
||||
if not found_face:
|
||||
solid_to_add = str(i + 1)
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage('Face belongs to more than one solid\n')
|
||||
solid_to_add = None
|
||||
found_edge = True
|
||||
if solid_to_add:
|
||||
selection = (selection[0], 'Solid' + solid_to_add)
|
||||
print('selection element changed to Solid: ', selection[0].Shape.ShapeType, ' ', selection[0].Name, ' ', selection[1])
|
||||
else:
|
||||
return
|
||||
if selection not in self.references:
|
||||
self.references.append(selection)
|
||||
self.rebuild_list_References()
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage(selection[0].Name + ' --> ' + selection[1] + ' is in reference list already!\n')
|
||||
|
||||
def rebuild_list_References(self):
|
||||
self.form.list_References.clear()
|
||||
items = []
|
||||
for ref in self.references:
|
||||
item_name = ref[0].Name + ':' + ref[1]
|
||||
items.append(item_name)
|
||||
for listItemName in sorted(items):
|
||||
self.form.list_References.addItem(listItemName)
|
||||
185
src/Mod/Fem/PyGui/_TaskPanelFemMeshRegion.py
Normal file
185
src/Mod/Fem/PyGui/_TaskPanelFemMeshRegion.py
Normal file
@@ -0,0 +1,185 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_TaskPanelFemMeshRegion"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package TaskPanelFemMeshRegion
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from PySide import QtGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _TaskPanelFemMeshRegion:
|
||||
'''The TaskPanel for editing References property of FemMeshRegion objects'''
|
||||
def __init__(self, obj):
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
self.sel_server = None
|
||||
self.obj = obj
|
||||
self.selection_mode_solid = False
|
||||
self.selection_mode_std_print_message = "Select Faces, Edges and Vertices by single click on them to add them to the list."
|
||||
self.selection_mode_solid_print_message = "Select Solids by single click on a Face or Edge which belongs to the Solid, to add the Solid to the list."
|
||||
|
||||
self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/TaskPanelFemMeshRegion.ui")
|
||||
QtCore.QObject.connect(self.form.if_elelen, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.elelen_changed)
|
||||
QtCore.QObject.connect(self.form.rb_standard, QtCore.SIGNAL("toggled(bool)"), self.choose_selection_mode_standard)
|
||||
QtCore.QObject.connect(self.form.rb_solid, QtCore.SIGNAL("toggled(bool)"), self.choose_selection_mode_solid)
|
||||
QtCore.QObject.connect(self.form.pushButton_Reference, QtCore.SIGNAL("clicked()"), self.add_references)
|
||||
self.form.list_References.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||
self.form.list_References.connect(self.form.list_References, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.references_list_right_clicked)
|
||||
|
||||
self.get_meshregion_props()
|
||||
self.update()
|
||||
|
||||
def accept(self):
|
||||
self.set_meshregion_props()
|
||||
if self.sel_server:
|
||||
FreeCADGui.Selection.removeObserver(self.sel_server)
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return True
|
||||
|
||||
def reject(self):
|
||||
if self.sel_server:
|
||||
FreeCADGui.Selection.removeObserver(self.sel_server)
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
return True
|
||||
|
||||
def get_meshregion_props(self):
|
||||
self.elelen = self.obj.CharacteristicLength
|
||||
self.references = []
|
||||
if self.obj.References:
|
||||
self.tuplereferences = self.obj.References
|
||||
self.get_references()
|
||||
|
||||
def set_meshregion_props(self):
|
||||
self.obj.References = self.references
|
||||
self.obj.CharacteristicLength = self.elelen
|
||||
|
||||
def update(self):
|
||||
'fills the widgets'
|
||||
self.form.if_elelen.setText(self.elelen.UserString)
|
||||
self.rebuild_list_References()
|
||||
|
||||
def elelen_changed(self, base_quantity_value):
|
||||
self.elelen = base_quantity_value
|
||||
|
||||
def choose_selection_mode_standard(self, state):
|
||||
self.selection_mode_solid = not state
|
||||
if self.sel_server and not self.selection_mode_solid:
|
||||
print(self.selection_mode_std_print_message)
|
||||
|
||||
def choose_selection_mode_solid(self, state):
|
||||
self.selection_mode_solid = state
|
||||
if self.sel_server and self.selection_mode_solid:
|
||||
print(self.selection_mode_solid_print_message)
|
||||
|
||||
def get_references(self):
|
||||
for ref in self.tuplereferences:
|
||||
for elem in ref[1]:
|
||||
self.references.append((ref[0], elem))
|
||||
|
||||
def references_list_right_clicked(self, QPos):
|
||||
self.form.contextMenu = QtGui.QMenu()
|
||||
menu_item = self.form.contextMenu.addAction("Remove Reference")
|
||||
if not self.references:
|
||||
menu_item.setDisabled(True)
|
||||
self.form.connect(menu_item, QtCore.SIGNAL("triggered()"), self.remove_reference)
|
||||
parentPosition = self.form.list_References.mapToGlobal(QtCore.QPoint(0, 0))
|
||||
self.form.contextMenu.move(parentPosition + QPos)
|
||||
self.form.contextMenu.show()
|
||||
|
||||
def remove_reference(self):
|
||||
if not self.references:
|
||||
return
|
||||
currentItemName = str(self.form.list_References.currentItem().text())
|
||||
for ref in self.references:
|
||||
refname_to_compare_listentry = ref[0].Name + ':' + ref[1]
|
||||
if refname_to_compare_listentry == currentItemName:
|
||||
self.references.remove(ref)
|
||||
self.rebuild_list_References()
|
||||
|
||||
def add_references(self):
|
||||
'''Called if Button add_reference is triggered'''
|
||||
# in constraints EditTaskPanel the selection is active as soon as the taskpanel is open
|
||||
# here the addReference button EditTaskPanel has to be triggered to start selection mode
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
# start SelectionObserver and parse the function to add the References to the widget
|
||||
if self.selection_mode_solid: # print message on button click
|
||||
print_message = self.selection_mode_solid_print_message
|
||||
else:
|
||||
print_message = self.selection_mode_std_print_message
|
||||
import FemSelectionObserver
|
||||
self.sel_server = FemSelectionObserver.FemSelectionObserver(self.selectionParser, print_message)
|
||||
|
||||
def selectionParser(self, selection):
|
||||
print('selection: ', selection[0].Shape.ShapeType, ' ', selection[0].Name, ' ', selection[1])
|
||||
if hasattr(selection[0], "Shape") and selection[1]:
|
||||
elt = selection[0].Shape.getElement(selection[1])
|
||||
if self.selection_mode_solid:
|
||||
# in solid selection mode use edges and faces for selection of a solid
|
||||
solid_to_add = None
|
||||
if elt.ShapeType == 'Edge':
|
||||
found_edge = False
|
||||
for i, s in enumerate(selection[0].Shape.Solids):
|
||||
for e in s.Edges:
|
||||
if elt.isSame(e):
|
||||
if not found_edge:
|
||||
solid_to_add = str(i + 1)
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage('Edge belongs to more than one solid\n')
|
||||
solid_to_add = None
|
||||
found_edge = True
|
||||
elif elt.ShapeType == 'Face':
|
||||
found_face = False
|
||||
for i, s in enumerate(selection[0].Shape.Solids):
|
||||
for e in s.Faces:
|
||||
if elt.isSame(e):
|
||||
if not found_face:
|
||||
solid_to_add = str(i + 1)
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage('Face belongs to more than one solid\n')
|
||||
solid_to_add = None
|
||||
found_edge = True
|
||||
if solid_to_add:
|
||||
selection = (selection[0], 'Solid' + solid_to_add)
|
||||
print('selection element changed to Solid: ', selection[0].Shape.ShapeType, ' ', selection[0].Name, ' ', selection[1])
|
||||
else:
|
||||
return
|
||||
if selection not in self.references:
|
||||
self.references.append(selection)
|
||||
self.rebuild_list_References()
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage(selection[0].Name + ' --> ' + selection[1] + ' is in reference list already!\n')
|
||||
|
||||
def rebuild_list_References(self):
|
||||
self.form.list_References.clear()
|
||||
items = []
|
||||
for ref in self.references:
|
||||
item_name = ref[0].Name + ':' + ref[1]
|
||||
items.append(item_name)
|
||||
for listItemName in sorted(items):
|
||||
self.form.list_References.addItem(listItemName)
|
||||
139
src/Mod/Fem/PyGui/_TaskPanelFemShellThickness.py
Normal file
139
src/Mod/Fem/PyGui/_TaskPanelFemShellThickness.py
Normal file
@@ -0,0 +1,139 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2015 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_TaskPanelFemShellThickness"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package TaskPanelFemShellThickness
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from PySide import QtGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _TaskPanelFemShellThickness:
|
||||
'''The TaskPanel for editing References property of FemShellThickness objects'''
|
||||
def __init__(self, obj):
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
self.sel_server = None
|
||||
self.obj = obj
|
||||
|
||||
self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/TaskPanelFemShellThickness.ui")
|
||||
QtCore.QObject.connect(self.form.if_thickness, QtCore.SIGNAL("valueChanged(Base::Quantity)"), self.thickness_changed)
|
||||
QtCore.QObject.connect(self.form.pushButton_Reference, QtCore.SIGNAL("clicked()"), self.add_references)
|
||||
self.form.list_References.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||
self.form.list_References.connect(self.form.list_References, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.references_list_right_clicked)
|
||||
|
||||
self.get_shellthickness_props()
|
||||
self.update()
|
||||
|
||||
def accept(self):
|
||||
self.set_shellthickness_props()
|
||||
if self.sel_server:
|
||||
FreeCADGui.Selection.removeObserver(self.sel_server)
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
return True
|
||||
|
||||
def reject(self):
|
||||
if self.sel_server:
|
||||
FreeCADGui.Selection.removeObserver(self.sel_server)
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
return True
|
||||
|
||||
def get_shellthickness_props(self):
|
||||
self.thickness = self.obj.Thickness
|
||||
self.references = []
|
||||
if self.obj.References:
|
||||
self.tuplereferences = self.obj.References
|
||||
self.get_references()
|
||||
|
||||
def set_shellthickness_props(self):
|
||||
self.obj.References = self.references
|
||||
self.obj.Thickness = self.thickness
|
||||
|
||||
def update(self):
|
||||
'fills the widgets'
|
||||
self.form.if_thickness.setText(self.thickness.UserString)
|
||||
self.rebuild_list_References()
|
||||
|
||||
def thickness_changed(self, base_quantity_value):
|
||||
self.thickness = base_quantity_value
|
||||
|
||||
def get_references(self):
|
||||
for ref in self.tuplereferences:
|
||||
for elem in ref[1]:
|
||||
self.references.append((ref[0], elem))
|
||||
|
||||
def references_list_right_clicked(self, QPos):
|
||||
self.form.contextMenu = QtGui.QMenu()
|
||||
menu_item = self.form.contextMenu.addAction("Remove Reference")
|
||||
if not self.references:
|
||||
menu_item.setDisabled(True)
|
||||
self.form.connect(menu_item, QtCore.SIGNAL("triggered()"), self.remove_reference)
|
||||
parentPosition = self.form.list_References.mapToGlobal(QtCore.QPoint(0, 0))
|
||||
self.form.contextMenu.move(parentPosition + QPos)
|
||||
self.form.contextMenu.show()
|
||||
|
||||
def remove_reference(self):
|
||||
if not self.references:
|
||||
return
|
||||
currentItemName = str(self.form.list_References.currentItem().text())
|
||||
for ref in self.references:
|
||||
refname_to_compare_listentry = ref[0].Name + ':' + ref[1]
|
||||
if refname_to_compare_listentry == currentItemName:
|
||||
self.references.remove(ref)
|
||||
self.rebuild_list_References()
|
||||
|
||||
def add_references(self):
|
||||
'''Called if Button add_reference is triggered'''
|
||||
# in constraints EditTaskPanel the selection is active as soon as the taskpanel is open
|
||||
# here the addReference button EditTaskPanel has to be triggered to start selection mode
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
# start SelectionObserver and parse the function to add the References to the widget
|
||||
print_message = "Select Faces by single click on them to add them to the list"
|
||||
import FemSelectionObserver
|
||||
self.sel_server = FemSelectionObserver.FemSelectionObserver(self.selectionParser, print_message)
|
||||
|
||||
def selectionParser(self, selection):
|
||||
# print('selection: ', selection[0].Shape.ShapeType, ' ', selection[0].Name, ' ', selection[1])
|
||||
if hasattr(selection[0], "Shape"):
|
||||
if selection[1]:
|
||||
elt = selection[0].Shape.getElement(selection[1])
|
||||
if elt.ShapeType == 'Face':
|
||||
if selection not in self.references:
|
||||
self.references.append(selection)
|
||||
self.rebuild_list_References()
|
||||
else:
|
||||
FreeCAD.Console.PrintMessage(selection[0].Name + ' --> ' + selection[1] + ' is in reference list already!\n')
|
||||
|
||||
def rebuild_list_References(self):
|
||||
self.form.list_References.clear()
|
||||
items = []
|
||||
for ref in self.references:
|
||||
item_name = ref[0].Name + ':' + ref[1]
|
||||
items.append(item_name)
|
||||
for listItemName in sorted(items):
|
||||
self.form.list_References.addItem(listItemName)
|
||||
278
src/Mod/Fem/PyGui/_TaskPanelFemSolverCalculix.py
Normal file
278
src/Mod/Fem/PyGui/_TaskPanelFemSolverCalculix.py
Normal file
@@ -0,0 +1,278 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "CalculiX Job Control Task Panel"
|
||||
__author__ = "Juergen Riegel"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package TaskPanelFemSolverCalculix
|
||||
# \ingroup FEM
|
||||
|
||||
import FemToolsCcx
|
||||
import FreeCAD
|
||||
import os
|
||||
import time
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
from PySide import QtCore, QtGui
|
||||
from PySide.QtCore import Qt
|
||||
from PySide.QtGui import QApplication
|
||||
|
||||
|
||||
class _TaskPanelFemSolverCalculix:
|
||||
def __init__(self, solver_object):
|
||||
self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/TaskPanelFemSolverCalculix.ui")
|
||||
self.ccx_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Ccx")
|
||||
ccx_binary = self.ccx_prefs.GetString("ccxBinaryPath", "")
|
||||
if ccx_binary:
|
||||
self.CalculixBinary = ccx_binary
|
||||
print ("Using CalculiX binary path from FEM preferences: {}".format(ccx_binary))
|
||||
else:
|
||||
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.solver_object = solver_object
|
||||
|
||||
self.Calculix = QtCore.QProcess()
|
||||
self.Timer = QtCore.QTimer()
|
||||
self.Timer.start(300)
|
||||
|
||||
self.fem_console_message = ''
|
||||
|
||||
# Connect Signals and Slots
|
||||
QtCore.QObject.connect(self.form.tb_choose_working_dir, QtCore.SIGNAL("clicked()"), self.choose_working_dir)
|
||||
QtCore.QObject.connect(self.form.pb_write_inp, QtCore.SIGNAL("clicked()"), self.write_input_file_handler)
|
||||
QtCore.QObject.connect(self.form.pb_edit_inp, QtCore.SIGNAL("clicked()"), self.editCalculixInputFile)
|
||||
QtCore.QObject.connect(self.form.pb_run_ccx, QtCore.SIGNAL("clicked()"), self.runCalculix)
|
||||
QtCore.QObject.connect(self.form.rb_static_analysis, QtCore.SIGNAL("clicked()"), self.select_static_analysis)
|
||||
QtCore.QObject.connect(self.form.rb_frequency_analysis, QtCore.SIGNAL("clicked()"), self.select_frequency_analysis)
|
||||
QtCore.QObject.connect(self.form.rb_thermomech_analysis, QtCore.SIGNAL("clicked()"), self.select_thermomech_analysis)
|
||||
|
||||
QtCore.QObject.connect(self.Calculix, QtCore.SIGNAL("started()"), self.calculixStarted)
|
||||
QtCore.QObject.connect(self.Calculix, QtCore.SIGNAL("stateChanged(QProcess::ProcessState)"), self.calculixStateChanged)
|
||||
QtCore.QObject.connect(self.Calculix, QtCore.SIGNAL("error(QProcess::ProcessError)"), self.calculixError)
|
||||
QtCore.QObject.connect(self.Calculix, QtCore.SIGNAL("finished(int)"), self.calculixFinished)
|
||||
|
||||
QtCore.QObject.connect(self.Timer, QtCore.SIGNAL("timeout()"), self.UpdateText)
|
||||
|
||||
self.update()
|
||||
|
||||
def getStandardButtons(self):
|
||||
# only show a close button
|
||||
# def accept() in no longer needed, since there is no OK button
|
||||
return int(QtGui.QDialogButtonBox.Close)
|
||||
|
||||
def reject(self):
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
|
||||
def update(self):
|
||||
'fills the widgets'
|
||||
self.form.le_working_dir.setText(self.solver_object.WorkingDir)
|
||||
if self.solver_object.AnalysisType == 'static':
|
||||
self.form.rb_static_analysis.setChecked(True)
|
||||
elif self.solver_object.AnalysisType == 'frequency':
|
||||
self.form.rb_frequency_analysis.setChecked(True)
|
||||
elif self.solver_object.AnalysisType == 'thermomech':
|
||||
self.form.rb_thermomech_analysis.setChecked(True)
|
||||
return
|
||||
|
||||
def femConsoleMessage(self, message="", color="#000000"):
|
||||
self.fem_console_message = self.fem_console_message + '<font color="#0000FF">{0:4.1f}:</font> <font color="{1}">{2}</font><br>'.\
|
||||
format(time.time() - self.Start, color, message.encode('utf-8', 'replace'))
|
||||
self.form.textEdit_Output.setText(self.fem_console_message)
|
||||
self.form.textEdit_Output.moveCursor(QtGui.QTextCursor.End)
|
||||
|
||||
def printCalculiXstdout(self):
|
||||
out = self.Calculix.readAllStandardOutput()
|
||||
if out.isEmpty():
|
||||
self.femConsoleMessage("CalculiX stdout is empty", "#FF0000")
|
||||
else:
|
||||
try:
|
||||
out = unicode(out, 'utf-8', 'replace')
|
||||
rx = QtCore.QRegExp("\\*ERROR.*\\n\\n")
|
||||
rx.setMinimal(True)
|
||||
pos = rx.indexIn(out)
|
||||
while not pos < 0:
|
||||
match = rx.cap(0)
|
||||
FreeCAD.Console.PrintError(match.strip().replace('\n', ' ') + '\n')
|
||||
pos = rx.indexIn(out, pos + 1)
|
||||
out = os.linesep.join([s for s in out.splitlines() if s])
|
||||
self.femConsoleMessage(out.replace('\n', '<br>'))
|
||||
except UnicodeDecodeError:
|
||||
self.femConsoleMessage("Error converting stdout from CalculiX", "#FF0000")
|
||||
|
||||
def UpdateText(self):
|
||||
if(self.Calculix.state() == QtCore.QProcess.ProcessState.Running):
|
||||
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
|
||||
|
||||
def calculixError(self, error):
|
||||
print ("Error() {}".format(error))
|
||||
self.femConsoleMessage("CalculiX execute error: {}".format(error), "#FF0000")
|
||||
|
||||
def calculixStarted(self):
|
||||
print ("calculixStarted()")
|
||||
print (self.Calculix.state())
|
||||
self.form.pb_run_ccx.setText("Break CalculiX")
|
||||
|
||||
def calculixStateChanged(self, newState):
|
||||
if (newState == QtCore.QProcess.ProcessState.Starting):
|
||||
self.femConsoleMessage("Starting CalculiX...")
|
||||
if (newState == QtCore.QProcess.ProcessState.Running):
|
||||
self.femConsoleMessage("CalculiX is running...")
|
||||
if (newState == QtCore.QProcess.ProcessState.NotRunning):
|
||||
self.femConsoleMessage("CalculiX stopped.")
|
||||
|
||||
def calculixFinished(self, exitCode):
|
||||
print ("calculixFinished() {}".format(exitCode))
|
||||
print (self.Calculix.state())
|
||||
|
||||
# Restore previous cwd
|
||||
QtCore.QDir.setCurrent(self.cwd)
|
||||
|
||||
self.printCalculiXstdout()
|
||||
self.Timer.stop()
|
||||
|
||||
self.femConsoleMessage("CalculiX done!", "#00AA00")
|
||||
|
||||
self.form.pb_run_ccx.setText("Re-run CalculiX")
|
||||
self.femConsoleMessage("Loading result sets...")
|
||||
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
|
||||
fea = FemToolsCcx.FemToolsCcx(None, self.solver_object)
|
||||
fea.reset_mesh_purge_results_checked()
|
||||
fea.inp_file_name = self.inp_file_name
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
fea.load_results()
|
||||
QApplication.restoreOverrideCursor()
|
||||
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
|
||||
|
||||
def choose_working_dir(self):
|
||||
current_wd = self.setup_working_dir()
|
||||
wd = QtGui.QFileDialog.getExistingDirectory(None, 'Choose CalculiX working directory',
|
||||
current_wd)
|
||||
if wd:
|
||||
self.solver_object.WorkingDir = wd
|
||||
else:
|
||||
self.solver_object.WorkingDir = current_wd
|
||||
self.form.le_working_dir.setText(self.solver_object.WorkingDir)
|
||||
|
||||
def write_input_file_handler(self):
|
||||
self.Start = time.time()
|
||||
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
|
||||
QApplication.restoreOverrideCursor()
|
||||
if self.check_prerequisites_helper():
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
self.inp_file_name = ""
|
||||
fea = FemToolsCcx.FemToolsCcx(None, self.solver_object)
|
||||
fea.set_analysis_type(self.solver_object.AnalysisType)
|
||||
fea.update_objects()
|
||||
fea.write_inp_file()
|
||||
if fea.inp_file_name != "":
|
||||
self.inp_file_name = fea.inp_file_name
|
||||
self.femConsoleMessage("Write completed.")
|
||||
self.form.pb_edit_inp.setEnabled(True)
|
||||
self.form.pb_run_ccx.setEnabled(True)
|
||||
else:
|
||||
self.femConsoleMessage("Write .inp file failed!", "#FF0000")
|
||||
QApplication.restoreOverrideCursor()
|
||||
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
|
||||
|
||||
def check_prerequisites_helper(self):
|
||||
self.Start = time.time()
|
||||
self.femConsoleMessage("Check dependencies...")
|
||||
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
|
||||
|
||||
fea = FemToolsCcx.FemToolsCcx(None, self.solver_object)
|
||||
fea.update_objects()
|
||||
message = fea.check_prerequisites()
|
||||
if message != "":
|
||||
QtGui.QMessageBox.critical(None, "Missing prerequisit(s)", message)
|
||||
return False
|
||||
return True
|
||||
|
||||
def start_ext_editor(self, ext_editor_path, filename):
|
||||
if not hasattr(self, "ext_editor_process"):
|
||||
self.ext_editor_process = QtCore.QProcess()
|
||||
if self.ext_editor_process.state() != QtCore.QProcess.Running:
|
||||
self.ext_editor_process.start(ext_editor_path, [filename])
|
||||
|
||||
def editCalculixInputFile(self):
|
||||
print ('editCalculixInputFile {}'.format(self.inp_file_name))
|
||||
if self.ccx_prefs.GetBool("UseInternalEditor", True):
|
||||
FemGui.open(self.inp_file_name)
|
||||
else:
|
||||
ext_editor_path = self.ccx_prefs.GetString("ExternalEditorPath", "")
|
||||
if ext_editor_path:
|
||||
self.start_ext_editor(ext_editor_path, self.inp_file_name)
|
||||
else:
|
||||
print ("External editor is not defined in FEM preferences. Falling back to internal editor")
|
||||
FemGui.open(self.inp_file_name)
|
||||
|
||||
def runCalculix(self):
|
||||
print ('runCalculix')
|
||||
self.Start = time.time()
|
||||
|
||||
self.femConsoleMessage("CalculiX binary: {}".format(self.CalculixBinary))
|
||||
self.femConsoleMessage("Run CalculiX...")
|
||||
|
||||
# run Calculix
|
||||
print ('run CalculiX at: {} with: {}'.format(self.CalculixBinary, os.path.splitext(self.inp_file_name)[0]))
|
||||
# change cwd because ccx may crash if directory has no write permission
|
||||
# there is also a limit of the length of file names so jump to the document directory
|
||||
self.cwd = QtCore.QDir.currentPath()
|
||||
fi = QtCore.QFileInfo(self.inp_file_name)
|
||||
QtCore.QDir.setCurrent(fi.path())
|
||||
self.Calculix.start(self.CalculixBinary, ['-i', fi.baseName()])
|
||||
|
||||
QApplication.restoreOverrideCursor()
|
||||
|
||||
def select_analysis_type(self, analysis_type):
|
||||
if self.solver_object.AnalysisType != analysis_type:
|
||||
self.solver_object.AnalysisType = analysis_type
|
||||
self.form.pb_edit_inp.setEnabled(False)
|
||||
self.form.pb_run_ccx.setEnabled(False)
|
||||
|
||||
def select_static_analysis(self):
|
||||
self.select_analysis_type('static')
|
||||
|
||||
def select_frequency_analysis(self):
|
||||
self.select_analysis_type('frequency')
|
||||
|
||||
def select_thermomech_analysis(self):
|
||||
self.select_analysis_type('thermomech')
|
||||
|
||||
# That function overlaps with FemTools setup_working_dir and needs to be removed when we migrate fully to FemTools
|
||||
def setup_working_dir(self):
|
||||
wd = self.solver_object.WorkingDir
|
||||
if not (os.path.isdir(wd)):
|
||||
try:
|
||||
os.makedirs(wd)
|
||||
except:
|
||||
print ("Dir \'{}\' from FEM preferences doesn't exist and cannot be created.".format(wd))
|
||||
import tempfile
|
||||
wd = tempfile.gettempdir()
|
||||
print ("Dir \'{}\' will be used instead.".format(wd))
|
||||
return wd
|
||||
385
src/Mod/Fem/PyGui/_TaskPanelShowResult.py
Normal file
385
src/Mod/Fem/PyGui/_TaskPanelShowResult.py
Normal file
@@ -0,0 +1,385 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013-2015 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Result Control Task Panel"
|
||||
__author__ = "Juergen Riegel, Michael Hindley"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package TaskPanelShowResult
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import numpy as np
|
||||
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
from PySide import QtCore, QtGui
|
||||
from PySide.QtCore import Qt
|
||||
from PySide.QtGui import QApplication
|
||||
|
||||
|
||||
class _TaskPanelShowResult:
|
||||
'''The task panel for the post-processing'''
|
||||
def __init__(self, obj):
|
||||
self.result_obj = obj
|
||||
self.mesh_obj = self.result_obj.Mesh
|
||||
# task panel should be started by use of setEdit of view provider
|
||||
# in view provider checks: Mesh, active analysis and if Mesh and result are in active analysis
|
||||
|
||||
self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Fem/TaskPanelShowResult.ui")
|
||||
self.fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General")
|
||||
self.restore_result_settings_in_dialog = self.fem_prefs.GetBool("RestoreResultDialog", True)
|
||||
|
||||
# Connect Signals and Slots
|
||||
# result type radio buttons
|
||||
QtCore.QObject.connect(self.form.rb_none, QtCore.SIGNAL("toggled(bool)"), self.none_selected)
|
||||
QtCore.QObject.connect(self.form.rb_abs_displacement, QtCore.SIGNAL("toggled(bool)"), self.abs_displacement_selected)
|
||||
QtCore.QObject.connect(self.form.rb_x_displacement, QtCore.SIGNAL("toggled(bool)"), self.x_displacement_selected)
|
||||
QtCore.QObject.connect(self.form.rb_y_displacement, QtCore.SIGNAL("toggled(bool)"), self.y_displacement_selected)
|
||||
QtCore.QObject.connect(self.form.rb_z_displacement, QtCore.SIGNAL("toggled(bool)"), self.z_displacement_selected)
|
||||
QtCore.QObject.connect(self.form.rb_temperature, QtCore.SIGNAL("toggled(bool)"), self.temperature_selected)
|
||||
QtCore.QObject.connect(self.form.rb_vm_stress, QtCore.SIGNAL("toggled(bool)"), self.vm_stress_selected)
|
||||
QtCore.QObject.connect(self.form.rb_maxprin, QtCore.SIGNAL("toggled(bool)"), self.max_prin_selected)
|
||||
QtCore.QObject.connect(self.form.rb_minprin, QtCore.SIGNAL("toggled(bool)"), self.min_prin_selected)
|
||||
QtCore.QObject.connect(self.form.rb_max_shear_stress, QtCore.SIGNAL("toggled(bool)"), self.max_shear_selected)
|
||||
|
||||
# displacement
|
||||
QtCore.QObject.connect(self.form.cb_show_displacement, QtCore.SIGNAL("clicked(bool)"), self.show_displacement)
|
||||
QtCore.QObject.connect(self.form.hsb_displacement_factor, QtCore.SIGNAL("valueChanged(int)"), self.hsb_disp_factor_changed)
|
||||
QtCore.QObject.connect(self.form.sb_displacement_factor, QtCore.SIGNAL("valueChanged(int)"), self.sb_disp_factor_changed)
|
||||
QtCore.QObject.connect(self.form.sb_displacement_factor_max, QtCore.SIGNAL("valueChanged(int)"), self.sb_disp_factor_max_changed)
|
||||
|
||||
# user defined equation
|
||||
QtCore.QObject.connect(self.form.user_def_eq, QtCore.SIGNAL("textchanged()"), self.user_defined_text)
|
||||
QtCore.QObject.connect(self.form.calculate, QtCore.SIGNAL("clicked()"), self.calculate)
|
||||
|
||||
self.update()
|
||||
if self.restore_result_settings_in_dialog:
|
||||
self.restore_result_dialog()
|
||||
else:
|
||||
self.restore_initial_result_dialog()
|
||||
|
||||
def restore_result_dialog(self):
|
||||
try:
|
||||
rt = FreeCAD.FEM_dialog["results_type"]
|
||||
if rt == "None":
|
||||
self.form.rb_none.setChecked(True)
|
||||
self.none_selected(True)
|
||||
elif rt == "Uabs":
|
||||
self.form.rb_abs_displacement.setChecked(True)
|
||||
self.abs_displacement_selected(True)
|
||||
elif rt == "U1":
|
||||
self.form.rb_x_displacement.setChecked(True)
|
||||
self.x_displacement_selected(True)
|
||||
elif rt == "U2":
|
||||
self.form.rb_y_displacement.setChecked(True)
|
||||
self.y_displacement_selected(True)
|
||||
elif rt == "U3":
|
||||
self.form.rb_z_displacement.setChecked(True)
|
||||
self.z_displacement_selected(True)
|
||||
elif rt == "Temp":
|
||||
self.form.rb_temperature.setChecked(True)
|
||||
self.temperature_selected(True)
|
||||
elif rt == "Sabs":
|
||||
self.form.rb_vm_stress.setChecked(True)
|
||||
self.vm_stress_selected(True)
|
||||
elif rt == "MaxPrin":
|
||||
self.form.rb_maxprin.setChecked(True)
|
||||
self.max_prin_selected(True)
|
||||
elif rt == "MinPrin":
|
||||
self.form.rb_minprin.setChecked(True)
|
||||
self.min_prin_selected(True)
|
||||
elif rt == "MaxShear":
|
||||
self.form.rb_max_shear_stress.setChecked(True)
|
||||
self.max_shear_selected(True)
|
||||
|
||||
sd = FreeCAD.FEM_dialog["show_disp"]
|
||||
self.form.cb_show_displacement.setChecked(sd)
|
||||
self.show_displacement(sd)
|
||||
|
||||
df = FreeCAD.FEM_dialog["disp_factor"]
|
||||
dfm = FreeCAD.FEM_dialog["disp_factor_max"]
|
||||
self.form.hsb_displacement_factor.setMaximum(dfm)
|
||||
self.form.hsb_displacement_factor.setValue(df)
|
||||
self.form.sb_displacement_factor_max.setValue(dfm)
|
||||
self.form.sb_displacement_factor.setValue(df)
|
||||
except:
|
||||
self.restore_initial_result_dialog()
|
||||
|
||||
def restore_initial_result_dialog(self):
|
||||
FreeCAD.FEM_dialog = {"results_type": "None", "show_disp": False,
|
||||
"disp_factor": 0, "disp_factor_max": 100}
|
||||
self.reset_mesh_deformation()
|
||||
self.reset_mesh_color()
|
||||
|
||||
def getStandardButtons(self):
|
||||
return int(QtGui.QDialogButtonBox.Close)
|
||||
|
||||
def get_result_stats(self, type_name, analysis=None):
|
||||
if "Stats" in self.result_obj.PropertiesList:
|
||||
Stats = self.result_obj.Stats
|
||||
match_table = {"U1": (Stats[0], Stats[1], Stats[2]),
|
||||
"U2": (Stats[3], Stats[4], Stats[5]),
|
||||
"U3": (Stats[6], Stats[7], Stats[8]),
|
||||
"Uabs": (Stats[9], Stats[10], Stats[11]),
|
||||
"Sabs": (Stats[12], Stats[13], Stats[14]),
|
||||
"MaxPrin": (Stats[15], Stats[16], Stats[17]),
|
||||
"MidPrin": (Stats[18], Stats[19], Stats[20]),
|
||||
"MinPrin": (Stats[21], Stats[22], Stats[23]),
|
||||
"MaxShear": (Stats[24], Stats[25], Stats[26]),
|
||||
"None": (0.0, 0.0, 0.0)}
|
||||
return match_table[type_name]
|
||||
return (0.0, 0.0, 0.0)
|
||||
|
||||
def none_selected(self, state):
|
||||
FreeCAD.FEM_dialog["results_type"] = "None"
|
||||
self.set_result_stats("mm", 0.0, 0.0, 0.0)
|
||||
self.reset_mesh_color()
|
||||
|
||||
def abs_displacement_selected(self, state):
|
||||
FreeCAD.FEM_dialog["results_type"] = "Uabs"
|
||||
self.select_displacement_type("Uabs")
|
||||
|
||||
def x_displacement_selected(self, state):
|
||||
FreeCAD.FEM_dialog["results_type"] = "U1"
|
||||
self.select_displacement_type("U1")
|
||||
|
||||
def y_displacement_selected(self, state):
|
||||
FreeCAD.FEM_dialog["results_type"] = "U2"
|
||||
self.select_displacement_type("U2")
|
||||
|
||||
def z_displacement_selected(self, state):
|
||||
FreeCAD.FEM_dialog["results_type"] = "U3"
|
||||
self.select_displacement_type("U3")
|
||||
|
||||
def vm_stress_selected(self, state):
|
||||
FreeCAD.FEM_dialog["results_type"] = "Sabs"
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
if self.suitable_results:
|
||||
self.mesh_obj.ViewObject.setNodeColorByScalars(self.result_obj.NodeNumbers, self.result_obj.StressValues)
|
||||
(minm, avg, maxm) = self.get_result_stats("Sabs")
|
||||
self.set_result_stats("MPa", minm, avg, maxm)
|
||||
QtGui.qApp.restoreOverrideCursor()
|
||||
|
||||
def max_shear_selected(self, state):
|
||||
FreeCAD.FEM_dialog["results_type"] = "MaxShear"
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
if self.suitable_results:
|
||||
self.mesh_obj.ViewObject.setNodeColorByScalars(self.result_obj.NodeNumbers, self.result_obj.MaxShear)
|
||||
(minm, avg, maxm) = self.get_result_stats("MaxShear")
|
||||
self.set_result_stats("MPa", minm, avg, maxm)
|
||||
QtGui.qApp.restoreOverrideCursor()
|
||||
|
||||
def max_prin_selected(self, state):
|
||||
FreeCAD.FEM_dialog["results_type"] = "MaxPrin"
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
if self.suitable_results:
|
||||
self.mesh_obj.ViewObject.setNodeColorByScalars(self.result_obj.NodeNumbers, self.result_obj.PrincipalMax)
|
||||
(minm, avg, maxm) = self.get_result_stats("MaxPrin")
|
||||
self.set_result_stats("MPa", minm, avg, maxm)
|
||||
QtGui.qApp.restoreOverrideCursor()
|
||||
|
||||
def temperature_selected(self, state):
|
||||
FreeCAD.FEM_dialog["results_type"] = "Temp"
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
if self.suitable_results:
|
||||
self.mesh_obj.ViewObject.setNodeColorByScalars(self.result_obj.NodeNumbers, self.result_obj.Temperature)
|
||||
minm = min(self.result_obj.Temperature)
|
||||
avg = sum(self.result_obj.Temperature) / len(self.result_obj.Temperature)
|
||||
maxm = max(self.result_obj.Temperature)
|
||||
self.set_result_stats("K", minm, avg, maxm)
|
||||
QtGui.qApp.restoreOverrideCursor()
|
||||
|
||||
def min_prin_selected(self, state):
|
||||
FreeCAD.FEM_dialog["results_type"] = "MinPrin"
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
if self.suitable_results:
|
||||
self.mesh_obj.ViewObject.setNodeColorByScalars(self.result_obj.NodeNumbers, self.result_obj.PrincipalMin)
|
||||
(minm, avg, maxm) = self.get_result_stats("MinPrin")
|
||||
self.set_result_stats("MPa", minm, avg, maxm)
|
||||
QtGui.qApp.restoreOverrideCursor()
|
||||
|
||||
def user_defined_text(self, equation):
|
||||
FreeCAD.FEM_dialog["results_type"] = "user"
|
||||
self.form.user_def_eq.toPlainText()
|
||||
|
||||
def calculate(self):
|
||||
FreeCAD.FEM_dialog["results_type"] = "None"
|
||||
self.update()
|
||||
self.restore_result_dialog()
|
||||
# Convert existing values to numpy array
|
||||
P1 = np.array(self.result_obj.PrincipalMax)
|
||||
P2 = np.array(self.result_obj.PrincipalMed)
|
||||
P3 = np.array(self.result_obj.PrincipalMin)
|
||||
Von = np.array(self.result_obj.StressValues)
|
||||
T = np.array(self.result_obj.Temperature)
|
||||
dispvectors = np.array(self.result_obj.DisplacementVectors)
|
||||
x = np.array(dispvectors[:, 0])
|
||||
y = np.array(dispvectors[:, 1])
|
||||
z = np.array(dispvectors[:, 2])
|
||||
stressvectors = np.array(self.result_obj.StressVectors)
|
||||
sx = np.array(stressvectors[:, 0])
|
||||
sy = np.array(stressvectors[:, 1])
|
||||
sz = np.array(stressvectors[:, 2])
|
||||
strainvectors = np.array(self.result_obj.StrainVectors)
|
||||
ex = np.array(strainvectors[:, 0])
|
||||
ey = np.array(strainvectors[:, 1])
|
||||
ez = np.array(strainvectors[:, 2])
|
||||
userdefined_eq = self.form.user_def_eq.toPlainText() # Get equation to be used
|
||||
UserDefinedFormula = eval(userdefined_eq).tolist()
|
||||
self.result_obj.UserDefined = UserDefinedFormula
|
||||
minm = min(UserDefinedFormula)
|
||||
avg = sum(UserDefinedFormula) / len(UserDefinedFormula)
|
||||
maxm = max(UserDefinedFormula)
|
||||
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
if self.suitable_results:
|
||||
self.mesh_obj.ViewObject.setNodeColorByScalars(self.result_obj.NodeNumbers, UserDefinedFormula)
|
||||
self.set_result_stats("", minm, avg, maxm)
|
||||
QtGui.qApp.restoreOverrideCursor()
|
||||
del x, y, z, T, Von, P1, P2, P3, sx, sy, sz, ex, ey, ez # Dummy use to get around flake8, varibles not being used
|
||||
|
||||
def select_displacement_type(self, disp_type):
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
if disp_type == "Uabs":
|
||||
if self.suitable_results:
|
||||
self.mesh_obj.ViewObject.setNodeColorByScalars(self.result_obj.NodeNumbers, self.result_obj.DisplacementLengths)
|
||||
else:
|
||||
match = {"U1": 0, "U2": 1, "U3": 2}
|
||||
d = zip(*self.result_obj.DisplacementVectors)
|
||||
displacements = list(d[match[disp_type]])
|
||||
if self.suitable_results:
|
||||
self.mesh_obj.ViewObject.setNodeColorByScalars(self.result_obj.NodeNumbers, displacements)
|
||||
(minm, avg, maxm) = self.get_result_stats(disp_type)
|
||||
self.set_result_stats("mm", minm, avg, maxm)
|
||||
QtGui.qApp.restoreOverrideCursor()
|
||||
|
||||
def set_result_stats(self, unit, minm, avg, maxm):
|
||||
self.form.le_min.setProperty("unit", unit)
|
||||
self.form.le_min.setText("{:.6} {}".format(minm, unit))
|
||||
self.form.le_avg.setProperty("unit", unit)
|
||||
self.form.le_avg.setText("{:.6} {}".format(avg, unit))
|
||||
self.form.le_max.setProperty("unit", unit)
|
||||
self.form.le_max.setText("{:.6} {}".format(maxm, unit))
|
||||
|
||||
def update_displacement(self, factor=None):
|
||||
if factor is None:
|
||||
if FreeCAD.FEM_dialog["show_disp"]:
|
||||
factor = self.form.hsb_displacement_factor.value()
|
||||
else:
|
||||
factor = 0.0
|
||||
self.mesh_obj.ViewObject.applyDisplacement(factor)
|
||||
|
||||
def show_displacement(self, checked):
|
||||
QApplication.setOverrideCursor(Qt.WaitCursor)
|
||||
FreeCAD.FEM_dialog["show_disp"] = checked
|
||||
if "result_obj" in FreeCAD.FEM_dialog:
|
||||
if FreeCAD.FEM_dialog["result_obj"] != self.result_obj:
|
||||
self.update_displacement()
|
||||
FreeCAD.FEM_dialog["result_obj"] = self.result_obj
|
||||
if self.suitable_results:
|
||||
self.mesh_obj.ViewObject.setNodeDisplacementByVectors(self.result_obj.NodeNumbers, self.result_obj.DisplacementVectors)
|
||||
self.update_displacement()
|
||||
QtGui.qApp.restoreOverrideCursor()
|
||||
|
||||
def hsb_disp_factor_changed(self, value):
|
||||
self.form.sb_displacement_factor.setValue(value)
|
||||
self.update_displacement()
|
||||
|
||||
def sb_disp_factor_max_changed(self, value):
|
||||
FreeCAD.FEM_dialog["disp_factor_max"] = value
|
||||
self.form.hsb_displacement_factor.setMaximum(value)
|
||||
|
||||
def sb_disp_factor_changed(self, value):
|
||||
FreeCAD.FEM_dialog["disp_factor"] = value
|
||||
self.form.hsb_displacement_factor.setValue(value)
|
||||
|
||||
def disable_empty_result_buttons(self):
|
||||
''' disable radio buttons if result does not exists in result object'''
|
||||
'''assignments
|
||||
DisplacementLengths --> rb_abs_displacement
|
||||
DisplacementVectors --> rb_x_displacement, rb_y_displacement, rb_z_displacement
|
||||
Temperature --> rb_temperature
|
||||
StressValues --> rb_vm_stress
|
||||
PrincipalMax --> rb_maxprin
|
||||
PrincipalMin --> rb_minprin
|
||||
MaxShear --> rb_max_shear_stress'''
|
||||
if len(self.result_obj.DisplacementLengths) == 0:
|
||||
self.form.rb_abs_displacement.setEnabled(0)
|
||||
if len(self.result_obj.DisplacementVectors) == 0:
|
||||
self.form.rb_x_displacement.setEnabled(0)
|
||||
self.form.rb_y_displacement.setEnabled(0)
|
||||
self.form.rb_z_displacement.setEnabled(0)
|
||||
if len(self.result_obj.Temperature) == 0:
|
||||
self.form.rb_temperature.setEnabled(0)
|
||||
if len(self.result_obj.StressValues) == 0:
|
||||
self.form.rb_vm_stress.setEnabled(0)
|
||||
if len(self.result_obj.PrincipalMax) == 0:
|
||||
self.form.rb_maxprin.setEnabled(0)
|
||||
if len(self.result_obj.PrincipalMin) == 0:
|
||||
self.form.rb_minprin.setEnabled(0)
|
||||
if len(self.result_obj.MaxShear) == 0:
|
||||
self.form.rb_max_shear_stress.setEnabled(0)
|
||||
|
||||
def update(self):
|
||||
self.suitable_results = False
|
||||
if (self.mesh_obj.FemMesh.NodeCount == len(self.result_obj.NodeNumbers)):
|
||||
self.suitable_results = True
|
||||
self.disable_empty_result_buttons()
|
||||
self.mesh_obj.ViewObject.Visibility = True
|
||||
hide_parts_constraints()
|
||||
else:
|
||||
if not self.mesh_obj.FemMesh.VolumeCount:
|
||||
error_message = 'FEM: Graphical bending stress output for beam or shell FEM Meshes not yet supported.\n'
|
||||
FreeCAD.Console.PrintError(error_message)
|
||||
QtGui.QMessageBox.critical(None, 'No result object', error_message)
|
||||
else:
|
||||
error_message = 'FEM: Result node numbers are not equal to FEM Mesh NodeCount.\n'
|
||||
FreeCAD.Console.PrintError(error_message)
|
||||
QtGui.QMessageBox.critical(None, 'No result object', error_message)
|
||||
|
||||
def reset_mesh_deformation(self):
|
||||
self.mesh_obj.ViewObject.applyDisplacement(0.0)
|
||||
|
||||
def reset_mesh_color(self):
|
||||
self.mesh_obj.ViewObject.NodeColor = {}
|
||||
self.mesh_obj.ViewObject.ElementColor = {}
|
||||
self.mesh_obj.ViewObject.setNodeColorByScalars()
|
||||
|
||||
def reject(self):
|
||||
FreeCADGui.Control.closeDialog() # if the taks panell is called from Command obj is not in edit mode thus reset edit does not cleses the dialog, may be do not call but set in edit instead
|
||||
FreeCADGui.ActiveDocument.resetEdit()
|
||||
|
||||
|
||||
# helper
|
||||
def hide_parts_constraints():
|
||||
fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General")
|
||||
hide_constraints = fem_prefs.GetBool("HideConstraint", False)
|
||||
if hide_constraints:
|
||||
for acnstrmesh in FemGui.getActiveAnalysis().Member:
|
||||
if "Constraint" in acnstrmesh.TypeId:
|
||||
acnstrmesh.ViewObject.Visibility = False
|
||||
if "Mesh" in acnstrmesh.TypeId:
|
||||
aparttoshow = acnstrmesh.Name.replace("_Mesh", "")
|
||||
for apart in FreeCAD.activeDocument().Objects:
|
||||
if aparttoshow == apart.Name:
|
||||
apart.ViewObject.Visibility = False
|
||||
84
src/Mod/Fem/PyGui/_ViewProviderFemBeamSection.py
Normal file
84
src/Mod/Fem/PyGui/_ViewProviderFemBeamSection.py
Normal file
@@ -0,0 +1,84 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2015 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_ViewProviderFemBeamSection"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package ViewProviderFemBeamSection
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from pivy import coin
|
||||
|
||||
|
||||
class _ViewProviderFemBeamSection:
|
||||
"A View Provider for the FemBeamSection object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-beam-section.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Standard")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Standard"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Standard"
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
import _TaskPanelFemBeamSection
|
||||
taskd = _TaskPanelFemBeamSection._TaskPanelFemBeamSection(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
if not doc.getInEdit():
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
63
src/Mod/Fem/PyGui/_ViewProviderFemConstraintSelfWeight.py
Normal file
63
src/Mod/Fem/PyGui/_ViewProviderFemConstraintSelfWeight.py
Normal file
@@ -0,0 +1,63 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_ViewProviderFemConstraintSelfWeight"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package ViewProviderFemConstraintSelfWeight
|
||||
# \ingroup FEM
|
||||
|
||||
from pivy import coin
|
||||
|
||||
|
||||
class _ViewProviderFemConstraintSelfWeight:
|
||||
"A View Provider for the FemConstraintSelfWeight object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-constraint-selfweight.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Standard")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Standard"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Standard"
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
77
src/Mod/Fem/PyGui/_ViewProviderFemMaterial.py
Normal file
77
src/Mod/Fem/PyGui/_ViewProviderFemMaterial.py
Normal file
@@ -0,0 +1,77 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2013 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_ViewProviderFemMaterial"
|
||||
__author__ = "Juergen Riegel, Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package _ViewProviderFemMaterial
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
|
||||
class _ViewProviderFemMaterial:
|
||||
"A View Provider for the FemMaterial object"
|
||||
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-material.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def setEdit(self, vobj, mode):
|
||||
import _TaskPanelFemMaterial
|
||||
taskd = _TaskPanelFemMaterial._TaskPanelFemMaterial(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
|
||||
# overwrite the doubleClicked to make sure no other Material taskd (and thus no selection observer) is still active
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
if not doc.getInEdit():
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
@@ -0,0 +1,63 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_ViewProviderFemMaterialMechanicalNonlinear"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package ViewProviderFemMaterialMechanicalNonLinear
|
||||
# \ingroup FEM
|
||||
|
||||
from pivy import coin
|
||||
|
||||
|
||||
class _ViewProviderFemMaterialMechanicalNonlinear:
|
||||
"A View Provider for the FemMaterialMechanicalNonlinear object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-material-nonlinear.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Standard")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Standard"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Standard"
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
140
src/Mod/Fem/PyGui/_ViewProviderFemMeshGmsh.py
Normal file
140
src/Mod/Fem/PyGui/_ViewProviderFemMeshGmsh.py
Normal file
@@ -0,0 +1,140 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_ViewProviderFemMeshGmsh"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package ViewProviderFemMeshGmsh
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
|
||||
|
||||
class _ViewProviderFemMeshGmsh:
|
||||
"A View Provider for the FemMeshGmsh object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-femmesh-from-shape.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def setEdit(self, vobj, mode):
|
||||
self.ViewObject.show() # show the mesh on edit if it is hided
|
||||
import _TaskPanelFemMeshGmsh
|
||||
taskd = _TaskPanelFemMeshGmsh._TaskPanelFemMeshGmsh(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
FreeCADGui.activateWorkbench('FemWorkbench')
|
||||
# Group meshing is only active on active analysis, we should make sure the analysis the mesh belongs too is active
|
||||
gui_doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
if not gui_doc.getInEdit():
|
||||
# may be go the other way around and just activate the analysis the user has doubleClicked on ?!
|
||||
# not a fast one, we need to iterate over all member of all analysis to know to which analyis the object belongs too!!!
|
||||
# first check if there is an analysis in the active document
|
||||
found_an_analysis = False
|
||||
for o in gui_doc.Document.Objects:
|
||||
if o.isDerivedFrom('Fem::FemAnalysisPython'):
|
||||
found_an_analysis = True
|
||||
break
|
||||
if found_an_analysis:
|
||||
if FemGui.getActiveAnalysis() is not None:
|
||||
if FemGui.getActiveAnalysis().Document is FreeCAD.ActiveDocument:
|
||||
if self.Object in FemGui.getActiveAnalysis().Member:
|
||||
if not gui_doc.getInEdit():
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Activate the analysis this GMSH FEM mesh object belongs too!\n')
|
||||
else:
|
||||
print('GMSH FEM mesh object does not belong to the active analysis.')
|
||||
found_mesh_analysis = False
|
||||
for o in gui_doc.Document.Objects:
|
||||
if o.isDerivedFrom('Fem::FemAnalysisPython'):
|
||||
for m in o.Member:
|
||||
if m == self.Object:
|
||||
found_mesh_analysis = True
|
||||
FemGui.setActiveAnalysis(o)
|
||||
print('The analysis the GMSH FEM mesh object belongs too was found and activated: ' + o.Name)
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
break
|
||||
if not found_mesh_analysis:
|
||||
print('GMSH FEM mesh object does not belong to an analysis. Analysis group meshing will be deactivated.')
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active analysis is not in active document.')
|
||||
else:
|
||||
print('No active analysis in active document, we gone have a look if the GMSH FEM mesh object belongs to a non active analysis.')
|
||||
found_mesh_analysis = False
|
||||
for o in gui_doc.Document.Objects:
|
||||
if o.isDerivedFrom('Fem::FemAnalysisPython'):
|
||||
for m in o.Member:
|
||||
if m == self.Object:
|
||||
found_mesh_analysis = True
|
||||
FemGui.setActiveAnalysis(o)
|
||||
print('The analysis the GMSH FEM mesh object belongs too was found and activated: ' + o.Name)
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
break
|
||||
if not found_mesh_analysis:
|
||||
print('GMSH FEM mesh object does not belong to an analysis. Analysis group meshing will be deactivated.')
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
print('No analysis in the active document.')
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
|
||||
def claimChildren(self):
|
||||
return (self.Object.MeshRegionList + self.Object.MeshGroupList)
|
||||
|
||||
def onDelete(self, feature, subelements):
|
||||
try:
|
||||
for obj in self.claimChildren():
|
||||
obj.ViewObject.show()
|
||||
except Exception as err:
|
||||
FreeCAD.Console.PrintError("Error in onDelete: " + err.message)
|
||||
return True
|
||||
89
src/Mod/Fem/PyGui/_ViewProviderFemMeshGroup.py
Normal file
89
src/Mod/Fem/PyGui/_ViewProviderFemMeshGroup.py
Normal file
@@ -0,0 +1,89 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_ViewProviderFemMeshGroup"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package ViewProviderFemMeshGroup
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from pivy import coin
|
||||
|
||||
|
||||
class _ViewProviderFemMeshGroup:
|
||||
"A View Provider for the FemMeshGroup object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-femmesh-from-shape.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Standard")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Standard"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Standard"
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
# hide all meshes
|
||||
for o in FreeCAD.ActiveDocument.Objects:
|
||||
if o.isDerivedFrom("Fem::FemMeshObject"):
|
||||
o.ViewObject.hide()
|
||||
# show task panel
|
||||
import _TaskPanelFemMeshGroup
|
||||
taskd = _TaskPanelFemMeshGroup._TaskPanelFemMeshGroup(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
if not doc.getInEdit():
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
89
src/Mod/Fem/PyGui/_ViewProviderFemMeshRegion.py
Normal file
89
src/Mod/Fem/PyGui/_ViewProviderFemMeshRegion.py
Normal file
@@ -0,0 +1,89 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_ViewProviderFemMeshRegion"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package ViewProviderFemMeshRegion
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from pivy import coin
|
||||
|
||||
|
||||
class _ViewProviderFemMeshRegion:
|
||||
"A View Provider for the FemMeshRegion object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-femmesh-region.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Standard")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Standard"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Standard"
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
# hide all meshes
|
||||
for o in FreeCAD.ActiveDocument.Objects:
|
||||
if o.isDerivedFrom("Fem::FemMeshObject"):
|
||||
o.ViewObject.hide()
|
||||
# show task panel
|
||||
import _TaskPanelFemMeshRegion
|
||||
taskd = _TaskPanelFemMeshRegion._TaskPanelFemMeshRegion(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
if not doc.getInEdit():
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
115
src/Mod/Fem/PyGui/_ViewProviderFemResultMechanical.py
Normal file
115
src/Mod/Fem/PyGui/_ViewProviderFemResultMechanical.py
Normal file
@@ -0,0 +1,115 @@
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* Copyright (c) 2015 - Qingfeng Xia <qingfeng.xia()eng.ox.ac.uk> *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
#* as published by the Free Software Foundation; either version 2 of *
|
||||
#* the License, or (at your option) any later version. *
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* This program is distributed in the hope that it will be useful, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Library General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* License along with this program; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
__title__ = "ViewProvider for FEM mechanical ResultObjectPython"
|
||||
__author__ = "Qingfeng Xia, Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package _ViewProviderFemResultMechanical
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD ViewProvider for mechanical ResultObjectPython in FEM workbench
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
|
||||
|
||||
class _ViewProviderFemResultMechanical:
|
||||
"""A View Provider for the FemResultObject Python dervied FemResult class
|
||||
"""
|
||||
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
"""after load from FCStd file, self.icon does not exist, return constant path instead"""
|
||||
return ":/icons/fem-result.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
if FreeCADGui.activeWorkbench().name() != 'FemWorkbench':
|
||||
FreeCADGui.activateWorkbench("FemWorkbench")
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
if not doc.getInEdit():
|
||||
if is_result_obj_valid(self.Object):
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
import _TaskPanelShowResult
|
||||
taskd = _TaskPanelShowResult._TaskPanelShowResult(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
|
||||
|
||||
# helper
|
||||
# I tried to do this inside the setEdit def but I was not able to unset the edit mode from within the setEdit def
|
||||
def is_result_obj_valid(result_obj):
|
||||
from PySide import QtGui
|
||||
if FemGui.getActiveAnalysis() is not None:
|
||||
if hasattr(result_obj, "Mesh") and result_obj.Mesh:
|
||||
mem = FemGui.getActiveAnalysis().Member
|
||||
if result_obj in mem:
|
||||
if result_obj.Mesh in mem:
|
||||
return True
|
||||
else:
|
||||
error_message = 'FEM: Result mesh object is not in active analysis.\n'
|
||||
FreeCAD.Console.PrintError(error_message)
|
||||
QtGui.QMessageBox.critical(None, 'Not in activate analysis', error_message)
|
||||
return False
|
||||
else:
|
||||
error_message = 'FEM: Result object is not in active analysis.\n'
|
||||
FreeCAD.Console.PrintError(error_message)
|
||||
QtGui.QMessageBox.critical(None, 'Not in activate analysis', error_message)
|
||||
return False
|
||||
else:
|
||||
error_message = 'FEM: Result object has no appropriate FEM mesh.\n'
|
||||
FreeCAD.Console.PrintError(error_message)
|
||||
QtGui.QMessageBox.critical(None, 'No result object', error_message)
|
||||
return False
|
||||
else:
|
||||
error_message = 'FEM: No active analysis found! Please activate the analysis you would like to view results for.\n'
|
||||
FreeCAD.Console.PrintError(error_message)
|
||||
QtGui.QMessageBox.critical(None, 'No activate analysis', error_message)
|
||||
return False
|
||||
84
src/Mod/Fem/PyGui/_ViewProviderFemShellThickness.py
Normal file
84
src/Mod/Fem/PyGui/_ViewProviderFemShellThickness.py
Normal file
@@ -0,0 +1,84 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2015 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_ViewProviderFemShellThickness"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package ViewProviderFemShellThickness
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from pivy import coin
|
||||
|
||||
|
||||
class _ViewProviderFemShellThickness:
|
||||
"A View Provider for the FemShellThickness object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-shell-thickness.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Standard")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Standard"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Standard"
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
import _TaskPanelFemShellThickness
|
||||
taskd = _TaskPanelFemShellThickness._TaskPanelFemShellThickness(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
if not doc.getInEdit():
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
85
src/Mod/Fem/PyGui/_ViewProviderFemSolverCalculix.py
Normal file
85
src/Mod/Fem/PyGui/_ViewProviderFemSolverCalculix.py
Normal file
@@ -0,0 +1,85 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2015 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_ViewProviderFemSolverCalculix"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package ViewProviderFemSolverCalculix
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
|
||||
|
||||
class _ViewProviderFemSolverCalculix:
|
||||
"A View Provider for the FemSolverCalculix object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-solver.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
import _TaskPanelFemSolverCalculix
|
||||
taskd = _TaskPanelFemSolverCalculix._TaskPanelFemSolverCalculix(self.Object)
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
if not doc.getInEdit():
|
||||
# may be go the other way around and just activate the analysis the user has doubleClicked on ?!
|
||||
if FemGui.getActiveAnalysis() is not None:
|
||||
if FemGui.getActiveAnalysis().Document is FreeCAD.ActiveDocument:
|
||||
if self.Object in FemGui.getActiveAnalysis().Member:
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Activate the analysis this solver belongs to!\n')
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Analysis is not in active Document!\n')
|
||||
else:
|
||||
FreeCAD.Console.PrintError('No active Analysis found!\n')
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
76
src/Mod/Fem/PyGui/_ViewProviderFemSolverZ88.py
Normal file
76
src/Mod/Fem/PyGui/_ViewProviderFemSolverZ88.py
Normal file
@@ -0,0 +1,76 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2015 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "_ViewProviderFemSolverZ88"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package ViewProviderFemSolverZ88
|
||||
# \ingroup FEM
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
|
||||
|
||||
class _ViewProviderFemSolverZ88:
|
||||
"A View Provider for the FemSolverZ88 object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-solver.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
if not doc.getInEdit():
|
||||
# may be go the other way around and just activate the analysis the user has doubleClicked on ?!
|
||||
if FemGui.getActiveAnalysis() is not None:
|
||||
if FemGui.getActiveAnalysis().Document is FreeCAD.ActiveDocument:
|
||||
if self.Object in FemGui.getActiveAnalysis().Member:
|
||||
FreeCAD.Console.PrintError('Not yet supported, use property editor and "run analysis" button!\n')
|
||||
# doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Activate the analysis this solver belongs to!\n')
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Analysis is not in active Document!\n')
|
||||
else:
|
||||
FreeCAD.Console.PrintError('No active Analysis found!\n')
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active Task Dialog found! Please close this one first!\n')
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
29
src/Mod/Fem/PyGui/__init__.py
Normal file
29
src/Mod/Fem/PyGui/__init__.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
__title__ = "Fem Gui modules"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package PyGui
|
||||
# \ingroup Fem
|
||||
# \brief Fem Gui module
|
||||
Reference in New Issue
Block a user