Skip to content

Commit

Permalink
[FEM] implement centrifugal body loads, ccx label CENTRIF from *DLOAD…
Browse files Browse the repository at this point in the history
… card
  • Loading branch information
UR-0 authored and berndhahnebach committed Jun 9, 2021
1 parent 27e98c3 commit 557be14
Show file tree
Hide file tree
Showing 16 changed files with 620 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Mod/Fem/CMakeLists.txt
Expand Up @@ -131,6 +131,7 @@ SET(FemObjects_SRCS
femobjects/base_fempythonobject.py
femobjects/constant_vacuumpermittivity.py
femobjects/constraint_bodyheatsource.py
femobjects/constraint_centrif.py
femobjects/constraint_electrostaticpotential.py
femobjects/constraint_flowvelocity.py
femobjects/constraint_initialflowvelocity.py
Expand Down Expand Up @@ -447,6 +448,7 @@ SET(FemGuiObjects_SRCS

SET(FemGuiTaskPanels_SRCS
femtaskpanels/__init__.py
femtaskpanels/task_constraint_centrif.py
femtaskpanels/task_constraint_electrostaticpotential.py
femtaskpanels/task_constraint_flowvelocity.py
femtaskpanels/task_constraint_initialflowvelocity.py
Expand Down Expand Up @@ -483,6 +485,7 @@ SET(FemGuiViewProvider_SRCS
femviewprovider/view_base_femobject.py
femviewprovider/view_constant_vacuumpermittivity.py
femviewprovider/view_constraint_bodyheatsource.py
femviewprovider/view_constraint_centrif.py
femviewprovider/view_constraint_electrostaticpotential.py
femviewprovider/view_constraint_flowvelocity.py
femviewprovider/view_constraint_initialflowvelocity.py
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Fem/Gui/CMakeLists.txt
Expand Up @@ -365,6 +365,7 @@ INSTALL(FILES ${FemGuiIcon_SVG} DESTINATION "${CMAKE_INSTALL_DATADIR}/Mod/Fem/Re
# Python modules ui files, they are copied as they are, thus the need not to be added to Fem.qrc
# see https://forum.freecadweb.org/viewtopic.php?f=10&t=25833
SET(FemGuiPythonUI_SRCS
Resources/ui/ConstraintCentrif.ui
Resources/ui/ConstraintTie.ui
Resources/ui/ConstraintSectionPrint.ui
Resources/ui/ElectrostaticPotential.ui
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Fem/Gui/Resources/Fem.qrc
Expand Up @@ -10,6 +10,7 @@

<!-- gui command icons: constraints -->
<file>icons/FEM_ConstraintBearing.svg</file>
<file>icons/FEM_ConstraintCentrif.svg</file>
<file>icons/FEM_ConstraintContact.svg</file>
<file>icons/FEM_ConstraintDisplacement.svg</file>
<file>icons/FEM_ConstraintElectrostaticPotential.svg</file>
Expand Down Expand Up @@ -142,6 +143,7 @@
<file>translations/Fem_zh-TW.qm</file>

<!-- task panels -->
<file>ui/ConstraintCentrif.ui</file>
<file>ui/ConstraintSectionPrint.ui</file>
<file>ui/ConstraintTie.ui</file>
<file>ui/ElectrostaticPotential.ui</file>
Expand Down
78 changes: 78 additions & 0 deletions src/Mod/Fem/Gui/Resources/icons/FEM_ConstraintCentrif.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
131 changes: 131 additions & 0 deletions src/Mod/Fem/Gui/Resources/ui/ConstraintCentrif.ui
@@ -0,0 +1,131 @@
<?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>Centrif 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="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>4</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="l_rotation_frequency">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Rotation frequency f&lt;sub&gt;rot&lt;/sub&gt; [rps]</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="indent">
<number>-1</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::InputField" name="if_rotation_frequency">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="toolTip">
<string>revolutions per second</string>
</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>1/s</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>
<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>
2 changes: 2 additions & 0 deletions src/Mod/Fem/Gui/Workbench.cpp
Expand Up @@ -142,6 +142,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
<< "Separator"
<< "FEM_ConstraintForce"
<< "FEM_ConstraintPressure"
<< "FEM_ConstraintCentrif"
<< "FEM_ConstraintSelfWeight";

Gui::ToolBarItem* thermal = new Gui::ToolBarItem(root);
Expand Down Expand Up @@ -267,6 +268,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
<< "Separator"
<< "FEM_ConstraintForce"
<< "FEM_ConstraintPressure"
<< "FEM_ConstraintCentrif"
<< "FEM_ConstraintSelfWeight";

Gui::MenuItem* thermal = new Gui::MenuItem;
Expand Down
15 changes: 15 additions & 0 deletions src/Mod/Fem/ObjectsFem.py
Expand Up @@ -98,6 +98,21 @@ def makeConstraintBodyHeatSource(
return obj


def makeConstraintCentrif(
doc,
name="ConstraintCentrif"
):
"""makeConstraintCentrif(document, [name]):
creates a centrif object to define centrifugal body load constraint"""
obj = doc.addObject("Fem::ConstraintPython", name)
from femobjects import constraint_centrif
constraint_centrif.ConstraintCentrif(obj)
if FreeCAD.GuiUp:
from femviewprovider import view_constraint_centrif
view_constraint_centrif.VPConstraintCentrif(obj.ViewObject)
return obj


def makeConstraintContact(
doc,
name="ConstraintContact"
Expand Down
15 changes: 15 additions & 0 deletions src/Mod/Fem/femcommands/commands.py
Expand Up @@ -162,6 +162,17 @@ def __init__(self):
self.do_activated = "add_obj_on_gui_noset_edit"


class _ConstraintCentrif(CommandManager):
"The FEM_ConstraintCentrif command definition"

def __init__(self):
super(_ConstraintCentrif, self).__init__()
self.menuetext = "Constraint centrif"
self.tooltip = "Creates a FEM constraint centrif"
self.is_active = "with_analysis"
self.do_activated = "add_obj_on_gui_set_edit"


class _ConstraintElectrostaticPotential(CommandManager):
"The FEM_ConstraintElectrostaticPotential command definition"

Expand Down Expand Up @@ -815,6 +826,10 @@ def __init__(self):
"FEM_ConstraintBodyHeatSource",
_ConstraintBodyHeatSource()
)
FreeCADGui.addCommand(
"FEM_ConstraintCentrif",
_ConstraintCentrif()
)
FreeCADGui.addCommand(
"FEM_ConstraintElectrostaticPotential",
_ConstraintElectrostaticPotential()
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Fem/femmesh/meshtools.py
Expand Up @@ -745,6 +745,8 @@ def get_elset_short_name(
return "F" + str(i)
elif is_of_type(obj, "Fem::ElementGeometry2D"):
return "S" + str(i)
elif is_of_type(obj, "Fem::ConstraintCentrif"):
return "C" + str(i)
else:
FreeCAD.Console.PrintError(
"Error in creating short elset name "
Expand Down
57 changes: 57 additions & 0 deletions src/Mod/Fem/femobjects/constraint_centrif.py
@@ -0,0 +1,57 @@
# ***************************************************************************
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * 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__ = "FreeCAD FEM constraint centrif document object"
__author__ = "Bernd Hahnebach"
__url__ = "https://www.freecadweb.org"

## @package constraint_centrif
# \ingroup FEM
# \brief constraint centrif object

from . import base_fempythonobject


class ConstraintCentrif(base_fempythonobject.BaseFemPythonObject):
"""
The ConstraintCentrif object
"""

Type = "Fem::ConstraintCentrif"

def __init__(self, obj):
super(ConstraintCentrif, self).__init__(obj)

obj.addProperty(
"App::PropertyFrequency",
"RotationFrequency",
"Constraint CENTRIF",
"set rotation frequency f<sub>rot"
)

obj.addProperty(
"App::PropertyLinkSubList",
"AxisReference",
"Constraint CENTRIF",
"set line as axis of rotation"
)

0 comments on commit 557be14

Please sign in to comment.