- Mesh.unv.zip
- (83.15 KiB) Downloaded 54 times
mesh region
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
Re: mesh region
This one is the one made with freecad. I can't post the meshes made with Salome because they are 384 Mb each one. I'll make some smaller ones and post them.
Re: mesh region
Brnd, here are the files:
I have to make a correction I noted that in Data/Property tab there are listed 4 groups after import (I believe two should probably be the nodesets)
The first made with Salome, the later imported and exported with freecad. I have to make a correction I noted that in Data/Property tab there are listed 4 groups after import (I believe two should probably be the nodesets)
Re: mesh region
If a mesh is imported, no FreeCAD FEM mesh group objects (which will generate mesh groups on meshing) are created, but the mesh group data of the unv will be imported and is visible as you mentioned in the Data/Property tab. By python you have full access to all this data.
But more interesting to me is:
Does this unv exported from FreeCAD works together with CalculiX luncher?
Re: mesh region
Yes the one exported from freecad works. It shows two groups and a certain quantity of submesh/nodeset. The two groups do have different names but occupy the same face. Probably I did wrong something on Salome Meca
Re: mesh region
import the unv exported with Salome and play with Python in FreeCAD ...bernd wrote: ↑Wed Jul 03, 2019 3:23 pmIf a mesh is imported, no FreeCAD FEM mesh group objects (which will generate mesh groups on meshing) are created, but the mesh group data of the unv will be imported and is visible as you mentioned in the Data/Property tab. By python you have full access to all this data.
Code: Select all
mesh = App.ActiveDocument.Mesh_from_Salome.FemMesh
for g in mesh.Groups:
mesh.getGroupName(g)
mesh.getGroupElementType(g)
mesh.getGroupElements(g)
# for some reason the groups are saved twice ... means we are only interested in Face group with ID 0 and Node group ID 2
# I assume the nodes are the nodes of the faces group ... We will gone check this ...
# get all nodes for the faces group
grfaces = mesh.getGroupElements(0)
grnodes = mesh.getGroupElements(2)
nodes_of_grfaces = []
for f in grfaces:
nodes_of_grfaces += list(mesh.getElementNodes(f))
nodes_of_grfaces = tuple(sorted(list(set(nodes_of_grfaces))))
if nodes_of_grfaces == grnodes:
print('The Node group ID 2 are the nodes of the Faces from Face group with ID 0')
# YEAH ... :-) q.e.d
# Lets make a mesh out of it to see what Faces are in Face group with ID 0
import Fem
grmesh = Fem.FemMesh()
for n in grnodes:
nvec = mesh.getNodeById(n)
grmesh.addNode(nvec.x, nvec.y, nvec.z, n)
for f in grfaces:
mesh.getElementNodes(f)
grmesh.addFace(list(mesh.getElementNodes(f)), f)
Fem.show(grmesh)
Re: mesh region
since we have all informations, lets make the mesh with FreeCAD, print some informations and export it to unv ...
informations:
Would you be so kind and test this unv in CalculiX luncher ?
informations:
Code: Select all
mesh = App.ActiveDocument.FEMMeshGmsh.FemMesh
for g in mesh.Groups:
mesh.getGroupName(g)
mesh.getGroupElementType(g)
mesh.getGroupElements(g)
Code: Select all
>>>
>>> mesh = App.ActiveDocument.FEMMeshGmsh.FemMesh
>>>
>>> for g in mesh.Groups:
... mesh.getGroupName(g)
... mesh.getGroupElementType(g)
... mesh.getGroupElements(g)
...
'FEMMeshGroup'
'Face'
(593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696)
>>>
>>>
Would you be so kind and test this unv in CalculiX luncher ?
Re: mesh region
Sorry, I can't
when running it says
However when I input Mesh_from_Salome.unv.txt in Calculix launcher it shows two groups
when running
Code: Select all
>>>
>>> mesh = App.ActiveDocument.FEMMeshGmsh.FemMesh
>>>
>>> for g in mesh.Groups:
... mesh.getGroupName(g)
... mesh.getGroupElementType(g)
... mesh.getGroupElements(g)
...
'FEMMeshGroup'
'Face'
(593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696)
>>>
>>>
,File "<input>", line 5
mesh = App.ActiveDocument.FEMMeshGmsh.FemMesh
^
SyntaxError: invalid syntax
However when I input Mesh_from_Salome.unv.txt in Calculix launcher it shows two groups
Re: mesh region
you get an syntax error on
?
Code: Select all
mesh = App.ActiveDocument.FEMMeshGmsh.FemMesh