2D Mesh

About the development of the FEM module/workbench.
User avatar
jriegel
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: 2D Mesh

Postby jriegel » Sun Oct 05, 2014 1:53 pm

Can you post a simple file or python code to reproduce the crash? The I can take a look...
Stop whining - start coding!
User avatar
bernd
Posts: 3924
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: 2D Mesh

Postby bernd » Sun Oct 05, 2014 6:40 pm

jriegel wrote:Can you post a simple file or python code to reproduce the crash? The I can take a look...
Sure, and thank-you so far

EDIT2: see post viewtopic.php?f=18&t=7823&p=64631#p64631

* load the file
simpleslab--structural.fcstd
(49.86 KiB) Downloaded 25 times

* make a 2D-FEM-Mesh

Code: Select all

import FreeCAD, Fem

faces = App.ActiveDocument.ID1009954_Entry__1009950_body.Shape.Faces

m = Fem.FemMesh()

for f in faces:
  vertiece = f.Vertexes
  for v in vertiece:
    vx = v.X
    vy = v.Y
    vz = v.Z
    m.addNode(vx,vy,vz)

 
Fem.show(m)
m


* activate the mesh in FreeCADs TreeView
* show all node of the FEM-Mesh

Code: Select all

list = range(m.NodeCount+1)
list = list[1:]
Gui.ActiveDocument.ActiveObject.HighlightedNodes = list

* EDIT: move mouse above the green highlighted nodes is sufficient to crash FreeCAD
* use the mouse wheel to zoom in and out
* FreeCAD will crash after zooming a few times ...

OS: Debian GNU/Linux testing (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4004 (Git)
Branch: master
Hash: 9f7956b17e3780b710f2db9b7a0003b7fa6d818d
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.7.0

and on some more plattforms including windows

EDIT:
deleted unnecessary code line to reproduce the crash.
it is not the zoom, one has to move the mouse obove the highlited nodes (thist just happens by zooming too.)
EDIT2:
see post viewtopic.php?f=18&t=7823&p=64631#p64631
Last edited by bernd on Mon Oct 06, 2014 9:22 am, edited 7 times in total.
User avatar
bernd
Posts: 3924
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: 2D Mesh

Postby bernd » Sun Oct 05, 2014 7:49 pm

BTW: One line is wrong but if the line is commented FreeCAD fails anyway ...

Code: Select all

  m.addFace([facenode1,facenode1,facenode1,])


should be

Code: Select all

   m.addFace([facenode1,facenode2,facenode3])

but this gives an Exception, mhh I nee more investigation on this, but anyway FreeCAD fails without adding the faces to the FEM-Mesh ...


EDIT: Following the code for making a FEM Mesh with faces ...

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 'Try to add the following Node: (', vx, ', ', vy, ', ', vz, ', ', nodeid, ') Next line will be the node number of FreeCAD'
    m.addNode(vx,vy,vz,nodeid)
    print '  Node was added!'
    if vnr == 0:
      facenode1 = nodeid
    elif vnr == 1:
      facenode2 = nodeid
    elif vnr == 2:
      facenode3 = nodeid
    else:
      print 'error in facenodes'

    nodeid += 1
    print 'vnr= ',vnr


  print 'Try to add a Face' ' --> facenodes= ', facenode1, ' ', facenode2, ' ', facenode3, ' Next line will be the face number of FreeCAD'
  m.addFace([facenode1,facenode2,facenode3])
  print '  Face was added!'

 
Fem.show(m)
m
 
User avatar
bernd
Posts: 3924
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: 2D Mesh

Postby bernd » Mon Oct 06, 2014 9:18 am

It is much easier to reproduce the crash ...

Code: Select all

import FreeCAD, Fem

m = Fem.FemMesh()

m.addNode(0,1,0)
m.addNode(0,0,1)
m.addNode(1,0,0)
Fem.show(m)
Gui.ActiveDocument.ActiveObject.HighlightedNodes = [1,2,3]


move the cursor above one of the hightligted nodes ... (may be click beside a node first to get the focus in the widget)

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
User avatar
jriegel
Site Admin
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: 2D Mesh

Postby jriegel » Sat Nov 22, 2014 12:54 pm

Ok I fixed the crash.

But you do highlight invisible nodes.... At the moment only nodes which belonging at least to a edge/beam or face/volume will be visible.....
Stop whining - start coding!
AhmedER
Posts: 1
Joined: Sun Mar 19, 2017 2:00 pm

Re: 2D Mesh

Postby AhmedER » Sun Mar 19, 2017 2:39 pm

ediloren wrote: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

Can you please tell me how to make a mesh from a 2D plane? When I use FEM workbench to create new mechanical analysis the mesh is created but with no elements or nodes. I used Part -> Create primitives -> Plane, to make the shape itself.

OS: Linux Mint 18 Sarah
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6707 (Git)
Build type: None
Branch: releases/FreeCAD-0-16
Hash: 5465bc47c95db45e0be85dc0e2872419efadce0f
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Attachments
2DPlaneMeshProblem.fcstd
(3.6 KiB) Downloaded 4 times
User avatar
bernd
Posts: 3924
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: 2D Mesh

Postby bernd » Sun Mar 19, 2017 3:57 pm

AhmedER wrote:Can you please tell me how to make a mesh from a 2D plane? When I use FEM workbench to create new mechanical analysis the mesh is created but with no elements or nodes. I used Part -> Create primitives -> Plane, to make the shape itself.

- open your file
- double click on the mesh
- click on apply
- click on ok

OS: Debian GNU/Linux 8.7 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10530 (Git)
Build type: Unknown
Branch: master
Hash: d920cf419d9ed8274d10597364d92f224ded7b4f
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.0.0

AhmedER wrote:Version: 0.16.6707 (Git)
If you work with FEM you should use latest development version 0.17.x There have been hundreds of fixes and improvements ...

2DPlaneMeshProblem-bhb.fcstd
(4.89 KiB) Downloaded 4 times

screen.jpg
screen.jpg (255.28 KiB) Viewed 80 times