2D Mesh
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
2D Mesh
In structural engineering field all FEM models are made with 2D and 1D elements. I'm able to import the meshes from the calculation software we use at the office into FreeCAD.
In Fem_Workbench is shown how to make a FEM Mesh using python but only for 3D-meshes
These two posts of Juegen gave some informations about FEM-module.
viewtopic.php?f=18&t=6963#p56362
viewtopic.php?f=18&t=6992&start=10#p57065
The mesh object can allready handle 2D-Meshes. Does it mean if I create my Mesh in python (by converting the imported mesh) I am able to use the 2Dmesh object? It would mean I could show the nodes on the screen but not the mesh since the 2D meshes do not have visuals yet?
I wonder if it is possible by python to put even constraints on the 2D mesh by python and make a analysis in calculix? Attached a simple slab I would like to play with.
In Fem_Workbench is shown how to make a FEM Mesh using python but only for 3D-meshes
These two posts of Juegen gave some informations about FEM-module.
viewtopic.php?f=18&t=6963#p56362
viewtopic.php?f=18&t=6992&start=10#p57065
The mesh object can allready handle 2D-Meshes. Does it mean if I create my Mesh in python (by converting the imported mesh) I am able to use the 2Dmesh object? It would mean I could show the nodes on the screen but not the mesh since the 2D meshes do not have visuals yet?
I wonder if it is possible by python to put even constraints on the 2D mesh by python and make a analysis in calculix? Attached a simple slab I would like to play with.
- Attachments
-
- simpleslab--structural.fcstd
- (49.86 KiB) Downloaded 74 times
Re: 2D Mesh
If you mean, meshing the surface of the objects, this is perfectly possible, also from the gui. Look under 'mesh part' (sorry i'm not in front of my computer now, cannot post a screenshot)
Enrico
Enrico
Re: 2D Mesh
I allready have a mesh. I would like to turn it into a FEM-Meshediloren wrote:If you mean, meshing the surface of the objects ...
Code: Select all
import FreeCAD, Fem
m = Fem.FemMesh()
m.addNode(0,1,0)
m.addNode(0,0,1)
m.addNode(1,0,0)
m.addFace([1,2,3])
Fem.show(m)
Gui.ActiveDocument.ActiveObject.HighlightedNodes = [1,2,3]
Re: 2D Mesh
The code of the last post seam to made a FEM-Mesh, just forgot to print it ...
Code: Select all
>>> m
========================== Dump contents of mesh ==========================
1) Total number of nodes: 3
2) Total number of edges: 0
3) Total number of faces: 1
4) Total number of polygons: 0
5) Total number of volumes: 0
6) Total number of polyhedrons: 0
7) Total number of linear edges: 0
8) Total number of linear faces: 1
8.1) Number of linear triangles: 1
8.2) Number of linear quadrangles: 0
9) Total number of linear volumes: 0
10) Total number of quadratic edges: 0
11) Total number of quadratic faces: 0
12) Total number of quadratic volumes: 0
===========================================================================
>>>
Re: 2D Mesh
Mhh but trying to get a Mesh out of the file provided (simpleslab--structural.fcstd) addNode does not accept a Point
Code: Select all
>>> import FreeCAD, Fem
>>> m = Fem.FemMesh()
>>> testnode = App.ActiveDocument.ID1009954_Entry__1009950_body.Shape.Faces[0].Edges[0].Vertexes[0].Point
>>> testnode
Vector (5.0, -2.5, 3.125)
>>> m.addNode(testnode)
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: addNode() accepts:
-- addNode(x,y,z)
-- addNode(x,y,z,ElemId)
Re: 2D Mesh
Mhh sorry for posting that much ...
Just correcting myself ...
Just correcting myself ...
Code: Select all
>>> import FreeCAD, Fem
>>> m = Fem.FemMesh()
>>> testnode = App.ActiveDocument.ID1009954_Entry__1009950_body.Shape.Faces[0].Edges[0].Vertexes[0]
>>> nx=testnode.X
>>> ny=testnode.Y
>>> nz=testnode.Z
>>> m.addNode(nx,ny,nz)
1
>>>
>>> m
========================== Dump contents of mesh ==========================
1) Total number of nodes: 1
2) Total number of edges: 0
3) Total number of faces: 0
4) Total number of polygons: 0
5) Total number of volumes: 0
6) Total number of polyhedrons: 0
7) Total number of linear edges: 0
8) Total number of linear faces: 0
9) Total number of linear volumes: 0
10) Total number of quadratic edges: 0
11) Total number of quadratic faces: 0
12) Total number of quadratic volumes: 0
===========================================================================
>>>
Re: 2D Mesh
Got the Mesh, but FreeCAD crashes ...
load the file:
do not change the view. Just zoom in and out using the mouse wheel and FreeCAD crashes. I can remember this again and again. I havn't had this with this version of FreeCAD with non of lots of modells.
OS: Windows 7
Word size: 64-bit
Version: 0.14.3691 (Git)
Branch: master
Hash: 691fd1128672c8bd472cece87c9e9d07b71d6fee
Python version: 2.7.6
Qt version: 4.8.5
Coin version: 4.0.0a
SoQt version: 1.6.0a
load the file:
Code: Select all
import FreeCAD, Fem
faces = App.ActiveDocument.ID1009954_Entry__1009950_body.Shape.Faces
m = Fem.FemMesh()
nodeid = 1
for f in faces:
vertiece = f.Vertexes
for vnr, v in enumerate(vertiece):
vx = v.X
vy = v.Y
vz = v.Z
#print '(', vx, ', ', vy, ', ', vz, ', ', nodeid, ')'
m.addNode(vx,vy,vz,nodeid)
nodeid += 1
if vnr == 0:
facenode1 = nodeid
elif vnr == 1:
facenode2 = nodeid
elif vnr == 2:
facenode3 = nodeid
else:
print 'error in facenodes'
m.addFace([facenode1,facenode1,facenode1,])
Fem.show(m)
m
# aktivate Mesh in TreeView
list = range(m.NodeCount+1)
list = list[1:]
Gui.ActiveDocument.ActiveObject.HighlightedNodes = list
OS: Windows 7
Word size: 64-bit
Version: 0.14.3691 (Git)
Branch: master
Hash: 691fd1128672c8bd472cece87c9e9d07b71d6fee
Python version: 2.7.6
Qt version: 4.8.5
Coin version: 4.0.0a
SoQt version: 1.6.0a
Re: 2D Mesh
same crash on:
OS: Ubuntu 14.04.1 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.15.4086 (Git)
Branch: master
Hash: f87bd2ac352dee9ea9aa27096141e0a37326fa45
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
BTW: ubuntu runs in VirtualBox
OS: Ubuntu 14.04.1 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.15.4086 (Git)
Branch: master
Hash: f87bd2ac352dee9ea9aa27096141e0a37326fa45
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
Code: Select all
bhb@ubuntuVM:~$ freecad
FreeCAD 0.15, Libs: 0.15R4086 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2014
##### #### ### ####
# # # # # #
# ## #### #### # # # # #
#### # # # # # # # ##### # #
# # #### #### # # # # #
# # # # # # # # # ## ## ##
# # #### #### ### # # #### ## ## ##
libGL error: pci id for fd 15: 80ee:beef, driver (null)
OpenGL Warning: Failed to connect to host. Make sure 3D acceleration is enabled for this VM.
libGL error: core dri or dri2 extension not found
libGL error: failed to load driver: vboxvideo
sh: 1: SMDS_MemoryLimit: not found
*** Abort *** an exception was raised, but no catch was found.
... The exception is:SIGSEGV 'segmentation violation' detected. Address 1e4
bhb@ubuntuVM:~$
Re: 2D Mesh
i can reproduce the problem
OS: Debian GNU/Linux 7.6 (wheezy)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4090 +7 (Git)
Branch: split-revision,review-unicode-filenames,sketcher-geoidcheck,dev-openscad
Hash: b8e3df17b264367569b2e5ace0d5112d08cfb421
Python version: 2.7.3
Qt version: 4.8.2
Coin version: 4.0.0a
Code: Select all
#0 0x00007fff6699c1fc in FemGui::ViewProviderFemMesh::getElement (this=
0x52d4ce0, detail=0x5304920)
at /home/sebastian/free-cad/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp:420
#1 0x00007ffff75c85f9 in Gui::SoFCUnifiedSelection::handleEvent (this=
0x24ffc30, action=0x96deb0)
at /home/sebastian/free-cad/src/Gui/SoFCUnifiedSelection.cpp:363
#2 0x00007ffff4df6707 in SoNode::handleEventS(SoAction*, SoNode*) ()
from /usr/lib/x86_64-linux-gnu/libCoin.so.80
#3 0x00007ffff4bbbc85 in SoAction::traverse(SoNode*) ()
from /usr/lib/x86_64-linux-gnu/libCoin.so.80
#4 0x00007ffff4d06f3c in SoChildList::traverse(SoAction*, int, int) ()
from /usr/lib/x86_64-linux-gnu/libCoin.so.80
#5 0x00007ffff4debf5d in SoGroup::doAction(SoAction*) ()
from /usr/lib/x86_64-linux-gnu/libCoin.so.80
#6 0x00007ffff4e082bf in SoSeparator::doAction(SoAction*) ()
from /usr/lib/x86_64-linux-gnu/libCoin.so.80
#7 0x00007ffff4df6707 in SoNode::handleEventS(SoAction*, SoNode*) ()
from /usr/lib/x86_64-linux-gnu/libCoin.so.80
#8 0x00007ffff4bbbc85 in SoAction::traverse(SoNode*) ()
from /usr/lib/x86_64-linux-gnu/libCoin.so.80
#9 0x00007ffff4bc690a in SoHandleEventAction::beginTraversal(SoNode*) ()
from /usr/lib/x86_64-linux-gnu/libCoin.so.80
#10 0x00007ffff4bbc4c2 in SoAction::apply(SoNode*) ()
from /usr/lib/x86_64-linux-gnu/libCoin.so.80
#11 0x00007ffff4d25499 in SoEventManager::actuallyProcessEvent(SoEvent const*)
() from /usr/lib/x86_64-linux-gnu/libCoin.so.80
#12 0x00007ffff762d1b8 in SIM::Coin3D::Quarter::QuarterWidget::processSoEvent (
this=0x96a0a0, event=0x39a1b70)
at /home/sebastian/free-cad/src/Gui/Quarter/QuarterWidget.cpp:807
#13 0x00007ffff7638435 in SIM::Coin3D::Quarter::SoQTQuarterAdaptor::processSoEvent (this=0x96a0a0, event=0x39a1b70)
at /home/sebastian/free-cad/src/Gui/Quarter/SoQTQuarterAdaptor.h:93
#14 0x00007ffff765fa83 in Gui::View3DInventorViewer::processSoEventBase (this=
0x96a0a0, ev=0x39a1b70)
at /home/sebastian/free-cad/src/Gui/View3DInventorViewer.cpp:1515
#15 0x00007ffff7646b2f in Gui::NavigationStyle::processSoEvent (this=
0x24d0710, ev=0x39a1b70)
at /home/sebastian/free-cad/src/Gui/NavigationStyle.cpp:1263
#16 0x00007ffff764b7cc in Gui::CADNavigationStyle::processSoEvent (this=
0x24d0710, ev=0x39a1b70)
at /home/sebastian/free-cad/src/Gui/CADNavigationStyle.cpp:436
#17 0x00007ffff7646a7c in Gui::NavigationStyle::processEvent (this=0x24d0710,
ev=0x39a1b70) at /home/sebastian/free-cad/src/Gui/NavigationStyle.cpp:1246
#18 0x00007ffff765fa4a in Gui::View3DInventorViewer::processSoEvent (this=
0x96a0a0, ev=0x39a1b70)
at /home/sebastian/free-cad/src/Gui/View3DInventorViewer.cpp:1510
#19 0x00007ffff762f535 in SIM::Coin3D::Quarter::EventFilter::eventFilter (this=
0x24c9b20, obj=0x96a0a0, qevent=0x7fffffffbfc0)
at /home/sebastian/free-cad/src/Gui/Quarter/EventFilter.cpp:164
#20 0x00007ffff0c6acc6 in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=<optimized out>, receiver=0x96a0a0, event=0x7fffffffbfc0)
at kernel/qcoreapplication.cpp:1025
#21 0x00007ffff17226dc in QApplicationPrivate::notify_helper (this=this@entry=
0x8161a0, receiver=receiver@entry=0x96a0a0, e=e@entry=0x7fffffffbfc0)
at kernel/qapplication.cpp:4552
#22 0x00007ffff17273eb in QApplication::notify (this=<optimized out>, receiver=
0x24f6330, e=0x7fffffffc550) at kernel/qapplication.cpp:4099
#23 0x00007ffff73ded7b in Gui::GUIApplication::notify (this=0x7fffffffd0f0,
receiver=0x24f6330, event=0x7fffffffc550)
at /home/sebastian/free-cad/src/Gui/Application.cpp:1537
#24 0x00007ffff0c6ab5e in QCoreApplication::notifyInternal (this=
0x7fffffffd0f0, receiver=0x24f6330, event=0x7fffffffc550)
at kernel/qcoreapplication.cpp:915
#25 0x00007ffff172354b in sendEvent (event=<optimized out>,
receiver=<optimized out>)
at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#26 QApplicationPrivate::sendMouseEvent (receiver=0x24f6330, event=
0x7fffffffc550, alienWidget=0x0, nativeWidget=0x24f6330, buttonDown=
0x7ffff21f82a8, lastMouseReceiver=..., spontaneous=true)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4090 +7 (Git)
Branch: split-revision,review-unicode-filenames,sketcher-geoidcheck,dev-openscad
Hash: b8e3df17b264367569b2e5ace0d5112d08cfb421
Python version: 2.7.3
Qt version: 4.8.2
Coin version: 4.0.0a
Re: 2D Mesh
(gdb) p vNodeElementIdx
$2 = std::vector of length 0, capacity 0
$2 = std::vector of length 0, capacity 0