GMSH macro

Need help, or want to share a macro? Post here!
fandaL
Posts: 384
Joined: Thu Jul 24, 2014 8:29 am

Re: GMSH macro

Postby fandaL » Fri Jun 17, 2016 6:33 pm

I had a problem with a comma as a decimal separator, which is default on my current office computer. It was not possible to mesh with a maximum mesh size lower than 1. The error in the Report view

Code: Select all

Unexpected error in GMSHMesh macro: <class 'subprocess.CalledProcessError'>
and the mesh with setting 1,9 looks exactly the same as with setting 1,0. That seems to cut decimals out.
Now it works when I added to the beginning of the macro

Code: Select all

import string
and changed comma for dot in the variables clmax and clmin by adding lines

Code: Select all

clmax =	string.replace(clmax,",",".")
clmin =	string.replace(clmin,",",".")
just after their input approximately at lines 172, 173

GMSH macro version

Code: Select all

# Version: 04/07/2015
GMSH 2.12.0

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7745 (Git)
Build type: Release
Branch: master
Hash: 79dcdfbc782e24bb34db882143af7ce8ebd237bd
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
tvargasn
Posts: 3
Joined: Mon Mar 06, 2017 12:02 am

Re: GMSH macro

Postby tvargasn » Sat Mar 11, 2017 10:12 pm

Hi, I run the macro on Freecad 0.17 but I get the following error:

Code: Select all

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Users/tommy/Library/Preferences/FreeCAD/Macro/GMSH.FCMacro", line 19, in <module>
    import FemAnalysis
ImportError: No module named FemAnalysis
I put all the path but still failing.

I appreciate the help. Excuse my English.

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10433 (Git)
Build type: Release
Branch: (detached from 5625bab)
Hash: 5625bab1703bd3d4810b1730a34e852a66c99a00
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
ulrich1a
Posts: 1958
Joined: Sun Jul 07, 2013 12:08 pm

Re: GMSH macro

Postby ulrich1a » Sat Mar 11, 2017 10:58 pm

tvargasn wrote:Hi, I run the macro on Freecad 0.17 but I get the following error:
The macro code is integrated into the FEM-workbench in FreeCAD version 0.17. There is a button in the FEM-workbench that provide nearly all the functionality of the macro.
The FEM-workbench got a lot of changes recently. This affects especially the Python-import function.

If you do not need to mesh two independent parts, then there is not need to use the macro in FreeCAD version 0.17.

Ulrich
tvargasn
Posts: 3
Joined: Mon Mar 06, 2017 12:02 am

Re: GMSH macro

Postby tvargasn » Sun Mar 12, 2017 3:03 am

ulrich1a wrote:The macro code is integrated into the FEM-workbench in FreeCAD version 0.17.
Ohhhh, thanks a lot.