FEM: material object, move make def into make objects FEM module
This commit is contained in:
parent
feae6513bb
commit
de9b534366
|
@ -134,7 +134,6 @@ SET(FemScripts_SRCS
|
||||||
FemTools.py
|
FemTools.py
|
||||||
FemToolsCcx.py
|
FemToolsCcx.py
|
||||||
FemToolsZ88.py
|
FemToolsZ88.py
|
||||||
FemMaterial.py
|
|
||||||
FemSelectionObserver.py
|
FemSelectionObserver.py
|
||||||
ObjectsFem.py
|
ObjectsFem.py
|
||||||
TestFem.py
|
TestFem.py
|
||||||
|
|
|
@ -87,7 +87,6 @@ INSTALL(
|
||||||
_ViewProviderFemConstraintSelfWeight.py
|
_ViewProviderFemConstraintSelfWeight.py
|
||||||
_CommandConstraintSelfWeight.py
|
_CommandConstraintSelfWeight.py
|
||||||
|
|
||||||
FemMaterial.py
|
|
||||||
_FemMaterial.py
|
_FemMaterial.py
|
||||||
_ViewProviderFemMaterial.py
|
_ViewProviderFemMaterial.py
|
||||||
_CommandMaterialSolid.py
|
_CommandMaterialSolid.py
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
# ***************************************************************************
|
|
||||||
# * *
|
|
||||||
# * Copyright (c) 2013 - Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
|
||||||
# * *
|
|
||||||
# * This program is free software; you can redistribute it and/or modify *
|
|
||||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
|
||||||
# * as published by the Free Software Foundation; either version 2 of *
|
|
||||||
# * the License, or (at your option) any later version. *
|
|
||||||
# * for detail see the LICENCE text file. *
|
|
||||||
# * *
|
|
||||||
# * This program is distributed in the hope that it will be useful, *
|
|
||||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
# * GNU Library General Public License for more details. *
|
|
||||||
# * *
|
|
||||||
# * You should have received a copy of the GNU Library General Public *
|
|
||||||
# * License along with this program; if not, write to the Free Software *
|
|
||||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
|
||||||
# * USA *
|
|
||||||
# * *
|
|
||||||
# ***************************************************************************
|
|
||||||
|
|
||||||
__title__ = "FemMaterial"
|
|
||||||
__author__ = "Juergen Riegel, Bernd Hahnebach"
|
|
||||||
__url__ = "http://www.freecadweb.org"
|
|
||||||
|
|
||||||
## \addtogroup FEM
|
|
||||||
# @{
|
|
||||||
|
|
||||||
import FreeCAD
|
|
||||||
import _FemMaterial
|
|
||||||
|
|
||||||
|
|
||||||
def makeSolidMaterial(name):
|
|
||||||
'''makeSolidMaterial(name): makes an FEM Material for solid
|
|
||||||
'''
|
|
||||||
obj = FreeCAD.ActiveDocument.addObject("App::MaterialObjectPython", name)
|
|
||||||
_FemMaterial._FemMaterial(obj)
|
|
||||||
obj.Category = 'Solid'
|
|
||||||
if FreeCAD.GuiUp:
|
|
||||||
import _ViewProviderFemMaterial
|
|
||||||
_ViewProviderFemMaterial._ViewProviderFemMaterial(obj.ViewObject)
|
|
||||||
# FreeCAD.ActiveDocument.recompute()
|
|
||||||
return obj
|
|
||||||
|
|
||||||
|
|
||||||
def makeFluidMaterial(name):
|
|
||||||
'''makeFluidMaterial(name): makes an FEM Material for fluid
|
|
||||||
'''
|
|
||||||
obj = FreeCAD.ActiveDocument.addObject("App::MaterialObjectPython", name)
|
|
||||||
_FemMaterial._FemMaterial(obj)
|
|
||||||
obj.Category = 'Fluid'
|
|
||||||
if FreeCAD.GuiUp:
|
|
||||||
import _ViewProviderFemMaterial
|
|
||||||
_ViewProviderFemMaterial._ViewProviderFemMaterial(obj.ViewObject)
|
|
||||||
# FreeCAD.ActiveDocument.recompute()
|
|
||||||
return obj
|
|
||||||
|
|
||||||
makeFemMaterial = makeSolidMaterial # alias to be compatible for FemTest.py
|
|
||||||
# @}
|
|
|
@ -95,6 +95,33 @@ def makeShellThickness(thickness=20.0, name="ShellThickness"):
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
########## materials ##########
|
||||||
|
def makeMaterialSolid(name):
|
||||||
|
'''makeMaterialSolid(name): makes an FEM Material for solid'''
|
||||||
|
obj = FreeCAD.ActiveDocument.addObject("App::MaterialObjectPython", name)
|
||||||
|
import _FemMaterial
|
||||||
|
_FemMaterial._FemMaterial(obj)
|
||||||
|
obj.Category = 'Solid'
|
||||||
|
if FreeCAD.GuiUp:
|
||||||
|
import _ViewProviderFemMaterial
|
||||||
|
_ViewProviderFemMaterial._ViewProviderFemMaterial(obj.ViewObject)
|
||||||
|
# FreeCAD.ActiveDocument.recompute()
|
||||||
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
def makeMaterialFluid(name):
|
||||||
|
'''makeMaterialFluid(name): makes an FEM Material for fluid'''
|
||||||
|
obj = FreeCAD.ActiveDocument.addObject("App::MaterialObjectPython", name)
|
||||||
|
import _FemMaterial
|
||||||
|
_FemMaterial._FemMaterial(obj)
|
||||||
|
obj.Category = 'Fluid'
|
||||||
|
if FreeCAD.GuiUp:
|
||||||
|
import _ViewProviderFemMaterial
|
||||||
|
_ViewProviderFemMaterial._ViewProviderFemMaterial(obj.ViewObject)
|
||||||
|
# FreeCAD.ActiveDocument.recompute()
|
||||||
|
return obj
|
||||||
|
|
||||||
|
|
||||||
########## results ##########
|
########## results ##########
|
||||||
def makeMechanicalResult(name="MechanicalResult"):
|
def makeMechanicalResult(name="MechanicalResult"):
|
||||||
'''makeMechanicalResult(name): creates an mechanical object result to hold FEM results'''
|
'''makeMechanicalResult(name): creates an mechanical object result to hold FEM results'''
|
||||||
|
|
|
@ -28,7 +28,6 @@ import Fem
|
||||||
import FemToolsCcx
|
import FemToolsCcx
|
||||||
import FreeCAD
|
import FreeCAD
|
||||||
import ObjectsFem
|
import ObjectsFem
|
||||||
import FemMaterial
|
|
||||||
import csv
|
import csv
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
@ -114,7 +113,7 @@ class FemTest(unittest.TestCase):
|
||||||
self.active_doc.recompute()
|
self.active_doc.recompute()
|
||||||
|
|
||||||
def create_new_material(self):
|
def create_new_material(self):
|
||||||
self.new_material_object = FemMaterial.makeFemMaterial('MechanicalMaterial')
|
self.new_material_object = ObjectsFem.makeMaterialSolid('MechanicalMaterial')
|
||||||
mat = self.new_material_object.Material
|
mat = self.new_material_object.Material
|
||||||
mat['Name'] = "Steel-Generic"
|
mat['Name'] = "Steel-Generic"
|
||||||
mat['YoungsModulus'] = "200000 MPa"
|
mat['YoungsModulus'] = "200000 MPa"
|
||||||
|
@ -335,7 +334,7 @@ class TherMechFemTest(unittest.TestCase):
|
||||||
self.active_doc.recompute()
|
self.active_doc.recompute()
|
||||||
|
|
||||||
def create_new_material(self):
|
def create_new_material(self):
|
||||||
self.new_material_object = FemMaterial.makeFemMaterial('MechanicalMaterial')
|
self.new_material_object = ObjectsFem.makeMaterialSolid('MechanicalMaterial')
|
||||||
mat = self.new_material_object.Material
|
mat = self.new_material_object.Material
|
||||||
mat['Name'] = "Steel-Generic"
|
mat['Name'] = "Steel-Generic"
|
||||||
mat['YoungsModulus'] = "200000 MPa"
|
mat['YoungsModulus'] = "200000 MPa"
|
||||||
|
|
|
@ -49,8 +49,8 @@ class _CommandMaterialSolid(FemCommands):
|
||||||
if FreeCAD.ActiveDocument is not femDoc:
|
if FreeCAD.ActiveDocument is not femDoc:
|
||||||
FreeCADGui.setActiveDocument(femDoc)
|
FreeCADGui.setActiveDocument(femDoc)
|
||||||
FreeCAD.ActiveDocument.openTransaction("Create Solid Material")
|
FreeCAD.ActiveDocument.openTransaction("Create Solid Material")
|
||||||
FreeCADGui.addModule("FemMaterial")
|
FreeCADGui.addModule("ObjectsFem")
|
||||||
FreeCADGui.doCommand("FemMaterial.makeSolidMaterial('SolidMaterial')")
|
FreeCADGui.doCommand("ObjectsFem.makeMaterialSolid('SolidMaterial')")
|
||||||
FreeCADGui.doCommand("App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member = App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member + [App.ActiveDocument.ActiveObject]")
|
FreeCADGui.doCommand("App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member = App.activeDocument()." + FemGui.getActiveAnalysis().Name + ".Member + [App.ActiveDocument.ActiveObject]")
|
||||||
FreeCADGui.doCommand("Gui.activeDocument().setEdit(App.ActiveDocument.ActiveObject.Name)")
|
FreeCADGui.doCommand("Gui.activeDocument().setEdit(App.ActiveDocument.ActiveObject.Name)")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user