GMSH macro

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Dr_Froggy_rD
Posts: 17
Joined: Sun Jan 31, 2016 8:50 am

Re: GMSH macro

Post by Dr_Froggy_rD »

Hi everybody,

I try to run the gmsh macro for windows (freecad 0.15) : not working ( I dl gmsh 2.11 and installed: herebelow in the original post this is gmsh 2.8.3).
I did every single changes announced on this thread.
however to be sure below the macro part:
A) question about the macro changed on line 8
# CONFIGURATION - EDIT THE FOLLOWING LINE TO MATCH YOUR GMSH BINARY
gmsh_bin = "C:\\Users\\ubrammer\\gmsh-2.8.3-Windows\\gmsh.exe"
# pathSep = "\\"
pathSep = '/'
# END CONFIGURATION

what I now have in the macro:
# CONFIGURATION - EDIT THE FOLLOWING LINE TO MATCH YOUR GMSH BINARY
gmsh_bin = "C:\newfolder\gmsh-2.11.0-Windows\gmsh.exe"
# pathSep = "\\"
pathSep = '/'
# END CONFIGURATION

Do I need to write like that instead? or is it just fine like above?:
gmsh_bin = "C:/newfolder/gmsh-2.11.0-Windows/gmsh.exe"

B)question about change on line 16 and 203 (on my macro: it is however 17 and 204 I may have a line jump... which is weird because I just dl it like it is without changing anything).
[import MechanicalAnalysis ---> import FemAnalysis and later on
MechanicalAnalysis.makeMechanicalAnalysis('MechanicalAnalysis') ---> FemAnalysis.makeFemAnalysis('MechanicalAnalysis')]

Without changing those lines : I can at least start the macro and I get the GUI for the various gmsh options / if I change those lines then no GUI at all and Error : traceback .... no module named FemAnalysis .

------:-o so what the hell I do wrong? can you give me any help? thx in advance to all of you.
best regards
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: GMSH macro

Post by ulrich1a »

Dr_Froggy_rD wrote:-----:-o so what the hell I do wrong? can you give me any help? thx in advance to all of you.
I had also problems to run the macro under Windows. You may try the version, I did post here: viewtopic.php?f=22&t=11182#p93788

best regards
Ulrich
Dr_Froggy_rD
Posts: 17
Joined: Sun Jan 31, 2016 8:50 am

Re: GMSH macro

Post by Dr_Froggy_rD »

Dear Ulrich,

I did use the macro you posted ;)

but still I had it works now for 4 parts but... I do not understand well what I have to write.

Ah yes I do not understand the way to write a script. So I try to do exactly as I wrote.

But thank you for your answer.

Do you know why I get the mention "traceback .... no module named FemAnalysis"? when I change both line on line 16 and 203?
And what I have to do to get it working properly?
But I asked myself why changing it to femanalysis and not letting mechanicalanalysis)
Thanks for your inputs#

Best Regards
Froggy
fandaL
Posts: 440
Joined: Thu Jul 24, 2014 8:29 am

Re: GMSH macro

Post by fandaL »

But I asked myself why changing it to femanalysis and not letting mechanicalanalysis)
During a recent development the name was changed from MechanicAlanalysis to FemAnalysis. So this hand change is needed for the actual development FreeCAD version - you can download it as "pre-release" here: https://github.com/FreeCAD/FreeCAD/releases , simply unpack and run FreeCAD.exe in the bin folder. It works without installing and independently from any other versions.
It works to me for a cube.

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6420 (Git)
Build type: Release
Branch: master
Hash: 66e719f3f529ab2c7881a2099080d417021deec7
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Dr_Froggy_rD
Posts: 17
Joined: Sun Jan 31, 2016 8:50 am

Re: GMSH macro

Post by Dr_Froggy_rD »

Hi and thanks I get it!

so for me I do not need to change the line 16 and 203 as far as I run freecad 0.15.

Good to know!

Best Regards

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

Re: GMSH macro

Post by bernd »

I made a Pull Request to make the macro useble for multiple operating systems. See https://github.com/psicofil/Macros_FreeCAD/pull/5
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: GMSH macro

Post by bernd »

The macro should run on multiple OS now. https://github.com/psicofil/Macros_Free ... its/master

The binary path needs to be set. https://github.com/psicofil/Macros_Free ... FCMacro#L9 For me I can use one macro (The same FreeCAD mod folder) on Windows and Linux.

Would be cool if some people from Windows and especially from OSX could give some feedback.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: GMSH macro

Post by sgrogan »

bernd wrote: Would be cool if some people from Windows and especially from OSX could give some feedback.
Works good on Windows. (Need to be sure no spaces in Path, gmsh installer installs in "Program Files" so I had to move it)
Thanks bernd
"fight the good fight"
fandaL
Posts: 440
Joined: Thu Jul 24, 2014 8:29 am

Re: GMSH macro

Post by fandaL »

2d and 3d works well. When I check button "1D" I get a mesh (seems ok) but in the report view is:

Code: Select all

Exception (Mon Mar 07 20:51:36 2016): 'Elements & Nodes' is not part of the enumeration
Unexpected error in GMSHMesh macro: <class 'Base.FreeCADError'>
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6560 (Git)
Build type: Release
Branch: master
Hash: 0ec81d2760bdfd8b1a63273cb3e456e0bf1cd58e
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: GMSH macro

Post by bernd »

Thank you guys for testing.
fandaL wrote:2d and 3d works well. When I check button "1D" I get a mesh (seems ok) but in the report view is:

Code: Select all

Exception (Mon Mar 07 20:51:36 2016): 'Elements & Nodes' is not part of the enumeration
Unexpected error in GMSHMesh macro: <class 'Base.FreeCADError'>
same here on Linux. Means it is not OS related. Mesh seams fine. I may have a look.

OS: Debian GNU/Linux 8.3 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6570 (Git)
Build type: Debug
Branch: master
Hash: 2879ee24b5a72f98ee1148c2bcf9f37eca1187c9
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.0
Post Reply