FemMesh.addFace()

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

FemMesh.addFace()

Post by bernd »

Tried to add FemMesh elements py python. It works well for a S3 Element

Code: Select all

import FreeCAD, Fem
mS3 = Fem.FemMesh()
mS3.addNode( 0,  0, 0, 1)
mS3.addNode(10, 10, 0, 2)
mS3.addNode( 0, 10, 0, 3)
mS3.addFace([ 1,  2,  3])
Fem.show(mS3)
but for an S6 Element I get an exception after addFace ?!

Code: Select all

import FreeCAD, Fem
mS6 = Fem.FemMesh()
mS6.addNode( 0,  0, 0, 1)
mS6.addNode(10, 10, 0, 2)
mS6.addNode( 0, 10, 0, 3)
mS6.addNode( 5,  5, 0, 4)
mS6.addNode( 5, 10, 0, 5)
mS6.addNode( 0,  5, 0, 6)
mS6.addFace([ 1,  2, 3,  4, 5, 6])
Fem.show(mS6)

Code: Select all

Traceback (most recent call last):
  File "<input>", line 1, in <module>
Base.FreeCADError: FC++ exception thrown (Unknown node count, [3|4|6|8] are allowed)
but

Code: Select all

>>> len([ 1,  2, 3,  4, 5, 6])
6
seams fine ?!

EDIT: to highlight the nodes of the mesh:

Code: Select all

Gui.ActiveDocument.FreeCADMeshObjectName.HighlightedNodes = [nodeids]
Gui.ActiveDocument.Mesh.HighlightedNodes = [ 1,  2, 3,  4, 5, 6]  #mS6
OS: Debian GNU/Linux 8.1 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5206 (Git)
Build type: Unknown
Branch: master
Hash: df04df01f79dff80fd78aebc51225a75501f9c7c
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.0
django013
Posts: 106
Joined: Tue Jan 13, 2015 7:51 am

Re: FemMesh.addFace()

Post by django013 »

Hi Bernd,

sorry for OT - but it looks like you are running the system, I'd like to achieve (debian stable with fc git-master).
Could you please shine me a light, what 3rdparty Software is needed and works together?
It looks like I had compiled each part, but they don't work together :O

regards Reinhard
OS: Linux Debian Jessie amd64 - FC: Git Master
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FemMesh.addFace()

Post by bernd »

django013 wrote:Hi Bernd,

sorry for OT - but it looks like you are running the system, I'd like to achieve (debian stable with fc git-master).
Could you please shine me a light, what 3rdparty Software is needed and works together?
It looks like I had compiled each part, but they don't work together :O

regards Reinhard
Ohh, I missed that thread, I'm gone post over there. viewtopic.php?f=4&t=11683&start=10
wmayer
Founder
Posts: 20306
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FemMesh.addFace()

Post by wmayer »

User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FemMesh.addFace()

Post by bernd »

wmayer wrote:git commit b3970f6
Wow that was fast, thanks werner.

BTW: found a new issue. It's not possible to highlight 7 nodes if there are only 3 but FreeCAD crashes with segmentation violation ... :o

Code: Select all

import Fem
m = Fem.FemMesh()
m.addNode( 0,  0, 0, 1)
m.addNode(10, 10, 0, 2)
m.addNode( 0, 10, 0, 3)
m.addFace([ 1,  2,  3])
Fem.show(m)
Gui.ActiveDocument.Mesh.HighlightedNodes = range(7)

Code: Select all

hugo@weide:~/Documents/dev/freecad/freecadbhb/build$ ./bin/FreeCAD
FreeCAD 0.16, Libs: 0.16R5195 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2015
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

sh: 1: SMDS_MemoryLimit: not found
*** Abort *** an exception was raised, but no catch was found.
        ... The exception is:SIGSEGV 'segmentation violation' detected. Address 20
hugo@weide:~/Documents/dev/freecad/freecadbhb/build$ 
wmayer
Founder
Posts: 20306
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FemMesh.addFace()

Post by wmayer »

Good catch! git commit 18f0ec6
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FemMesh.addFace()

Post by bernd »

next crash werner !

Jürgen had ask for S4 and S8 ...
jriegel wrote:...
No one in need for quadratic elements so far? ...
and
jriegel wrote:No I thought of S4 and so on ... Have fun
in viewtopic.php?f=18&t=10976&start=10#p88584

Code: Select all

import Fem 
mS8 = Fem.FemMesh()
mS8.addNode(20,  0, 0, 1)
mS8.addNode(30,  0, 0, 2)
mS8.addNode(30, 10, 0, 3)
mS8.addNode(20, 10, 0, 4)
mS8.addNode(25,  0, 0, 5)
mS8.addNode(30,  5, 0, 6)
mS8.addNode(25, 10, 0, 7)
mS8.addNode(20,  5, 0, 8)
mS8.addFace([ 1,  2,  3, 4, 5, 6, 7, 8])
mS8
Output of mS8 seams fine to me.

Code: Select all

Fem.show(mS8)
# crash

Code: Select all

FreeCAD: /home/hugo/Documents/dev/freecad/freecadcode/src/Mod/Fem/Gui/ViewProviderFemMesh.cpp:782: void FemGui::ViewProviderFEMMeshBuilder::createMesh(const App::Property*, SoCoordinate3*, SoIndexedFaceSet*, SoIndexedLineSet*, std::vector<long unsigned int, std::allocator<long unsigned int> >&, std::vector<long unsigned int, std::allocator<long unsigned int> >&, bool&, bool) const: Zusicherung »0« nicht erfüllt.
Abgebrochen
OS: Debian GNU/Linux 8.1 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5236 (Git)
Build type: Unknown
Branch: master
Hash: c2bedaeb96d248ece916e35977bf60385b89d51a
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
Post Reply