GMSH macro

Need help, or want to share a macro? Post here!
User avatar
psicofil
Posts: 154
Joined: Thu Dec 15, 2011 11:02 pm

GMSH macro

Postby psicofil » Sun May 31, 2015 11:55 pm

I create a new thread for this macro which started to discuss here viewtopic.php?f=18&t=10066 and here viewtopic.php?f=18&t=10732&start=20

I've updated the macro adding support for 1D and 2D meshes, which can now be viewed on FreeCAD from version 0.16.5030.
GMSHMesh.png
GMSHMesh.png (175.81 KiB) Viewed 5238 times
The macro may be found on the following github repository: https://github.com/psicofil/Macros_Free ... sh.FCMacro

sorry for my bad English
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
User avatar
psicofil
Posts: 154
Joined: Thu Dec 15, 2011 11:02 pm

Re: GMSH macro

Postby psicofil » Sat Jun 20, 2015 6:40 pm

New version.
-Add -clmin option, is optional
- clmax, -order are now optional
Regards
GMSHMesh.png
GMSHMesh.png (168.25 KiB) Viewed 5178 times
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
ulrich1a
Posts: 1958
Joined: Sun Jul 07, 2013 12:08 pm

Re: GMSH macro

Postby ulrich1a » Mon Jun 22, 2015 4:06 pm

I tried the macro on Windows and got the following error:

Code: Select all

Running: C:/Users/ubrammer/gmsh-2.8.3-Windows/gmsh.exe c:\users\ubrammer\appdata\local\temp\tmpspflzn.step -3 -format unv -o /tmp/Part__Feature_Mesh.unv -algo netgen -clmax 5,00   -optimize -order 2
Unexpected error in GMSHMesh macro: <type 'exceptions.WindowsError'>
There seems to be a problem with the path to the temporary step file. This path should not contain backslashes.

Ulrich

OS: Windows 7
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.16.5096 (Git)
Build type: Release
Branch: master
Hash: d0d98b87751f4e5308916f509b72f14053caa61e
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
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: GMSH macro

Postby microelly2 » Mon Jun 22, 2015 5:58 pm

I would delete this line 34
self.title = QtGui.QLabel("<b> Macro GMSH mesh generator <b>", self)

and add instead at the end of the file
d.setWindowTitle(" GMSH mesh generator")

so the header is always visible as dock title

I have added your macro collection (the complete git) to the pluginloader.
I'm still looking for nice icons for your macros
bn_689.png
bn_689.png (211.58 KiB) Viewed 5123 times
Jee-Bee
Posts: 2145
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: GMSH macro

Postby Jee-Bee » Tue Jun 30, 2015 1:38 pm

I can't get the macro running.
every time i get some errors

Code: Select all

Unexpected error in GMSHMesh macro: <class 'subprocess.CalledProcessError'>
i had to change my bin gmsh location to

Code: Select all

gmsh_bin = "/Applications/Gmsh/Gmsh.app/Contents/MacOS" #"/usr/bin/gmsh"
I created something what looks like the test obj in the youtube movie. to try a bit on but i've tested other files also but they don't work eighter.
Do i something wrong or is it Mac(version?)
Attachments
FEM_test.FCStd
(6.91 KiB) Downloaded 130 times
ulrich1a
Posts: 1958
Joined: Sun Jul 07, 2013 12:08 pm

Re: GMSH macro

Postby ulrich1a » Wed Jul 01, 2015 7:21 am

Jee-Bee wrote:I can't get the macro running.
every time i get some errors

Code: Select all
Unexpected error in GMSHMesh macro: <class 'subprocess.CalledProcessError'>
In order to get the macro working under Windows, I had to change the arguments for the subprocress call. The arguments have to be elements of a list without any spaces in it.
I have this week no access to the computer, where I did the changes. I will post my version next week.

Ulrich
Jee-Bee
Posts: 2145
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: GMSH macro

Postby Jee-Bee » Wed Jul 01, 2015 12:54 pm

thanks
User avatar
psicofil
Posts: 154
Joined: Thu Dec 15, 2011 11:02 pm

Re: GMSH macro

Postby psicofil » Sat Jul 04, 2015 6:01 pm

Hello Jee-Bee. Sorry for the late response.
Try the new version: https://github.com/psicofil/Macros_FreeCAD
i had to change my bin gmsh location to gmsh_bin = "/Applications/Gmsh/Gmsh.app/Contents/MacOS" #"/usr/bin/gmsh"
You have to put the full command gmsh, in your case I think it would:

Code: Select all

gmsh_bin = "/Applications/Gmsh.app/Contents/MacOS/gmsh"
Any error or if it works please wrote in this post. I do not have a Mac to test the macro. :(
ulrich1a wrote: In order to get the macro working under Windows
I'm working for the macro to work in windows, the problem I have now is to import the resulting mesh because the tempfile.tempdir command returns the address of the temporary file of the form \temporalyFolder\ .... and when trying to open with Fem.insert throws an error, but if I change "\" with "/" the mesh is imported without problem. Tomorrow I will try to solve that problem. The problem of space in the command think are already solved.
microelly2 wrote: add instead at the end of the file d.setWindowTitle(" GMSH mesh generator")
Already corrected it in the new version of the macro. Thanks.

Regards
Sorry for my bad English
Ing. Gomez Lucio
Scope Ingenieria (scopeingenieria.com)
ulrich1a
Posts: 1958
Joined: Sun Jul 07, 2013 12:08 pm

Re: GMSH macro

Postby ulrich1a » Mon Jul 06, 2015 8:02 am

As announced, I post my version of the GMSH macro, working under Windows. Sorry for not making a pull request to the githup repo, I do not have the time to perform all the steps at the moment.
The macro works for me under Windows. I did not include the additional GMSH options in the call. This is still to do.
I have changed, how the temporary directory is used.
I changed the arguments for the subprocess call.

The attached file is a real zip. Please unzip it.

Ulrich
Attachments
GmshMesh2.zip
This is a real zip!
(2.6 KiB) Downloaded 493 times
Jee-Bee
Posts: 2145
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: GMSH macro

Postby Jee-Bee » Mon Jul 06, 2015 10:41 am

psicofil wrote:

Code: Select all

gmsh_bin = "/Applications/Gmsh.app/Contents/MacOS/gmsh"
Any error or if it works please wrote in this post. I do not have a Mac to test the macro. :(
It works except i had to add an extra directory ;)
Thanks!!