FEM: mesh package, move all mesh modules in new mesh package
This commit is contained in:
@@ -71,10 +71,7 @@ SOURCE_GROUP("Module" FILES ${Mod_SRCS})
|
||||
SET(FemScripts_SRCS
|
||||
Init.py
|
||||
InitGui.py
|
||||
FemGmshTools.py
|
||||
FemInputWriter.py
|
||||
FemMesh2Mesh.py
|
||||
FemMeshTools.py
|
||||
FemResultTools.py
|
||||
FemToolsCcx.py
|
||||
ObjectsFem.py
|
||||
@@ -122,6 +119,13 @@ SET(FemInterfaces_SRCS
|
||||
feminterface/writeFenicsXML.py
|
||||
)
|
||||
|
||||
SET(FemMesh_SRCS
|
||||
femmesh/__init__.py
|
||||
femmesh/femmesh2mesh.py
|
||||
femmesh/gmshtools.py
|
||||
femmesh/meshtools.py
|
||||
)
|
||||
|
||||
SET(FemSolver_SRCS
|
||||
femsolver/__init__.py
|
||||
femsolver/solverbase.py
|
||||
@@ -389,6 +393,7 @@ fc_target_copy_resource(Fem
|
||||
${FemScripts_SRCS}
|
||||
${FemObjectsScripts_SRCS}
|
||||
${FemInterfaces_SRCS}
|
||||
${FemMesh_SRCS}
|
||||
${FemGuiScripts_SRCS}
|
||||
${FemTests_SRCS}
|
||||
${FemTestsElmer_SRCS}
|
||||
|
||||
@@ -19,10 +19,7 @@ INSTALL(
|
||||
FILES
|
||||
Init.py
|
||||
InitGui.py
|
||||
FemGmshTools.py
|
||||
FemInputWriter.py
|
||||
FemMesh2Mesh.py
|
||||
FemMeshTools.py
|
||||
FemResultTools.py
|
||||
FemToolsCcx.py
|
||||
ObjectsFem.py
|
||||
@@ -77,6 +74,16 @@ INSTALL(
|
||||
Mod/Fem/feminterface
|
||||
)
|
||||
|
||||
INSTALL(
|
||||
FILES
|
||||
femmesh/__init__.py
|
||||
femmesh/femmesh2mesh.py
|
||||
femmesh/gmshtools.py
|
||||
femmesh/meshtools.py
|
||||
DESTINATION
|
||||
Mod/Fem/femmesh
|
||||
)
|
||||
|
||||
INSTALL(
|
||||
FILES
|
||||
femsolver/__init__.py
|
||||
|
||||
@@ -28,7 +28,7 @@ __url__ = "http://www.freecadweb.org"
|
||||
# @{
|
||||
|
||||
import FreeCAD
|
||||
import FemMeshTools
|
||||
import femmesh.meshtools as FemMeshTools
|
||||
import os
|
||||
|
||||
|
||||
|
||||
@@ -803,7 +803,7 @@ def get_refshape_type(fem_doc_object):
|
||||
# in GUI defined material_obj could have no RefShape and RefShapes could be different type
|
||||
# we're going to need the RefShapes to be the same type inside one fem_doc_object
|
||||
# TODO: check if all RefShapes inside the object really have the same type
|
||||
import FemMeshTools
|
||||
import femmesh.meshtools as FemMeshTools
|
||||
if hasattr(fem_doc_object, 'References') and fem_doc_object.References:
|
||||
first_ref_obj = fem_doc_object.References[0]
|
||||
first_ref_shape = FemMeshTools.get_element(first_ref_obj[0], first_ref_obj[1][0])
|
||||
|
||||
@@ -50,8 +50,8 @@ class _CommandFemMesh2Mesh(FemCommands):
|
||||
if (len(sel) == 1):
|
||||
if(sel[0].isDerivedFrom("Fem::FemMeshObject")):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Mesh from FEMMesh")
|
||||
FreeCADGui.addModule("FemMesh2Mesh")
|
||||
FreeCADGui.doCommand("out_mesh = FemMesh2Mesh.femmesh_2_mesh(App.ActiveDocument." + sel[0].Name + ".FemMesh)")
|
||||
FreeCADGui.addModule("femmesh.femmesh2mesh")
|
||||
FreeCADGui.doCommand("out_mesh = femmesh.femmesh2mesh.femmesh_2_mesh(App.ActiveDocument." + sel[0].Name + ".FemMesh)")
|
||||
FreeCADGui.addModule("Mesh")
|
||||
FreeCADGui.doCommand("Mesh.show(Mesh.Mesh(out_mesh))")
|
||||
FreeCADGui.doCommand("App.ActiveDocument." + sel[0].Name + ".ViewObject.hide()")
|
||||
@@ -68,8 +68,8 @@ class _CommandFemMesh2Mesh(FemCommands):
|
||||
res = sel[0]
|
||||
if femmesh and res:
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Mesh from FEMMesh")
|
||||
FreeCADGui.addModule("FemMesh2Mesh")
|
||||
FreeCADGui.doCommand("out_mesh = FemMesh2Mesh.femmesh_2_mesh(App.ActiveDocument." + femmesh.Name + ".FemMesh, App.ActiveDocument." + res.Name + ")")
|
||||
FreeCADGui.addModule("femmesh.femmesh2mesh")
|
||||
FreeCADGui.doCommand("out_mesh = femmesh.femmesh2mesh.femmesh_2_mesh(App.ActiveDocument." + femmesh.Name + ".FemMesh, App.ActiveDocument." + res.Name + ")")
|
||||
FreeCADGui.addModule("Mesh")
|
||||
FreeCADGui.doCommand("Mesh.show(Mesh.Mesh(out_mesh))")
|
||||
FreeCADGui.doCommand("App.ActiveDocument." + femmesh.Name + ".ViewObject.hide()")
|
||||
|
||||
@@ -148,7 +148,7 @@ class _TaskPanelFemMaterial:
|
||||
self.references.append((ref[0], elem))
|
||||
|
||||
def has_equal_references_shape_types(self):
|
||||
import FemMeshTools
|
||||
import femmesh.meshtools as FemMeshTools
|
||||
ref_shty = ''
|
||||
for ref in self.references:
|
||||
r = FemMeshTools.get_element(ref[0], ref[1]) # the method getElement(element) does not return Solid elements
|
||||
|
||||
@@ -137,8 +137,8 @@ class _TaskPanelFemMeshGmsh:
|
||||
self.gmsh_runs = True
|
||||
self.console_log("We are going to start ...")
|
||||
self.get_active_analysis()
|
||||
import FemGmshTools
|
||||
gmsh_mesh = FemGmshTools.FemGmshTools(self.obj, self.analysis)
|
||||
import femmesh.gmshtools as gmshtools
|
||||
gmsh_mesh = gmshtools.GmshTools(self.obj, self.analysis)
|
||||
self.console_log("Start Gmsh ...")
|
||||
error = ''
|
||||
try:
|
||||
|
||||
@@ -71,7 +71,7 @@ def export(objectslist, filename):
|
||||
FreeCAD.Console.PrintError("No FEM mesh object selected.\n")
|
||||
return
|
||||
femnodes_mesh = obj.FemMesh.Nodes
|
||||
import FemMeshTools
|
||||
import femmesh.meshtools as FemMeshTools
|
||||
femelement_table = FemMeshTools.get_femelement_table(obj.FemMesh)
|
||||
z88_element_type = get_z88_element_type(obj.FemMesh, femelement_table)
|
||||
f = pyopen(filename, "wb")
|
||||
@@ -399,7 +399,7 @@ def write_z88_mesh_to_file(femnodes_mesh, femelement_table, z88_element_type, f)
|
||||
|
||||
# Helper
|
||||
def get_z88_element_type(femmesh, femelement_table=None):
|
||||
import FemMeshTools
|
||||
import femmesh.meshtools as FemMeshTools
|
||||
if not femmesh:
|
||||
print("Error: No femmesh!")
|
||||
if not femelement_table:
|
||||
|
||||
0
src/Mod/Fem/femmesh/__init__.py
Normal file
0
src/Mod/Fem/femmesh/__init__.py
Normal file
@@ -38,8 +38,8 @@ load FreeCADs 3D FEM example from Start Workbench
|
||||
|
||||
femmesh = App.ActiveDocument.getObject("Box_Mesh").FemMesh
|
||||
result = App.ActiveDocument.getObject("CalculiX_static_results")
|
||||
import FemMesh2Mesh
|
||||
out_mesh = FemMesh2Mesh.femmesh_2_mesh(femmesh, result)
|
||||
import femmesh.femmesh2mesh
|
||||
out_mesh = femmesh.femmesh2mesh.femmesh_2_mesh(femmesh, result)
|
||||
import Mesh
|
||||
Mesh.show(Mesh.Mesh(out_mesh))
|
||||
|
||||
@@ -29,14 +29,14 @@ __url__ = "http://www.freecadweb.org"
|
||||
|
||||
import FreeCAD
|
||||
import Fem
|
||||
import FemMeshTools
|
||||
from . import meshtools as FemMeshTools
|
||||
from FreeCAD import Units
|
||||
import subprocess
|
||||
import tempfile
|
||||
from platform import system
|
||||
|
||||
|
||||
class FemGmshTools():
|
||||
class GmshTools():
|
||||
def __init__(self, gmsh_mesh_obj, analysis=None):
|
||||
self.mesh_obj = gmsh_mesh_obj
|
||||
if analysis:
|
||||
@@ -251,7 +251,7 @@ class _Container(object):
|
||||
# in GUI defined material_obj could have no RefShape and RefShapes could be different type
|
||||
# we gone need the RefShapes to be the same type inside one fem_doc_object
|
||||
# TODO here: check if all RefShapes inside the object really have the same type
|
||||
import FemMeshTools
|
||||
import femmesh.meshtools as FemMeshTools
|
||||
if hasattr(fem_doc_object, 'References') and fem_doc_object.References:
|
||||
first_ref_obj = fem_doc_object.References[0]
|
||||
first_ref_shape = FemMeshTools.get_element(first_ref_obj[0], first_ref_obj[1][0])
|
||||
|
||||
@@ -32,7 +32,7 @@ import FreeCAD
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import FemMeshTools
|
||||
import femmesh.meshtools as FemMeshTools
|
||||
import FemInputWriter
|
||||
import six
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import tempfile
|
||||
from FreeCAD import Units
|
||||
import Fem
|
||||
import FemUtils
|
||||
import FemGmshTools
|
||||
import femmesh.gmshtools as gmshtools
|
||||
from .. import settings
|
||||
from . import sifio
|
||||
|
||||
@@ -149,7 +149,7 @@ class Writer(object):
|
||||
os.close(geoFd)
|
||||
os.close(unvGmshFd)
|
||||
|
||||
tools = FemGmshTools.FemGmshTools(mesh)
|
||||
tools = gmshtools.GmshTools(mesh)
|
||||
tools.group_elements = {g: [g] for g in groups}
|
||||
tools.group_nodes_export = False
|
||||
tools.ele_length_map = {}
|
||||
|
||||
@@ -249,7 +249,7 @@ class _Container(object):
|
||||
# in GUI defined material_obj could have no RefShape and RefShapes could be different type
|
||||
# we gone need the RefShapes to be the same type inside one fem_doc_object
|
||||
# TODO here: check if all RefShapes inside the object really have the same type
|
||||
import FemMeshTools
|
||||
import femmesh.meshtools as FemMeshTools
|
||||
if hasattr(fem_doc_object, 'References') and fem_doc_object.References:
|
||||
first_ref_obj = fem_doc_object.References[0]
|
||||
first_ref_shape = FemMeshTools.get_element(first_ref_obj[0], first_ref_obj[1][0])
|
||||
|
||||
@@ -28,7 +28,7 @@ __url__ = "http://www.freecadweb.org"
|
||||
# @{
|
||||
|
||||
import FreeCAD
|
||||
import FemMeshTools
|
||||
import femmesh.meshtools as FemMeshTools
|
||||
import feminterface.importZ88Mesh as importZ88Mesh
|
||||
import FemInputWriter
|
||||
|
||||
|
||||
Reference in New Issue
Block a user