Skip to content

Commit

Permalink
FEM: material object, move make def into make objects FEM module
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach authored and wwmayer committed Feb 21, 2017
1 parent feae651 commit de9b534
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 67 deletions.
1 change: 0 additions & 1 deletion src/Mod/Fem/App/CMakeLists.txt
Expand Up @@ -134,7 +134,6 @@ SET(FemScripts_SRCS
FemTools.py
FemToolsCcx.py
FemToolsZ88.py
FemMaterial.py
FemSelectionObserver.py
ObjectsFem.py
TestFem.py
Expand Down
1 change: 0 additions & 1 deletion src/Mod/Fem/CMakeLists.txt
Expand Up @@ -87,7 +87,6 @@ INSTALL(
_ViewProviderFemConstraintSelfWeight.py
_CommandConstraintSelfWeight.py

FemMaterial.py
_FemMaterial.py
_ViewProviderFemMaterial.py
_CommandMaterialSolid.py
Expand Down
60 changes: 0 additions & 60 deletions src/Mod/Fem/FemMaterial.py

This file was deleted.

27 changes: 27 additions & 0 deletions src/Mod/Fem/ObjectsFem.py
Expand Up @@ -95,6 +95,33 @@ def makeShellThickness(thickness=20.0, name="ShellThickness"):
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 ##########
def makeMechanicalResult(name="MechanicalResult"):
'''makeMechanicalResult(name): creates an mechanical object result to hold FEM results'''
Expand Down
5 changes: 2 additions & 3 deletions src/Mod/Fem/TestFem.py
Expand Up @@ -28,7 +28,6 @@
import FemToolsCcx
import FreeCAD
import ObjectsFem
import FemMaterial
import csv
import tempfile
import unittest
Expand Down Expand Up @@ -114,7 +113,7 @@ def create_new_mesh(self):
self.active_doc.recompute()

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['Name'] = "Steel-Generic"
mat['YoungsModulus'] = "200000 MPa"
Expand Down Expand Up @@ -335,7 +334,7 @@ def create_new_mesh(self):
self.active_doc.recompute()

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['Name'] = "Steel-Generic"
mat['YoungsModulus'] = "200000 MPa"
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Fem/_CommandMaterialSolid.py
Expand Up @@ -49,8 +49,8 @@ def Activated(self):
if FreeCAD.ActiveDocument is not femDoc:
FreeCADGui.setActiveDocument(femDoc)
FreeCAD.ActiveDocument.openTransaction("Create Solid Material")
FreeCADGui.addModule("FemMaterial")
FreeCADGui.doCommand("FemMaterial.makeSolidMaterial('SolidMaterial')")
FreeCADGui.addModule("ObjectsFem")
FreeCADGui.doCommand("ObjectsFem.makeMaterialSolid('SolidMaterial')")
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)")

Expand Down

0 comments on commit de9b534

Please sign in to comment.