FEM: constraint initial flow velocity, add object, command, icon, task panel, etc.
This commit is contained in:
committed by
wmayer
parent
ce69c1531d
commit
42b3c3353b
@@ -102,6 +102,7 @@ SET(FemObjectsScripts_SRCS
|
||||
PyObjects/_FemConstraintSelfWeight.py
|
||||
PyObjects/_FemConstraintBodyHeatSource.py
|
||||
PyObjects/_FemConstraintFlowVelocity.py
|
||||
PyObjects/_FemConstraintInitialFlowVelocity.py
|
||||
PyObjects/_FemElementFluid1D.py
|
||||
PyObjects/_FemElementGeometry1D.py
|
||||
PyObjects/_FemElementGeometry2D.py
|
||||
@@ -150,6 +151,7 @@ SET(FemGuiScripts_SRCS
|
||||
PyGui/_CommandFemConstraintSelfWeight.py
|
||||
PyGui/_CommandFemConstraintBodyHeatSource.py
|
||||
PyGui/_CommandFemConstraintFlowVelocity.py
|
||||
PyGui/_CommandFemConstraintInitialFlowVelocity.py
|
||||
PyGui/_CommandFemElementFluid1D.py
|
||||
PyGui/_CommandFemElementGeometry1D.py
|
||||
PyGui/_CommandFemElementGeometry2D.py
|
||||
@@ -184,6 +186,7 @@ SET(FemGuiScripts_SRCS
|
||||
PyGui/_ViewProviderFemConstraintSelfWeight.py
|
||||
PyGui/_ViewProviderFemConstraintBodyHeatSource.py
|
||||
PyGui/_ViewProviderFemConstraintFlowVelocity.py
|
||||
PyGui/_ViewProviderFemConstraintInitialFlowVelocity.py
|
||||
PyGui/_ViewProviderFemElementFluid1D.py
|
||||
PyGui/_ViewProviderFemElementGeometry1D.py
|
||||
PyGui/_ViewProviderFemElementGeometry2D.py
|
||||
@@ -208,6 +211,7 @@ SET(FemGuiScripts_SRCS
|
||||
PyGui/TaskPanelFemResultShow.ui
|
||||
PyGui/TaskPanelFemSolverCalculix.ui
|
||||
PyGui/TaskPanelFemFlowVelocity.ui
|
||||
PyGui/TaskPanelFemInitialFlowVelocity.ui
|
||||
)
|
||||
|
||||
SET(FemTests_SRCS
|
||||
|
||||
@@ -52,6 +52,7 @@ INSTALL(
|
||||
PyObjects/_FemConstraintSelfWeight.py
|
||||
PyObjects/_FemConstraintBodyHeatSource.py
|
||||
PyObjects/_FemConstraintFlowVelocity.py
|
||||
PyObjects/_FemConstraintInitialFlowVelocity.py
|
||||
PyObjects/_FemElementFluid1D.py
|
||||
PyObjects/_FemElementGeometry1D.py
|
||||
PyObjects/_FemElementGeometry2D.py
|
||||
@@ -110,6 +111,7 @@ INSTALL(
|
||||
PyGui/__init__.py
|
||||
PyGui/_CommandFemConstraintBodyHeatSource.py
|
||||
PyGui/_CommandFemConstraintFlowVelocity.py
|
||||
PyGui/_CommandFemConstraintInitialFlowVelocity.py
|
||||
PyGui/_CommandFemAnalysis.py
|
||||
PyGui/_CommandFemConstraintSelfWeight.py
|
||||
PyGui/_CommandFemElementFluid1D.py
|
||||
@@ -146,6 +148,7 @@ INSTALL(
|
||||
PyGui/_ViewProviderFemConstraintSelfWeight.py
|
||||
PyGui/_ViewProviderFemConstraintBodyHeatSource.py
|
||||
PyGui/_ViewProviderFemConstraintFlowVelocity.py
|
||||
PyGui/_ViewProviderFemConstraintInitialFlowVelocity.py
|
||||
PyGui/_ViewProviderFemElementFluid1D.py
|
||||
PyGui/_ViewProviderFemElementGeometry1D.py
|
||||
PyGui/_ViewProviderFemElementGeometry2D.py
|
||||
@@ -170,6 +173,7 @@ INSTALL(
|
||||
PyGui/TaskPanelFemResultShow.ui
|
||||
PyGui/TaskPanelFemSolverCalculix.ui
|
||||
PyGui/TaskPanelFemFlowVelocity.ui
|
||||
PyGui/TaskPanelFemInitialFlowVelocity.ui
|
||||
DESTINATION
|
||||
Mod/Fem/PyGui
|
||||
)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<file>icons/fem-constraint-force.svg</file>
|
||||
<file>icons/fem-constraint-gear.svg</file>
|
||||
<file>icons/fem-constraint-heatflux.svg</file>
|
||||
<file>icons/fem-constraint-initial-flow-velocity.svg</file>
|
||||
<file>icons/fem-constraint-InitialTemperature.svg</file>
|
||||
<file>icons/fem-constraint-planerotation.svg</file>
|
||||
<file>icons/fem-constraint-pressure.svg</file>
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="64"
|
||||
height="64"
|
||||
viewBox="0 0 64 64"
|
||||
version="1.1"
|
||||
id="svg8">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
style="stroke-width:0.06915656"
|
||||
id="layer1"
|
||||
transform="matrix(14.459945,0,0,14.459945,-3.1824365,-4231.6137)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:3.54142189px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.00612281"
|
||||
x="0.7462678"
|
||||
y="296.17419"
|
||||
id="text6140"><tspan
|
||||
id="tspan6138"
|
||||
x="0.7462678"
|
||||
y="296.17419"
|
||||
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans Bold';stroke-width:0.00612281">V</tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.01829767"
|
||||
x="2.7012193"
|
||||
y="291.55859"
|
||||
id="text6144"><tspan
|
||||
id="tspan6142"
|
||||
x="2.7012193"
|
||||
y="301.09158"
|
||||
style="stroke-width:0.01829767" /></text>
|
||||
</g>
|
||||
<text
|
||||
id="text3703"
|
||||
y="57.802486"
|
||||
x="38.059044"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:51.01147079px;line-height:0px;font-family:'CMU Serif';-inkscape-font-specification:'CMU Serif';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
style="fill:#ff0000;stroke-width:0.26458332px"
|
||||
y="57.802486"
|
||||
x="38.059044"
|
||||
id="tspan3701">I</tspan></text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
@@ -104,7 +104,9 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
|
||||
Gui::ToolBarItem* fluid = new Gui::ToolBarItem(root);
|
||||
fluid->setCommand("Fluid Constraints");
|
||||
*fluid << "FEM_ConstraintFluidBoundary"
|
||||
*fluid << "FEM_AddConstraintInitialFlowVelocity"
|
||||
<< "Separator"
|
||||
<< "FEM_ConstraintFluidBoundary"
|
||||
<< "FEM_AddConstraintFlowVelocity";
|
||||
|
||||
Gui::ToolBarItem* solve = new Gui::ToolBarItem(root);
|
||||
@@ -168,7 +170,9 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
|
||||
Gui::MenuItem* fluid = new Gui::MenuItem;
|
||||
fluid->setCommand("&Fluid Constraints");
|
||||
*fluid << "FEM_ConstraintFluidBoundary"
|
||||
*fluid << "FEM_AddConstraintInitialFlowVelocity"
|
||||
<< "Separator"
|
||||
<< "FEM_ConstraintFluidBoundary"
|
||||
<< "FEM_AddConstraintFlowVelocity";
|
||||
|
||||
Gui::MenuItem* model = new Gui::MenuItem;
|
||||
|
||||
@@ -49,6 +49,7 @@ class FemWorkbench (Workbench):
|
||||
import PyGui._CommandFemConstraintSelfWeight
|
||||
import PyGui._CommandFemConstraintBodyHeatSource
|
||||
import PyGui._CommandFemConstraintFlowVelocity
|
||||
import PyGui._CommandFemConstraintInitialFlowVelocity
|
||||
import PyGui._CommandFemElementFluid1D
|
||||
import PyGui._CommandFemElementGeometry1D
|
||||
import PyGui._CommandFemElementGeometry2D
|
||||
|
||||
@@ -108,6 +108,17 @@ def makeConstraintHeatflux(doc, name="ConstraintHeatflux"):
|
||||
return obj
|
||||
|
||||
|
||||
def makeConstraintInitialFlowVelocity(doc, name="ConstraintInitialFlowVelocity"):
|
||||
'''makeConstraintInitialFlowVelocity(document, [name]): makes a Fem ConstraintInitialFlowVelocity object'''
|
||||
obj = doc.addObject("Fem::ConstraintPython", name)
|
||||
import PyObjects._FemConstraintInitialFlowVelocity
|
||||
PyObjects._FemConstraintInitialFlowVelocity.Proxy(obj)
|
||||
if FreeCAD.GuiUp:
|
||||
import PyGui._ViewProviderFemConstraintInitialFlowVelocity
|
||||
PyGui._ViewProviderFemConstraintInitialFlowVelocity.ViewProxy(obj.ViewObject)
|
||||
return obj
|
||||
|
||||
|
||||
def makeConstraintInitialTemperature(doc, name="ConstraintInitialTemperature"):
|
||||
'''makeConstraintInitialTemperature(document, name): makes a Fem ConstraintInitialTemperature object'''
|
||||
obj = doc.addObject("Fem::ConstraintInitialTemperature", name)
|
||||
|
||||
230
src/Mod/Fem/PyGui/TaskPanelFemInitialFlowVelocity.ui
Normal file
230
src/Mod/Fem/PyGui/TaskPanelFemInitialFlowVelocity.ui
Normal file
@@ -0,0 +1,230 @@
|
||||
<?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>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Constraint Properties</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="volocityXLbl">
|
||||
<property name="text">
|
||||
<string>Velocity x:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="Gui::InputField" name="velocityXTxt">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string>m/s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="velocityXBox">
|
||||
<property name="text">
|
||||
<string>unspecified</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="velocityYLbl">
|
||||
<property name="text">
|
||||
<string>Velocity y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="Gui::InputField" name="velocityYTxt">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string>m/s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="velocityYBox">
|
||||
<property name="text">
|
||||
<string>unspecified</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="velocityZLbl">
|
||||
<property name="text">
|
||||
<string>Velocity z:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="Gui::InputField" name="velocityZTxt">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="singleStep" stdset="0">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
<property name="unit" stdset="0">
|
||||
<string>m/s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="velocityZBox">
|
||||
<property name="text">
|
||||
<string>unspecified</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</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>velocityXBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>velocityXTxt</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>230</x>
|
||||
<y>44</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>230</x>
|
||||
<y>18</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>velocityXBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>velocityXTxt</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>230</x>
|
||||
<y>44</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>230</x>
|
||||
<y>18</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>velocityYBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>velocityYTxt</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>347</x>
|
||||
<y>53</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>184</x>
|
||||
<y>53</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>velocityYBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>velocityYTxt</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>347</x>
|
||||
<y>53</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>184</x>
|
||||
<y>53</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>velocityZBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>velocityZTxt</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>347</x>
|
||||
<y>87</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>184</x>
|
||||
<y>87</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>velocityZBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>velocityZTxt</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>347</x>
|
||||
<y>87</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>184</x>
|
||||
<y>87</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -0,0 +1,59 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 - Markus Hovorka <m.hovorka@live.de> *
|
||||
# * *
|
||||
# * 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__ = "AddConstraintInitialFlowVelocity"
|
||||
__author__ = "Markus Hovorka"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
|
||||
from PySide import QtCore
|
||||
|
||||
import FreeCAD as App
|
||||
import FreeCADGui as Gui
|
||||
from PyGui import FemCommands
|
||||
|
||||
|
||||
class Command(FemCommands.FemCommands):
|
||||
|
||||
def __init__(self):
|
||||
super(Command, self).__init__()
|
||||
self.resources = {
|
||||
'Pixmap': 'fem-constraint-initial-flow-velocity',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP(
|
||||
"FEM_ConstraintInitialFlowVelocity",
|
||||
"Constraint Velocity"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP(
|
||||
"FEM_ConstraintInitialFlowVelocity",
|
||||
"Creates a FEM constraint body heat flux")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
App.ActiveDocument.openTransaction(
|
||||
"Create FemConstraintInitialFlowVelocity")
|
||||
Gui.addModule("ObjectsFem")
|
||||
Gui.doCommand(
|
||||
"FemGui.getActiveAnalysis().Member += "
|
||||
"[ObjectsFem.makeConstraintInitialFlowVelocity()]")
|
||||
|
||||
|
||||
Gui.addCommand('FEM_AddConstraintInitialFlowVelocity', Command())
|
||||
@@ -0,0 +1,129 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 - Markus Hovorka <m.hovorka@live.de> *
|
||||
# * *
|
||||
# * 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__ = "view provider for constraint initial flow velocity object"
|
||||
__author__ = "Markus Hovorka, Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
|
||||
import FreeCAD as App
|
||||
import FemUtils
|
||||
import FemConstraint
|
||||
from FreeCAD import Units
|
||||
|
||||
import FreeCADGui as Gui
|
||||
|
||||
|
||||
class ViewProxy(FemConstraint.ViewProxy):
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-constraint-initial-flow-velocity.svg"
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
task = _TaskPanel(vobj.Object)
|
||||
Gui.Control.showDialog(task)
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
Gui.Control.closeDialog()
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
if Gui.Control.activeDialog():
|
||||
Gui.Control.closeDialog()
|
||||
Gui.ActiveDocument.setEdit(vobj.Object.Name)
|
||||
return True
|
||||
|
||||
|
||||
class _TaskPanel(object):
|
||||
|
||||
def __init__(self, obj):
|
||||
self._obj = obj
|
||||
self._paramWidget = Gui.PySideUic.loadUi(
|
||||
App.getHomePath() + "Mod/Fem/PyGui/TaskPanelFemInitialFlowVelocity.ui")
|
||||
self._initParamWidget()
|
||||
self.form = [self._paramWidget]
|
||||
analysis = FemUtils.findAnalysisOfMember(obj)
|
||||
self._mesh = FemUtils.getSingleMember(analysis, "Fem::FemMeshObject")
|
||||
self._part = self._mesh.Part if self._mesh is not None else None
|
||||
self._partVisible = None
|
||||
self._meshVisible = None
|
||||
|
||||
def open(self):
|
||||
if self._mesh is not None and self._part is not None:
|
||||
self._meshVisible = self._mesh.ViewObject.isVisible()
|
||||
self._partVisible = self._part.ViewObject.isVisible()
|
||||
self._mesh.ViewObject.hide()
|
||||
self._part.ViewObject.show()
|
||||
|
||||
def reject(self):
|
||||
self._restoreVisibility()
|
||||
return True
|
||||
|
||||
def accept(self):
|
||||
self._applyWidgetChanges()
|
||||
self._obj.Document.recompute()
|
||||
self._restoreVisibility()
|
||||
return True
|
||||
|
||||
def _restoreVisibility(self):
|
||||
if self._mesh is not None and self._part is not None:
|
||||
if self._meshVisible:
|
||||
self._mesh.ViewObject.show()
|
||||
else:
|
||||
self._mesh.ViewObject.hide()
|
||||
if self._partVisible:
|
||||
self._part.ViewObject.show()
|
||||
else:
|
||||
self._part.ViewObject.hide()
|
||||
|
||||
def _initParamWidget(self):
|
||||
unit = "m/s"
|
||||
self._paramWidget.velocityXTxt.setText(
|
||||
str(self._obj.VelocityX) + unit)
|
||||
self._paramWidget.velocityYTxt.setText(
|
||||
str(self._obj.VelocityY) + unit)
|
||||
self._paramWidget.velocityZTxt.setText(
|
||||
str(self._obj.VelocityZ) + unit)
|
||||
self._paramWidget.velocityXBox.setChecked(
|
||||
not self._obj.VelocityXEnabled)
|
||||
self._paramWidget.velocityYBox.setChecked(
|
||||
not self._obj.VelocityYEnabled)
|
||||
self._paramWidget.velocityZBox.setChecked(
|
||||
not self._obj.VelocityZEnabled)
|
||||
|
||||
def _applyWidgetChanges(self):
|
||||
unit = "m/s"
|
||||
self._obj.VelocityXEnabled = \
|
||||
not self._paramWidget.velocityXBox.isChecked()
|
||||
if self._obj.VelocityXEnabled:
|
||||
quantity = Units.Quantity(self._paramWidget.velocityXTxt.text())
|
||||
self._obj.VelocityX = float(quantity.getValueAs(unit))
|
||||
self._obj.VelocityYEnabled = \
|
||||
not self._paramWidget.velocityYBox.isChecked()
|
||||
if self._obj.VelocityYEnabled:
|
||||
quantity = Units.Quantity(self._paramWidget.velocityYTxt.text())
|
||||
self._obj.VelocityY = float(quantity.getValueAs(unit))
|
||||
self._obj.VelocityZEnabled = \
|
||||
not self._paramWidget.velocityZBox.isChecked()
|
||||
if self._obj.VelocityZEnabled:
|
||||
quantity = Units.Quantity(self._paramWidget.velocityZTxt.text())
|
||||
self._obj.VelocityZ = float(quantity.getValueAs(unit))
|
||||
55
src/Mod/Fem/PyObjects/_FemConstraintInitialFlowVelocity.py
Normal file
55
src/Mod/Fem/PyObjects/_FemConstraintInitialFlowVelocity.py
Normal file
@@ -0,0 +1,55 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 - Markus Hovorka <m.hovorka@live.de> *
|
||||
# * *
|
||||
# * 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__ = "the constraint initial flow velocity object"
|
||||
__author__ = "Markus Hovorka, Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
|
||||
import FemConstraint
|
||||
|
||||
|
||||
class Proxy(FemConstraint.Proxy):
|
||||
|
||||
Type = "Fem::ConstraintInitialFlowVelocity"
|
||||
|
||||
def __init__(self, obj):
|
||||
super(Proxy, self).__init__(obj)
|
||||
obj.addProperty(
|
||||
"App::PropertyFloat", "VelocityX",
|
||||
"Parameter", "Body heat flux")
|
||||
obj.addProperty(
|
||||
"App::PropertyBool", "VelocityXEnabled",
|
||||
"Parameter", "Body heat flux")
|
||||
obj.addProperty(
|
||||
"App::PropertyFloat", "VelocityY",
|
||||
"Parameter", "Body heat flux")
|
||||
obj.addProperty(
|
||||
"App::PropertyBool", "VelocityYEnabled",
|
||||
"Parameter", "Body heat flux")
|
||||
obj.addProperty(
|
||||
"App::PropertyFloat", "VelocityZ",
|
||||
"Parameter", "Body heat flux")
|
||||
obj.addProperty(
|
||||
"App::PropertyBool", "VelocityZEnabled",
|
||||
"Parameter", "Body heat flux")
|
||||
Reference in New Issue
Block a user