FEM: Python objects and guiobjects, code formating

This commit is contained in:
Bernd Hahnebach
2020-03-03 21:04:56 +01:00
parent d233c2e957
commit 2cf8c17102
35 changed files with 267 additions and 162 deletions

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2017 Markus Hovorka <m.hovorka@live.de> *
# * Copyright (c) 2018 Bernd Hahnebach <bernd@bimstatik.org> *
# * *

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2017 Markus Hovorka <m.hovorka@live.de> *
# * Copyright (c) 2018 Bernd Hahnebach <bernd@bimstatik.org> *
# * *

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2017 Markus Hovorka <m.hovorka@live.de> *
# * *
# * This program is free software; you can redistribute it and/or modify *

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2017 Markus Hovorka <m.hovorka@live.de> *
# * *
# * This program is free software; you can redistribute it and/or modify *

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2017 Markus Hovorka <m.hovorka@live.de> *
# * *
# * This program is free software; you can redistribute it and/or modify *

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2016 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -32,7 +31,9 @@ from . import ViewProviderFemConstraint
class _ViewProviderFemConstraintSelfWeight(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemConstraintSelfWeight object"
"""
A View Provider for the FemConstraintSelfWeight object"
"""
def getIcon(self):
return ":/icons/fem-constraint-selfweight.svg"

View File

@@ -1,6 +1,5 @@
# ***************************************************************************
# * *
# * Copyright (c) 2015 Bernd Hahnebach <bernd@bimstatik.org> *
# * Copyright (c) 2020 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) *
@@ -30,15 +29,18 @@ __url__ = "http://www.freecadweb.org"
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
# for the panel
from PySide import QtCore, QtGui
from PySide import QtCore
from PySide import QtGui
from . import FemSelectionWidgets
from . import ViewProviderFemConstraint
class _ViewProviderFemConstraintTie(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemConstraintTie object"
"""
A View Provider for the FemConstraintTie object
"""
def getIcon(self):
return ":/icons/fem-constraint-tie.svg"
@@ -48,12 +50,14 @@ class _ViewProviderFemConstraintTie(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemConstraintTie
_TaskPanel
)
class _TaskPanelFemConstraintTie:
"""The TaskPanel for editing References property of FemConstraintTie objects"""
class _TaskPanel:
"""
The TaskPanel for editing References property of FemConstraintTie objects
"""
def __init__(self, obj):

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2016 Ofentse Kgoa <kgoaot@eskom.co.za> *
# * Copyright (c) 2018 Bernd Hahnebach <bernd@bimstatik.org> *
# * Based on the FemElementGeometry1D by Bernd Hahnebach *
@@ -32,17 +31,19 @@ __url__ = "http://www.freecadweb.org"
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
# for the panel
from femobjects import _FemElementFluid1D
from PySide import QtCore
from PySide import QtGui
from . import FemSelectionWidgets
from . import ViewProviderFemConstraint
from femobjects import _FemElementFluid1D
class _ViewProviderFemElementFluid1D(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemElementFluid1D object"
"""
A View Provider for the FemElementFluid1D object
"""
def getIcon(self):
return ":/icons/fem-element-fluid-1d.svg"
@@ -52,12 +53,14 @@ class _ViewProviderFemElementFluid1D(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemElementFluid1D
_TaskPanel
)
class _TaskPanelFemElementFluid1D:
"""The TaskPanel for editing References property of FemElementFluid1D objects"""
class _TaskPanel:
"""
The TaskPanel for editing References property of FemElementFluid1D objects
"""
def __init__(self, obj):

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2015 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -30,16 +29,18 @@ __url__ = "http://www.freecadweb.org"
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
# for the panel
from femobjects import _FemElementGeometry1D
from PySide import QtCore
from . import FemSelectionWidgets
from . import ViewProviderFemConstraint
from femobjects import _FemElementGeometry1D
class _ViewProviderFemElementGeometry1D(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemElementGeometry1D object"
"""
A View Provider for the FemElementGeometry1D object
"""
def getIcon(self):
return ":/icons/fem-element-geometry-1d.svg"
@@ -49,12 +50,14 @@ class _ViewProviderFemElementGeometry1D(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemElementGeometry1D
_TaskPanel
)
class _TaskPanelFemElementGeometry1D:
"""The TaskPanel for editing References property of FemElementGeometry1D objects"""
class _TaskPanel:
"""
The TaskPanel for editing References property of FemElementGeometry1D objects
"""
def __init__(self, obj):

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2015 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -31,15 +30,16 @@ __url__ = "http://www.freecadweb.org"
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
# for the panel
from PySide import QtCore
from . import FemSelectionWidgets
from . import ViewProviderFemConstraint
class _ViewProviderFemElementGeometry2D(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemElementGeometry2D object"
"""
A View Provider for the FemElementGeometry2D object
"""
def getIcon(self):
return ":/icons/fem-element-geometry-2d.svg"
@@ -49,12 +49,14 @@ class _ViewProviderFemElementGeometry2D(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemElementGeometry2D
_TaskPanel
)
class _TaskPanelFemElementGeometry2D:
"""The TaskPanel for editing References property of FemElementGeometry2D objects"""
class _TaskPanel:
"""
The TaskPanel for editing References property of FemElementGeometry2D objects
"""
def __init__(self, obj):

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2017 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -30,15 +29,17 @@ __url__ = "http://www.freecadweb.org"
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
# for the panel
from PySide import QtCore
from . import FemSelectionWidgets
from . import ViewProviderFemConstraint
class _ViewProviderFemElementRotation1D(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemElementRotation1D object"
"""
A View Provider for the FemElementRotation1D object
"""
def getIcon(self):
return ":/icons/fem-element-rotation-1d.svg"
@@ -50,13 +51,16 @@ class _ViewProviderFemElementRotation1D(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemElementRotation1D
_TaskPanel
)
"""
class _TaskPanelFemElementRotation1D:
"""The TaskPanel for editing References property of FemElementRotation1D objects"""
class _TaskPanel:
"""
The TaskPanel for editing References property of FemElementRotation1D objects
"""
def __init__(self, obj):
self.obj = obj

View File

@@ -28,16 +28,17 @@ __url__ = "http://www.freecadweb.org"
# \ingroup FEM
# \brief FreeCAD FEM _ViewProviderFemMaterial
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
import sys
# for the panel
from FreeCAD import Units
from . import FemSelectionWidgets
from PySide import QtCore
from PySide import QtGui
import sys
import FreeCAD
import FreeCADGui
from FreeCAD import Units
from . import FemSelectionWidgets
from . import ViewProviderFemConstraint
if sys.version_info.major >= 3:
@@ -45,7 +46,9 @@ if sys.version_info.major >= 3:
class _ViewProviderFemMaterial(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemMaterial object"
"""
A View Provider for the FemMaterial object
"""
def getIcon(self):
return ":/icons/fem-material.svg"
@@ -55,12 +58,14 @@ class _ViewProviderFemMaterial(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemMaterial
_TaskPanel
)
class _TaskPanelFemMaterial:
"""The editmode TaskPanel for FemMaterial objects"""
class _TaskPanel:
"""
The editmode TaskPanel for FemMaterial objects
"""
def __init__(self, obj):

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2016 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -32,7 +31,9 @@ from . import ViewProviderFemConstraint
class _ViewProviderFemMaterialMechanicalNonlinear(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemMaterialMechanicalNonlinear object"
"""
A View Provider for the FemMaterialMechanicalNonlinear object
"""
def getIcon(self):
return ":/icons/fem-material-nonlinear.svg"

View File

@@ -27,16 +27,15 @@ __url__ = "http://www.freecadweb.org"
# \ingroup FEM
# \brief FreeCAD FEM _ViewProviderFemMaterialReinforced
import sys
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
# task panel
# from . import FemSelectionWidgets
from PySide import QtCore
from PySide import QtGui
import sys
from . import ViewProviderFemConstraint
if sys.version_info.major >= 3:
@@ -44,7 +43,9 @@ if sys.version_info.major >= 3:
class _ViewProviderFemMaterialReinforced(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemMaterialReinfocement object"
"""
A View Provider for the FemMaterialReinfocement object
"""
def getIcon(self):
return ":/icons/fem-material-reinforced.svg"
@@ -54,12 +55,14 @@ class _ViewProviderFemMaterialReinforced(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemMaterialReinforced
_TaskPanel
)
class _TaskPanelFemMaterialReinforced:
"""The editmode TaskPanel for FemMaterialReinforced objects"""
class _TaskPanel:
"""
The editmode TaskPanel for FemMaterialReinforced objects
"""
if sys.version_info.major >= 3:
unicode = str

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2016 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -28,17 +27,19 @@ __url__ = "http://www.freecadweb.org"
# \ingroup FEM
# \brief FreeCAD FEM _ViewProviderFemMeshBoundaryLayer
from PySide import QtCore
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
# for the panel
from PySide import QtCore
from . import FemSelectionWidgets
from . import ViewProviderFemConstraint
class _ViewProviderFemMeshBoundaryLayer(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemMeshBoundaryLayer object"
"""
A View Provider for the FemMeshBoundaryLayer object
"""
def getIcon(self):
return ":/icons/fem-femmesh-boundary-layer.svg"
@@ -48,12 +49,14 @@ class _ViewProviderFemMeshBoundaryLayer(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemMeshBoundaryLayer
_TaskPanel
)
class _TaskPanelFemMeshBoundaryLayer:
"""The TaskPanel for editing References property of FemMeshBoundaryLayer objects"""
class _TaskPanel:
"""
The TaskPanel for editing References property of FemMeshBoundaryLayer objects
"""
def __init__(self, obj):

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2016 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -28,17 +27,19 @@ __url__ = "http://www.freecadweb.org"
# \ingroup FEM
# \brief FreeCAD FEM _ViewProviderFemMeshGroup
from PySide import QtCore
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
# for the panel
from PySide import QtCore
from . import FemSelectionWidgets
from . import ViewProviderFemConstraint
class _ViewProviderFemMeshGroup(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemMeshGroup object"
"""
A View Provider for the FemMeshGroup object
"""
def getIcon(self):
return ":/icons/fem-femmesh-from-shape.svg"
@@ -48,12 +49,14 @@ class _ViewProviderFemMeshGroup(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemMeshGroup
_TaskPanel
)
class _TaskPanelFemMeshGroup:
"""The TaskPanel for editing References property of FemMeshGroup objects"""
class _TaskPanel:
"""
The TaskPanel for editing References property of FemMeshGroup objects
"""
def __init__(self, obj):

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2016 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -28,17 +27,19 @@ __url__ = "http://www.freecadweb.org"
# \ingroup FEM
# \brief FreeCAD FEM _ViewProviderFemMeshRegion
from PySide import QtCore
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
# for the panel
from PySide import QtCore
from . import FemSelectionWidgets
from . import ViewProviderFemConstraint
class _ViewProviderFemMeshRegion(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemMeshRegion object"
"""
A View Provider for the FemMeshRegion object
"""
def getIcon(self):
return ":/icons/fem-femmesh-region.svg"
@@ -48,12 +49,14 @@ class _ViewProviderFemMeshRegion(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemMeshRegion
_TaskPanel
)
class _TaskPanelFemMeshRegion:
"""The TaskPanel for editing References property of FemMeshRegion objects"""
class _TaskPanel:
"""
The TaskPanel for editing References property of FemMeshRegion objects
"""
def __init__(self, obj):

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2017 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -32,7 +31,9 @@ from . import ViewProviderFemConstraint
class _ViewProviderFemMeshResult(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemMeshResult object"
"""
A View Provider for the FemMeshResult object
"""
def getIcon(self):
return ":/icons/fem-femmesh-result.svg"

View File

@@ -1,6 +1,6 @@
# ***************************************************************************
# * *
# * Copyright (c) 2015 Qingfeng Xia <qingfeng.xia()eng.ox.ac.uk> *
# * 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) *
@@ -28,22 +28,25 @@ __url__ = "http://www.freecadweb.org"
# \ingroup FEM
# \brief FreeCAD ViewProvider for mechanical ResultObjectPython in FEM workbench
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
import matplotlib.pyplot as plt
import numpy as np
# for the panel
import femresult.resulttools as resulttools
from PySide import QtCore
from PySide import QtGui
from PySide.QtCore import Qt
from PySide.QtGui import QApplication
import numpy as np
import matplotlib.pyplot as plt
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
import femresult.resulttools as resulttools
class _ViewProviderFemResultMechanical(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemResultObject Python derived FemResult class"
"""
A View Provider for the FemResultObject Python derived FemResult class
"""
def getIcon(self):
"""after load from FCStd file, self.icon does not exist, return constant path instead"""
@@ -54,7 +57,7 @@ class _ViewProviderFemResultMechanical(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemResultShow,
_TaskPanel,
)
# overwrite unsetEdit, because the mesh result obj needs to be hided on task panel exit
@@ -78,8 +81,10 @@ class _ViewProviderFemResultMechanical(ViewProviderFemConstraint.ViewProxy):
return True
class _TaskPanelFemResultShow:
"""The task panel for the post-processing"""
class _TaskPanel:
"""
The task panel for the post-processing
"""
def __init__(self, obj):
self.result_obj = obj
@@ -671,13 +676,6 @@ class _TaskPanelFemResultShow:
# helper
def hide_femmeshes_postpiplines():
# hide all visible FEM mesh objects and VTK FemPostPipeline objects
for o in FreeCAD.ActiveDocument.Objects:
if o.isDerivedFrom("Fem::FemMeshObject") or o.isDerivedFrom("Fem::FemPostPipeline"):
o.ViewObject.hide()
def hide_parts_constraints():
from FemGui import getActiveAnalysis
fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General")

View File

@@ -1,5 +1,4 @@
# ***************************************************************************
# * *
# * Copyright (c) 2015 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -28,25 +27,30 @@ __url__ = "http://www.freecadweb.org"
# \ingroup FEM
# \brief FreeCAD FEM _ViewProviderFemSolverCalculix
import FreeCAD
import FreeCADGui
from . import ViewProviderFemConstraint
import os
import sys
import time
# for the panel
from PySide import QtCore
from PySide import QtGui
from PySide.QtCore import Qt
from PySide.QtGui import QApplication
import os
import time
import sys
import FreeCAD
import FreeCADGui
import FemGui
from . import ViewProviderFemConstraint
if sys.version_info.major >= 3:
def unicode(text, *args):
return str(text)
class _ViewProviderFemSolverCalculix(ViewProviderFemConstraint.ViewProxy):
"A View Provider for the FemSolverCalculix object"
"""
A View Provider for the FemSolverCalculix object
"""
def getIcon(self):
return ":/icons/fem-solver-standard.svg"
@@ -56,13 +60,15 @@ class _ViewProviderFemSolverCalculix(ViewProviderFemConstraint.ViewProxy):
self,
vobj,
mode,
_TaskPanelFemSolverCalculix,
_TaskPanel,
hide_mesh=False
)
class _TaskPanelFemSolverCalculix:
"""The TaskPanel for CalculiX ccx tools solver object"""
class _TaskPanel:
"""
The TaskPanel for CalculiX ccx tools solver object
"""
def __init__(self, solver_object):
self.form = FreeCADGui.PySideUic.loadUi(

View File

@@ -36,6 +36,7 @@ class Proxy(FemConstraint.Proxy):
def __init__(self, obj):
super(Proxy, self).__init__(obj)
obj.addProperty(
"App::PropertyFloat",
"HeatSource",

View File

@@ -31,7 +31,9 @@ from . import FemConstraint
class _FemConstraintSelfWeight(FemConstraint.Proxy):
"The FemConstraintSelfWeight object"
"""
The FemConstraintSelfWeight object"
"""
Type = "Fem::ConstraintSelfWeight"
@@ -44,18 +46,21 @@ class _FemConstraintSelfWeight(FemConstraint.Proxy):
"Gravity",
"Gravity direction: set the x-component of the normalized gravity vector"
)
obj.addProperty(
"App::PropertyFloat",
"Gravity_y",
"Gravity",
"Gravity direction: set the y-component of the normalized gravity vector"
)
obj.addProperty(
"App::PropertyFloat",
"Gravity_z",
"Gravity",
"Gravity direction: set the z-component of the normalized gravity vector"
)
obj.Gravity_x = 0.0
obj.Gravity_y = 0.0
obj.Gravity_z = -1.0

View File

@@ -1,5 +1,5 @@
# ***************************************************************************
# * Copyright (c) 2015 Bernd Hahnebach <bernd@bimstatik.org> *
# * Copyright (c) 2020 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) *
@@ -31,7 +31,9 @@ from . import FemConstraint
class _FemConstraintTie(FemConstraint.Proxy):
"The FemConstraintTie object"
"""
The FemConstraintTie object
"""
Type = "Fem::ConstraintTie"

View File

@@ -1,5 +1,6 @@
# ***************************************************************************
# * Copyright (c) 2016 Ofentse Kgoa <kgoaot@eskom.co.za> *
# * Copyright (c) 2018 Bernd Hahnebach <bernd@bimstatik.org> *
# * Based on the FemElementGeometry1D by Bernd Hahnebach *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -32,9 +33,12 @@ from . import FemConstraint
class _FemElementFluid1D(FemConstraint.Proxy):
"The FemElementFluid1D object"
"""
The FemElementFluid1D object
"""
Type = "Fem::ElementFluid1D"
known_fluid_types = ["Liquid"]
# "Gas", "Open Channel" are not implemented in ccx writer
# known_fluid_types = ["Liquid", "Gas", "Open Channel"]
@@ -56,42 +60,49 @@ class _FemElementFluid1D(FemConstraint.Proxy):
def __init__(self, obj):
super(_FemElementFluid1D, self).__init__(obj)
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"FluidSection",
"List of fluid section shapes"
)
obj.addProperty(
"App::PropertyEnumeration",
"SectionType",
"FluidSection",
"select fluid section type"
)
obj.addProperty(
"App::PropertyEnumeration",
"LiquidSectionType",
"LiquidSection",
"select liquid section type"
)
obj.addProperty(
"App::PropertyArea",
"ManningArea",
"LiquidManning",
"set area of the manning fluid section"
)
obj.addProperty(
"App::PropertyLength",
"ManningRadius",
"LiquidManning",
"set hydraulic radius of manning fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"ManningCoefficient",
"LiquidManning",
"set coefficient of manning fluid section"
)
obj.addProperty(
"App::PropertyArea",
"EnlargeArea1",
@@ -104,168 +115,196 @@ class _FemElementFluid1D(FemConstraint.Proxy):
"LiquidEnlargement",
"set enlarged area of enlargement fluid section"
)
obj.addProperty(
"App::PropertyArea",
"ContractArea1",
"LiquidContraction",
"set initial area of the contraction fluid section"
)
obj.addProperty(
"App::PropertyArea",
"ContractArea2",
"LiquidContraction",
"set contracted area of contraction fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"InletPressure",
"LiquidInlet",
"set inlet pressure for fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"OutletPressure",
"LiquidOutlet",
"set outlet pressure for fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"InletFlowRate",
"LiquidInlet",
"set inlet mass flow rate for fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"OutletFlowRate",
"LiquidOutlet",
"set outlet mass flow rate for fluid section"
)
obj.addProperty(
"App::PropertyBool",
"InletPressureActive",
"LiquidInlet",
"activates or deactivates inlet pressure for fluid section"
)
obj.addProperty(
"App::PropertyBool",
"OutletPressureActive",
"LiquidOutlet",
"activates or deactivates outlet pressure for fluid section"
)
obj.addProperty(
"App::PropertyBool",
"InletFlowRateActive",
"LiquidInlet",
"activates or deactivates inlet flow rate for fluid section"
)
obj.addProperty(
"App::PropertyBool",
"OutletFlowRateActive",
"LiquidOutlet",
"activates or deactivates outlet flow rate for fluid section"
)
obj.addProperty(
"App::PropertyArea",
"EntrancePipeArea",
"LiquidEntrance",
"set the pipe area of the entrance fluid section"
)
obj.addProperty(
"App::PropertyArea",
"EntranceArea",
"LiquidEntrance",
"set the entrance area of the entrance fluid section"
)
obj.addProperty(
"App::PropertyArea",
"DiaphragmPipeArea",
"LiquidDiaphragm",
"set the pipe area of the diaphragm fluid section"
)
obj.addProperty(
"App::PropertyArea",
"DiaphragmArea",
"LiquidDiaphragm",
"set the diaphragm area of the diaphragm fluid section"
)
obj.addProperty(
"App::PropertyArea",
"BendPipeArea",
"LiquidBend",
"set pipe area of the bend fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"BendRadiusDiameter",
"LiquidBend",
"set ratio of bend radius over pipe diameter of the bend fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"BendAngle",
"LiquidBend",
"set bend angle of the bend fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"BendLossCoefficient",
"LiquidBend",
"set loss coefficient of the bend fluid section"
)
obj.addProperty(
"App::PropertyArea",
"GateValvePipeArea",
"LiquidGateValve",
"set pipe area of the gate valve fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"GateValveClosingCoeff",
"LiquidGateValve",
"set closing coefficient of the gate valve fluid section"
)
obj.addProperty(
"App::PropertyFloatList",
"PumpFlowRate",
"LiquidPump",
"set the pump characteristic flow rate of the pump fluid section"
)
obj.addProperty(
"App::PropertyFloatList",
"PumpHeadLoss",
"LiquidPump",
"set the pump characteristic head loss of the pump fluid section"
)
obj.addProperty(
"App::PropertyArea",
"ColebrookeArea",
"LiquidColebrooke",
"set pipe area of the colebrooke fluid section"
)
obj.addProperty(
"App::PropertyLength",
"ColebrookeRadius",
"LiquidColebrooke",
"set hydraulic radius of the colebrooke fluid section"
)
obj.addProperty(
"App::PropertyLength",
"ColebrookeGrainDiameter",
"LiquidColebrooke",
"set grain diameter of the colebrooke fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"ColebrookeFormFactor",
"LiquidColebrooke",
"set coefficient of the colebrooke fluid section"
)
obj.addProperty(
"App::PropertyEnumeration",
"GasSectionType",
"GasSection",
"select gas section type"
)
obj.addProperty(
"App::PropertyEnumeration",
"ChannelSectionType",

View File

@@ -31,54 +31,64 @@ from . import FemConstraint
class _FemElementGeometry1D(FemConstraint.Proxy):
"The FemElementGeometry1D object"
"""
The FemElementGeometry1D object
"""
Type = "Fem::ElementGeometry1D"
known_beam_types = ["Rectangular", "Circular", "Pipe"]
def __init__(self, obj):
super(_FemElementGeometry1D, self).__init__(obj)
obj.addProperty(
"App::PropertyLength",
"RectWidth",
"RectBeamSection",
"set width of the rectangular beam elements"
)
obj.addProperty(
"App::PropertyLength",
"RectHeight",
"RectBeamSection",
"set height of therectangular beam elements"
)
obj.addProperty(
"App::PropertyLength",
"CircDiameter",
"CircBeamSection",
"set diameter of the circular beam elements"
)
obj.addProperty(
"App::PropertyLength",
"PipeDiameter",
"PipeBeamSection",
"set outer diameter of the pipe beam elements"
)
obj.addProperty(
"App::PropertyLength",
"PipeThickness",
"PipeBeamSection",
"set thickness of the pipe beam elements"
)
obj.addProperty(
"App::PropertyEnumeration",
"SectionType",
"BeamSection",
"select beam section type"
)
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"BeamSection",
"List of beam section shapes"
)
obj.SectionType = _FemElementGeometry1D.known_beam_types
obj.SectionType = "Rectangular"

View File

@@ -31,7 +31,9 @@ from . import FemConstraint
class _FemElementGeometry2D(FemConstraint.Proxy):
"The FemElementGeometry2D object"
"""
The FemElementGeometry2D object
"""
Type = "Fem::ElementGeometry2D"
@@ -44,6 +46,7 @@ class _FemElementGeometry2D(FemConstraint.Proxy):
"ShellThickness",
"set thickness of the shell elements"
)
obj.addProperty(
"App::PropertyLinkSubList",
"References",

View File

@@ -31,18 +31,22 @@ from . import FemConstraint
class _FemElementRotation1D(FemConstraint.Proxy):
"The FemElementRotation1D object"
"""
The FemElementRotation1D object
"""
Type = "Fem::ElementRotation1D"
def __init__(self, obj):
super(_FemElementRotation1D, self).__init__(obj)
obj.addProperty(
"App::PropertyAngle",
"Rotation",
"BeamRotation",
"Set the rotation of beam elements"
)
obj.addProperty(
"App::PropertyLinkSubList",
"References",

View File

@@ -1,5 +1,6 @@
# ***************************************************************************
# * Copyright (c) 2013 Juergen Riegel <FreeCAD@juergen-riegel.net> *
# * 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) *
@@ -31,22 +32,27 @@ from . import FemConstraint
class _FemMaterial(FemConstraint.Proxy):
"The FEM Material object"
"""
The FEM Material object
"""
Type = "Fem::Material"
def __init__(self, obj):
super(_FemMaterial, self).__init__(obj)
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"Material",
"List of material shapes"
)
obj.addProperty(
"App::PropertyEnumeration",
"Category",
"Material",
"Material type: fluid or solid"
)
obj.Category = ["Solid", "Fluid"] # used in TaskPanel

View File

@@ -31,7 +31,9 @@ from . import FemConstraint
class _FemMaterialMechanicalNonlinear(FemConstraint.Proxy):
"The FemMaterialMechanicalNonlinear object"
"""
The FemMaterialMechanicalNonlinear object
"""
Type = "Fem::MaterialMechanicalNonlinear"

View File

@@ -31,29 +31,35 @@ from . import FemConstraint
class _FemMaterialReinforced(FemConstraint.Proxy):
"The FemMaterialReinforced object"
"""
The FemMaterialReinforced object
"""
Type = "Fem::MaterialReinforced"
def __init__(self, obj):
super(_FemMaterialReinforced, self).__init__(obj)
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"Material",
"List of material shapes"
)
obj.addProperty(
"App::PropertyMap",
"Reinforcement",
"Composites",
"Reinforcement material properties"
)
obj.addProperty(
"App::PropertyEnumeration",
"Category",
"Material",
"Matrix material properties"
)
obj.Category = ["Solid"]
obj.Category = "Solid"

View File

@@ -31,7 +31,9 @@ from . import FemConstraint
class _FemMeshBoundaryLayer(FemConstraint.Proxy):
"The FemMeshBoundaryLayer object"
"""
The FemMeshBoundaryLayer object
"""
Type = "Fem::FemMeshBoundaryLayer"
@@ -44,7 +46,6 @@ class _FemMeshBoundaryLayer(FemConstraint.Proxy):
"MeshBoundaryLayerProperties",
"set number of inflation layers for this boundary"
)
obj.NumberOfLayers = 3
obj.addProperty(
@@ -61,7 +62,6 @@ class _FemMeshBoundaryLayer(FemConstraint.Proxy):
"MeshBoundaryLayerProperties",
"set growth rate of inflation layers for smooth transition"
)
obj.GrowthRate = 1.5
obj.addProperty(

View File

@@ -31,18 +31,22 @@ from . import FemConstraint
class _FemMeshGroup(FemConstraint.Proxy):
"The FemMeshGroup object"
"""
The FemMeshGroup object
"""
Type = "Fem::FemMeshGroup"
def __init__(self, obj):
super(_FemMeshGroup, self).__init__(obj)
obj.addProperty(
"App::PropertyBool",
"UseLabel",
"MeshGroupProperties",
"The identifier used for export (True: Label, False: Name)"
)
obj.addProperty(
"App::PropertyLinkSubList",
"References",

View File

@@ -31,18 +31,22 @@ from . import FemConstraint
class _FemMeshRegion(FemConstraint.Proxy):
"The FemMeshRegion object"
"""
The FemMeshRegion object
"""
Type = "Fem::FemMeshRegion"
def __init__(self, obj):
super(_FemMeshRegion, self).__init__(obj)
obj.addProperty(
"App::PropertyLength",
"CharacteristicLength",
"MeshRegionProperties",
"set characteristic length of FEM elements for this region"
)
obj.addProperty(
"App::PropertyLinkSubList",
"References",

View File

@@ -31,7 +31,8 @@ from . import FemConstraint
class _FemMeshResult(FemConstraint.Proxy):
"""The Fem::FemMeshObject's Proxy python type, add Result specific object type
"""
The Fem::FemMeshObject's Proxy python type, add Result specific object type
"""
Type = "Fem::FemMeshResult"

View File

@@ -1,5 +1,6 @@
# ***************************************************************************
# * Copyright (c) 2016 Qingfeng Xia <qingfeng.xia()eng.ox.ac.uk> *
# * 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) *
@@ -31,7 +32,8 @@ from . import FemConstraint
class _FemResultMechanical(FemConstraint.Proxy):
"""The Fem::_FemResultMechanical's Proxy python type, add result specific properties
"""
The Fem::_FemResultMechanical's Proxy python type, add result specific properties
"""
Type = "Fem::FemResultMechanical"
@@ -292,18 +294,6 @@ class _FemResultMechanical(FemConstraint.Proxy):
zero_list = 26 * [0]
obj.Stats = zero_list
# standard Feature methods
def execute(self, obj):
""""this method is executed on object creation and
whenever the document is recomputed"
update Part or Mesh should NOT lead to recomputation
of the analysis automatically, time consuming
"""
return
def onChanged(self, obj, prop):
return
def onDocumentRestored(self, obj):
# migrate old result objects, because property "StressValues"
# was renamed to "vonMises" in commit 8b68ab7
@@ -325,10 +315,3 @@ class _FemResultMechanical(FemConstraint.Proxy):
for i in range(12, -1, -1):
del temp[3 * i + 1]
obj.Stats = temp
def __getstate__(self):
return self.Type
def __setstate__(self, state):
if state:
self.Type = state