Merge remote-tracking branch 'bernd/femtmp'
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 Markus Hovorka <m.hovorka@live.de> *
|
||||
# * Copyright (c) 2018 Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 Markus Hovorka <m.hovorka@live.de> *
|
||||
# * Copyright (c) 2018 Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
@@ -47,6 +46,8 @@ class ViewProxy(object):
|
||||
def attach(self, vobj):
|
||||
default = coin.SoGroup()
|
||||
vobj.addDisplayMode(default, "Default")
|
||||
self.Object = vobj.Object
|
||||
self.ViewObject = vobj
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
"Return a list of display modes."
|
||||
@@ -59,11 +60,27 @@ class ViewProxy(object):
|
||||
def setDisplayMode(self, mode):
|
||||
return mode
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
# needs to be overwritten if task panel exists
|
||||
# avoid edit mode by return False
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=12139&start=10#p161062
|
||||
return False
|
||||
def setEdit(self, vobj, mode=0, TaskPanel=None, hide_mesh=True):
|
||||
if TaskPanel is None:
|
||||
# avoid edit mode by return False
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=12139&start=10#p161062
|
||||
return False
|
||||
if hide_mesh is True:
|
||||
# hide all FEM meshes and VTK FemPostPipeline objects
|
||||
for o in vobj.Object.Document.Objects:
|
||||
if (
|
||||
o.isDerivedFrom("Fem::FemMeshObject")
|
||||
or o.isDerivedFrom("Fem::FemPostPipeline")
|
||||
):
|
||||
o.ViewObject.hide()
|
||||
# show task panel
|
||||
task = TaskPanel(vobj.Object)
|
||||
FreeCADGui.Control.showDialog(task)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
@@ -77,3 +94,9 @@ class ViewProxy(object):
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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,51 +27,13 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM Constraint SelfWeight ViewProvider
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
|
||||
class _ViewProviderFemConstraintSelfWeight:
|
||||
"A View Provider for the FemConstraintSelfWeight object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemConstraintSelfWeight(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemConstraintSelfWeight object"
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-constraint-selfweight.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):
|
||||
# avoid edit mode by return False
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=12139&start=10#p161062
|
||||
return False
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
|
||||
@@ -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,80 +29,35 @@ __url__ = "http://www.freecadweb.org"
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
# for the panel
|
||||
from PySide import QtCore, QtGui
|
||||
from PySide import QtCore
|
||||
from PySide import QtGui
|
||||
|
||||
from . import FemSelectionWidgets
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
|
||||
class _ViewProviderFemConstraintTie:
|
||||
"A View Provider for the FemConstraintTie object"
|
||||
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemConstraintTie(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemConstraintTie object
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-constraint-tie.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
from pivy import coin
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Default")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Default"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Default"
|
||||
|
||||
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
|
||||
taskd = _TaskPanelFemConstraintTie(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_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):
|
||||
|
||||
|
||||
@@ -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,82 +31,36 @@ __url__ = "http://www.freecadweb.org"
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
# for the panel
|
||||
from femobjects import _FemElementFluid1D
|
||||
from PySide import QtCore
|
||||
from PySide import QtGui
|
||||
|
||||
from . import FemSelectionWidgets
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
from . import ViewProviderFemConstraint
|
||||
from femobjects import _FemElementFluid1D
|
||||
|
||||
|
||||
class _ViewProviderFemElementFluid1D:
|
||||
"A View Provider for the FemElementFluid1D object"
|
||||
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemElementFluid1D(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemElementFluid1D object
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-element-fluid-1d.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
from pivy import coin
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Default")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Default"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Default"
|
||||
|
||||
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
|
||||
taskd = _TaskPanelFemElementFluid1D(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_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):
|
||||
|
||||
|
||||
@@ -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,81 +29,35 @@ __url__ = "http://www.freecadweb.org"
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
# for the panel
|
||||
from femobjects import _FemElementGeometry1D
|
||||
from PySide import QtCore
|
||||
|
||||
from . import FemSelectionWidgets
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
from . import ViewProviderFemConstraint
|
||||
from femobjects import _FemElementGeometry1D
|
||||
|
||||
|
||||
class _ViewProviderFemElementGeometry1D:
|
||||
"A View Provider for the FemElementGeometry1D object"
|
||||
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemElementGeometry1D(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemElementGeometry1D object
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-element-geometry-1d.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
from pivy import coin
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Default")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Default"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Default"
|
||||
|
||||
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
|
||||
taskd = _TaskPanelFemElementGeometry1D(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_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):
|
||||
|
||||
|
||||
@@ -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,80 +29,34 @@ __url__ = "http://www.freecadweb.org"
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
# for the panel
|
||||
from PySide import QtCore
|
||||
|
||||
from . import FemSelectionWidgets
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
|
||||
class _ViewProviderFemElementGeometry2D:
|
||||
"A View Provider for the FemElementGeometry2D object"
|
||||
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemElementGeometry2D(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemElementGeometry2D object
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-element-geometry-2d.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
from pivy import coin
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Default")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Default"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Default"
|
||||
|
||||
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
|
||||
taskd = _TaskPanelFemElementGeometry2D(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_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):
|
||||
|
||||
|
||||
@@ -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,87 +29,38 @@ __url__ = "http://www.freecadweb.org"
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
# for the panel
|
||||
from PySide import QtCore
|
||||
|
||||
from . import FemSelectionWidgets
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
|
||||
class _ViewProviderFemElementRotation1D:
|
||||
"A View Provider for the FemElementRotation1D object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemElementRotation1D(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemElementRotation1D object
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-element-rotation-1d.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
from pivy import coin
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Default")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Default"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Default"
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
"""
|
||||
# do not activate the task panel, since rotation with reference shapes is not yet supported
|
||||
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
|
||||
taskd = _TaskPanelFemElementRotation1D(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_TaskPanel
|
||||
)
|
||||
"""
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
# avoid edit mode by return False
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=12139&start=10#p161062
|
||||
return False
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
class _TaskPanel:
|
||||
"""
|
||||
The TaskPanel for editing References property of FemElementRotation1D objects
|
||||
"""
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
|
||||
|
||||
class _TaskPanelFemElementRotation1D:
|
||||
"""The TaskPanel for editing References property of FemElementRotation1D objects"""
|
||||
def __init__(self, obj):
|
||||
|
||||
self.obj = obj
|
||||
|
||||
@@ -28,81 +28,44 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _ViewProviderFemMaterial
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
# for the panel
|
||||
from FreeCAD import Units
|
||||
from . import FemSelectionWidgets
|
||||
from PySide import QtCore
|
||||
from PySide import QtGui
|
||||
import sys
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
from PySide import QtCore
|
||||
from PySide import QtGui
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from FreeCAD import Units
|
||||
|
||||
from . import FemSelectionWidgets
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
|
||||
if sys.version_info.major >= 3:
|
||||
unicode = str
|
||||
|
||||
|
||||
class _ViewProviderFemMaterial:
|
||||
"A View Provider for the FemMaterial object"
|
||||
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemMaterial(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemMaterial object
|
||||
"""
|
||||
|
||||
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):
|
||||
# hide all meshes
|
||||
for o in FreeCAD.ActiveDocument.Objects:
|
||||
if o.isDerivedFrom("Fem::FemMeshObject"):
|
||||
o.ViewObject.hide()
|
||||
# show task panel
|
||||
taskd = _TaskPanelFemMaterial(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
|
||||
# overwrite the doubleClicked of material object python to make sure no other Material taskd
|
||||
# (and thus no selection observer) is still active
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
def setEdit(self, vobj, mode=0):
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_TaskPanel
|
||||
)
|
||||
|
||||
|
||||
class _TaskPanelFemMaterial:
|
||||
"""The editmode TaskPanel for FemMaterial objects"""
|
||||
class _TaskPanel:
|
||||
"""
|
||||
The editmode TaskPanel for FemMaterial objects
|
||||
"""
|
||||
|
||||
def __init__(self, obj):
|
||||
|
||||
|
||||
@@ -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,61 +27,13 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _ViewProviderFemMaterialMechanicalNonlinear
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
from pivy import coin
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
|
||||
class _ViewProviderFemMaterialMechanicalNonlinear:
|
||||
"A View Provider for the FemMaterialMechanicalNonlinear object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemMaterialMechanicalNonlinear(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemMaterialMechanicalNonlinear object
|
||||
"""
|
||||
|
||||
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, "Default")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Default"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Default"
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
# avoid edit mode by return False
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=12139&start=10#p161062
|
||||
return False
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
|
||||
@@ -27,91 +27,42 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _ViewProviderFemMaterialReinforced
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
|
||||
# task panel
|
||||
# from . import FemSelectionWidgets
|
||||
from PySide import QtCore
|
||||
from PySide import QtGui
|
||||
import sys
|
||||
|
||||
False if False else FemGui.__name__ # flake8, dummy FemGui usage, returns "FemGui"
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
|
||||
from PySide import QtCore
|
||||
from PySide import QtGui
|
||||
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
|
||||
if sys.version_info.major >= 3:
|
||||
unicode = str
|
||||
|
||||
|
||||
class _ViewProviderFemMaterialReinforced:
|
||||
"A View Provider for the FemMaterialReinfocement object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemMaterialReinforced(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemMaterialReinfocement object
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-material-reinforced.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
from pivy import coin
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Default")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Default"]
|
||||
|
||||
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()
|
||||
# hide all meshes
|
||||
for o in FreeCAD.ActiveDocument.Objects:
|
||||
if o.isDerivedFrom("Fem::FemMeshObject"):
|
||||
o.ViewObject.hide()
|
||||
# show task panel
|
||||
taskd = _TaskPanelFemMaterialReinforced(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = (
|
||||
"Active Task Dialog found! "
|
||||
"Please close this one before opening a new one!"
|
||||
)
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_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
|
||||
|
||||
@@ -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,82 +27,36 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _ViewProviderFemMeshBoundaryLayer
|
||||
|
||||
from PySide import QtCore
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
# for the panel
|
||||
from PySide import QtCore
|
||||
from . import FemSelectionWidgets
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
|
||||
class _ViewProviderFemMeshBoundaryLayer:
|
||||
"A View Provider for the FemMeshBoundaryLayer object"
|
||||
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemMeshBoundaryLayer(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemMeshBoundaryLayer object
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-femmesh-boundary-layer.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
from pivy import coin
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Default")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Default"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Default"
|
||||
|
||||
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
|
||||
taskd = _TaskPanelFemMeshBoundaryLayer(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_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):
|
||||
|
||||
|
||||
@@ -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,81 +27,36 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _ViewProviderFemMeshGroup
|
||||
|
||||
from PySide import QtCore
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
# for the panel
|
||||
from PySide import QtCore
|
||||
from . import FemSelectionWidgets
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
|
||||
class _ViewProviderFemMeshGroup:
|
||||
"A View Provider for the FemMeshGroup object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemMeshGroup(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemMeshGroup object
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-femmesh-from-shape.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
from pivy import coin
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Default")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Default"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Default"
|
||||
|
||||
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
|
||||
taskd = _TaskPanelFemMeshGroup(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_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):
|
||||
|
||||
|
||||
@@ -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,82 +27,36 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _ViewProviderFemMeshRegion
|
||||
|
||||
from PySide import QtCore
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
|
||||
# for the panel
|
||||
from PySide import QtCore
|
||||
from . import FemSelectionWidgets
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
|
||||
class _ViewProviderFemMeshRegion:
|
||||
"A View Provider for the FemMeshRegion object"
|
||||
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemMeshRegion(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemMeshRegion object
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-femmesh-region.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
from pivy import coin
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Default")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Default"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Default"
|
||||
|
||||
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
|
||||
taskd = _TaskPanelFemMeshRegion(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_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):
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
@@ -28,27 +27,13 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _ViewProviderFemMeshResult
|
||||
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
class _ViewProviderFemMeshResult:
|
||||
"A View Provider for the FemMeshResult object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
class _ViewProviderFemMeshResult(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemMeshResult object
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-femmesh-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 __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
|
||||
@@ -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,84 +28,45 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD ViewProvider for mechanical ResultObjectPython in FEM workbench
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui # needed to display the icons in TreeView
|
||||
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
|
||||
|
||||
|
||||
False if FemGui.__name__ else True # flake8, dummy FemGui usage
|
||||
|
||||
|
||||
class _ViewProviderFemResultMechanical:
|
||||
"A View Provider for the FemResultObject Python derived FemResult class"
|
||||
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemResultMechanical(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
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"""
|
||||
return ":/icons/fem-post-result-show.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):
|
||||
guidoc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
# check if another VP is in edit mode
|
||||
# https://forum.freecadweb.org/viewtopic.php?t=13077#p104702
|
||||
if not guidoc.getInEdit():
|
||||
guidoc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def setEdit(self, vobj, mode=0):
|
||||
if hasattr(self.Object, "Mesh") and self.Object.Mesh:
|
||||
hide_femmeshes_postpiplines()
|
||||
# only show the FEM result mesh
|
||||
self.Object.Mesh.ViewObject.show()
|
||||
taskd = _TaskPanelFemResultShow(self.Object)
|
||||
taskd.obj = vobj.Object
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
else:
|
||||
error_message = "FEM: Result object has no appropriate FEM mesh.\n"
|
||||
FreeCAD.Console.PrintError(error_message)
|
||||
from PySide import QtGui
|
||||
QtGui.QMessageBox.critical(None, "No result object", error_message)
|
||||
return False
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_TaskPanel,
|
||||
)
|
||||
|
||||
# overwrite unsetEdit, because the mesh result obj needs to be hided on task panel exit
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
# hide the mesh after result viewing is finished, but do not reset the coloring
|
||||
self.Object.Mesh.ViewObject.hide()
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
|
||||
def claimChildren(self):
|
||||
return [self.Object.Mesh] # claimChildren needs to return a list !
|
||||
|
||||
@@ -120,8 +81,10 @@ class _ViewProviderFemResultMechanical:
|
||||
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
|
||||
@@ -713,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")
|
||||
|
||||
@@ -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,71 +27,48 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _ViewProviderFemSolverCalculix
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import FemGui
|
||||
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:
|
||||
"A View Provider for the FemSolverCalculix object"
|
||||
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
class _ViewProviderFemSolverCalculix(ViewProviderFemConstraint.ViewProxy):
|
||||
"""
|
||||
A View Provider for the FemSolverCalculix object
|
||||
"""
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-solver-standard.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):
|
||||
taskd = _TaskPanelFemSolverCalculix(self.Object)
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
return True
|
||||
|
||||
def unsetEdit(self, vobj, mode=0):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
return True
|
||||
|
||||
def doubleClicked(self, vobj):
|
||||
doc = FreeCADGui.getDocument(vobj.Object.Document)
|
||||
if not doc.getInEdit():
|
||||
doc.setEdit(vobj.Object.Name)
|
||||
else:
|
||||
from PySide.QtGui import QMessageBox
|
||||
message = "Active Task Dialog found! Please close this one before opening a new one!"
|
||||
QMessageBox.critical(None, "Error in tree view", message)
|
||||
FreeCAD.Console.PrintError(message + "\n")
|
||||
return True
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
ViewProviderFemConstraint.ViewProxy.setEdit(
|
||||
self,
|
||||
vobj,
|
||||
mode,
|
||||
_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(
|
||||
|
||||
@@ -32,6 +32,6 @@ class Proxy(object):
|
||||
BaseType = "Fem::ConstraintPython"
|
||||
|
||||
def __init__(self, obj):
|
||||
obj.Proxy = self
|
||||
obj.Proxy = self # link between App::DocumentObject to this object
|
||||
|
||||
## @}
|
||||
|
||||
@@ -36,6 +36,7 @@ class Proxy(FemConstraint.Proxy):
|
||||
|
||||
def __init__(self, obj):
|
||||
super(Proxy, self).__init__(obj)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyFloat",
|
||||
"HeatSource",
|
||||
|
||||
@@ -27,33 +27,40 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM constraint self weight object
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
|
||||
class _FemConstraintSelfWeight(FemConstraint.Proxy):
|
||||
"""
|
||||
The FemConstraintSelfWeight object"
|
||||
"""
|
||||
|
||||
Type = "Fem::ConstraintSelfWeight"
|
||||
|
||||
class _FemConstraintSelfWeight:
|
||||
"The FemConstraintSelfWeight object"
|
||||
def __init__(self, obj):
|
||||
super(_FemConstraintSelfWeight, self).__init__(obj)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyFloat",
|
||||
"Gravity_x",
|
||||
"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
|
||||
obj.Proxy = self
|
||||
self.Type = "Fem::ConstraintSelfWeight"
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
@@ -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) *
|
||||
@@ -27,18 +27,22 @@ __url__ = "https://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM constraint tie object
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
|
||||
class _FemConstraintTie(FemConstraint.Proxy):
|
||||
"""
|
||||
The FemConstraintTie object
|
||||
"""
|
||||
|
||||
Type = "Fem::ConstraintTie"
|
||||
|
||||
class _FemConstraintTie:
|
||||
"The FemConstraintTie object"
|
||||
def __init__(self, obj):
|
||||
super(_FemConstraintTie, self).__init__(obj)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyLength",
|
||||
"Tolerance",
|
||||
"Geometry",
|
||||
"set max gap between tied faces"
|
||||
)
|
||||
obj.Proxy = self
|
||||
self.Type = "Fem::ConstraintTie"
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
@@ -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 *
|
||||
@@ -28,9 +29,15 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _FemElementFluid1D
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
class _FemElementFluid1D:
|
||||
"The FemElementFluid1D object"
|
||||
|
||||
class _FemElementFluid1D(FemConstraint.Proxy):
|
||||
"""
|
||||
The FemElementFluid1D object
|
||||
"""
|
||||
|
||||
Type = "Fem::ElementFluid1D"
|
||||
|
||||
known_fluid_types = ["Liquid"]
|
||||
# "Gas", "Open Channel" are not implemented in ccx writer
|
||||
@@ -52,42 +59,50 @@ class _FemElementFluid1D:
|
||||
known_channel_types = ["NONE"]
|
||||
|
||||
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",
|
||||
@@ -100,168 +115,196 @@ class _FemElementFluid1D:
|
||||
"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",
|
||||
@@ -309,8 +352,3 @@ class _FemElementFluid1D:
|
||||
obj.OutletPressureActive = True
|
||||
obj.InletFlowRateActive = False
|
||||
obj.OutletFlowRateActive = False
|
||||
obj.Proxy = self
|
||||
self.Type = "Fem::ElementFluid1D"
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
@@ -27,59 +27,68 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM element geometry 1D object
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
class _FemElementGeometry1D:
|
||||
"The FemElementGeometry1D object"
|
||||
|
||||
class _FemElementGeometry1D(FemConstraint.Proxy):
|
||||
"""
|
||||
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"
|
||||
obj.Proxy = self
|
||||
self.Type = "Fem::ElementGeometry1D"
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
@@ -27,24 +27,29 @@ __url__ = "https://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM element geometry 2D object
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
|
||||
class _FemElementGeometry2D(FemConstraint.Proxy):
|
||||
"""
|
||||
The FemElementGeometry2D object
|
||||
"""
|
||||
|
||||
Type = "Fem::ElementGeometry2D"
|
||||
|
||||
class _FemElementGeometry2D:
|
||||
"The FemElementGeometry2D object"
|
||||
def __init__(self, obj):
|
||||
super(_FemElementGeometry2D, self).__init__(obj)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyLength",
|
||||
"Thickness",
|
||||
"ShellThickness",
|
||||
"set thickness of the shell elements"
|
||||
)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyLinkSubList",
|
||||
"References",
|
||||
"ShellThickness",
|
||||
"List of shell thickness shapes"
|
||||
)
|
||||
obj.Proxy = self
|
||||
self.Type = "Fem::ElementGeometry2D"
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
@@ -27,25 +27,29 @@ __url__ = "https://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM element rotation 1D object
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
class _FemElementRotation1D:
|
||||
"The FemElementRotation1D object"
|
||||
|
||||
class _FemElementRotation1D(FemConstraint.Proxy):
|
||||
"""
|
||||
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",
|
||||
"BeamRotation",
|
||||
"List of beam rotation shapes"
|
||||
)
|
||||
obj.Proxy = self
|
||||
self.Type = "Fem::ElementRotation1D"
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
@@ -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) *
|
||||
@@ -27,25 +28,31 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FEM material
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
|
||||
class _FemMaterial(FemConstraint.Proxy):
|
||||
"""
|
||||
The FEM Material object
|
||||
"""
|
||||
|
||||
Type = "Fem::Material"
|
||||
|
||||
class _FemMaterial:
|
||||
"The FEM Material object"
|
||||
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
|
||||
obj.Proxy = self
|
||||
self.Type = "Fem::Material"
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
obj.Category = ["Solid", "Fluid"] # used in TaskPanel
|
||||
|
||||
@@ -27,12 +27,18 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FEM nonlinear mechanical material object
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
|
||||
class _FemMaterialMechanicalNonlinear(FemConstraint.Proxy):
|
||||
"""
|
||||
The FemMaterialMechanicalNonlinear object
|
||||
"""
|
||||
|
||||
Type = "Fem::MaterialMechanicalNonlinear"
|
||||
|
||||
class _FemMaterialMechanicalNonlinear:
|
||||
"The FemMaterialMechanicalNonlinear object"
|
||||
def __init__(self, obj):
|
||||
obj.Proxy = self
|
||||
self.Type = "Fem::MaterialMechanicalNonlinear"
|
||||
super(_FemMaterialMechanicalNonlinear, self).__init__(obj)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyLink",
|
||||
@@ -74,6 +80,3 @@ class _FemMaterialMechanicalNonlinear:
|
||||
"Set stress and strain for yield point three, separated by a comma."
|
||||
)
|
||||
obj.YieldPoint3 = ""
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
@@ -27,32 +27,39 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _FemMaterialReinforced
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
|
||||
class _FemMaterialReinforced(FemConstraint.Proxy):
|
||||
"""
|
||||
The FemMaterialReinforced object
|
||||
"""
|
||||
|
||||
Type = "Fem::MaterialReinforced"
|
||||
|
||||
class _FemMaterialReinforced:
|
||||
"The FemMaterialReinforced object"
|
||||
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"
|
||||
obj.Proxy = self
|
||||
self.Type = "Fem::MaterialReinforced"
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
@@ -27,13 +27,18 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FEM mesh boundary layer object
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
|
||||
class _FemMeshBoundaryLayer(FemConstraint.Proxy):
|
||||
"""
|
||||
The FemMeshBoundaryLayer object
|
||||
"""
|
||||
|
||||
Type = "Fem::FemMeshBoundaryLayer"
|
||||
|
||||
class _FemMeshBoundaryLayer:
|
||||
"The FemMeshBoundaryLayer object"
|
||||
def __init__(self, obj):
|
||||
self.Type = "Fem::FemMeshBoundaryLayer"
|
||||
self.Object = obj # keep a ref to the DocObj for nonGui usage
|
||||
obj.Proxy = self # link between App::DocumentObject to this object
|
||||
super(_FemMeshBoundaryLayer, self).__init__(obj)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyInteger",
|
||||
@@ -41,7 +46,6 @@ class _FemMeshBoundaryLayer:
|
||||
"MeshBoundaryLayerProperties",
|
||||
"set number of inflation layers for this boundary"
|
||||
)
|
||||
|
||||
obj.NumberOfLayers = 3
|
||||
|
||||
obj.addProperty(
|
||||
@@ -58,7 +62,6 @@ class _FemMeshBoundaryLayer:
|
||||
"MeshBoundaryLayerProperties",
|
||||
"set growth rate of inflation layers for smooth transition"
|
||||
)
|
||||
|
||||
obj.GrowthRate = 1.5
|
||||
|
||||
obj.addProperty(
|
||||
@@ -67,13 +70,3 @@ class _FemMeshBoundaryLayer:
|
||||
"MeshBoundaryLayerShapes",
|
||||
"List of FEM mesh region shapes"
|
||||
)
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
def __getstate__(self):
|
||||
return self.Type
|
||||
|
||||
def __setstate__(self, state):
|
||||
if state:
|
||||
self.Type = state
|
||||
|
||||
@@ -27,24 +27,29 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _FemMeshGroup
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
|
||||
class _FemMeshGroup(FemConstraint.Proxy):
|
||||
"""
|
||||
The FemMeshGroup object
|
||||
"""
|
||||
|
||||
Type = "Fem::FemMeshGroup"
|
||||
|
||||
class _FemMeshGroup:
|
||||
"The FemMeshGroup object"
|
||||
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",
|
||||
"MeshGroupShapes",
|
||||
"List of FEM mesh group shapes"
|
||||
)
|
||||
obj.Proxy = self
|
||||
self.Type = "Fem::FemMeshGroup"
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
@@ -27,24 +27,29 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _FemMeshRegion
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
|
||||
class _FemMeshRegion(FemConstraint.Proxy):
|
||||
"""
|
||||
The FemMeshRegion object
|
||||
"""
|
||||
|
||||
Type = "Fem::FemMeshRegion"
|
||||
|
||||
class _FemMeshRegion:
|
||||
"The FemMeshRegion object"
|
||||
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",
|
||||
"MeshRegionShapes",
|
||||
"List of FEM mesh region shapes"
|
||||
)
|
||||
obj.Proxy = self
|
||||
self.Type = "Fem::FemMeshRegion"
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
@@ -27,22 +27,15 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD FEM _FemMeshResult
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
class _FemMeshResult():
|
||||
"""The Fem::FemMeshObject's Proxy python type, add Result specific object type
|
||||
|
||||
class _FemMeshResult(FemConstraint.Proxy):
|
||||
"""
|
||||
The Fem::FemMeshObject's Proxy python type, add Result specific object type
|
||||
"""
|
||||
|
||||
Type = "Fem::FemMeshResult"
|
||||
|
||||
def __init__(self, obj):
|
||||
self.Type = "Fem::FemMeshResult"
|
||||
self.Object = obj # keep a ref to the DocObj for nonGui usage
|
||||
obj.Proxy = self # link between App::DocumentObject to this object
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
def __getstate__(self):
|
||||
return self.Type
|
||||
|
||||
def __setstate__(self, state):
|
||||
if state:
|
||||
self.Type = state
|
||||
super(_FemMeshResult, self).__init__(obj)
|
||||
|
||||
@@ -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) *
|
||||
@@ -27,14 +28,18 @@ __url__ = "http://www.freecadweb.org"
|
||||
# \ingroup FEM
|
||||
# \brief FreeCAD DocumentObject class to hold mechanical results in FEM workbench
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
class _FemResultMechanical():
|
||||
"""The Fem::_FemResultMechanical's Proxy python type, add result specific properties
|
||||
|
||||
class _FemResultMechanical(FemConstraint.Proxy):
|
||||
"""
|
||||
The Fem::_FemResultMechanical's Proxy python type, add result specific properties
|
||||
"""
|
||||
|
||||
Type = "Fem::FemResultMechanical"
|
||||
|
||||
def __init__(self, obj):
|
||||
self.Type = "Fem::FemResultMechanical"
|
||||
self.Object = obj # keep a ref to the DocObj for nonGui usage
|
||||
obj.Proxy = self # link between App::DocumentObject to this object
|
||||
super(_FemResultMechanical, self).__init__(obj)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyString",
|
||||
@@ -289,18 +294,6 @@ class _FemResultMechanical():
|
||||
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
|
||||
@@ -322,10 +315,3 @@ class _FemResultMechanical():
|
||||
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
|
||||
|
||||
@@ -30,14 +30,17 @@ __url__ = "http://www.freecadweb.org"
|
||||
import FreeCAD
|
||||
from femsolver.calculix.solver import ANALYSIS_TYPES
|
||||
|
||||
from . import FemConstraint
|
||||
|
||||
class _FemSolverCalculix():
|
||||
|
||||
class _FemSolverCalculix(FemConstraint.Proxy):
|
||||
"""The Fem::FemSolver's Proxy python type, add solver specific properties
|
||||
"""
|
||||
|
||||
Type = "Fem::FemSolverCalculixCcxTools"
|
||||
|
||||
def __init__(self, obj):
|
||||
self.Type = "Fem::FemSolverCalculixCcxTools"
|
||||
self.Object = obj # keep a ref to the DocObj for nonGui usage
|
||||
obj.Proxy = self # link between App::DocumentObject to this object
|
||||
super(_FemSolverCalculix, self).__init__(obj)
|
||||
|
||||
# not needed ATM
|
||||
# fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General")
|
||||
@@ -273,13 +276,3 @@ class _FemSolverCalculix():
|
||||
)
|
||||
dimout = ccx_prefs.GetBool("BeamShellOutput", False)
|
||||
obj.BeamShellResultOutput3D = dimout
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
def __getstate__(self):
|
||||
return self.Type
|
||||
|
||||
def __setstate__(self, state):
|
||||
if state:
|
||||
self.Type = state
|
||||
|
||||
Reference in New Issue
Block a user