[Gmsh] Assigning to String in Geometry Script

Keith Prussing kprussing74 at gmail.com
Mon Jul 29 20:03:50 CEST 2019


Greetings,

I am trying to programmatically build surface labels in my GMSH
script.  My thought was to store the components I wish to concatenate
together in variables; however, I keep getting an error while trying
to use the strings.  Consider the following minimum example

    $ cat mwe.geo
    name = "test";
    Printf("name is", name);

When I pass this to `gmsh`, I get the following error

    $ gmsh -0 mwe.geo
    Info    : Running 'gmsh -2 mwe.geo' [Gmsh 4.3.0, 1 node, max. 1 thread]
    Info    : Started on Mon Jul 29 13:28:29 2019
    Info    : Reading 'mwe.geo'...
    Error   : 'mwe.geo', line 5 : Unknown variable 'name'
    name is [0]0
    Info    : Done reading 'mwe.geo'
    Info    : Writing 'mwe.geo_unrolled'...
    Info    : Done writing 'mwe.geo_unrolled'
    Info    : Stopped on Mon Jul 29 13:28:29 2019

I get the same error from the GUI.  I tried using the
`name=Str("test");` syntax but that did not help. From what I can
tell, section 4.2.2 of the manual says this is the correct syntax, and
the thread linked below implies this should work. I also checked
against a new build of `tag/gmsh_4_4_1` in the repo and the result is
the same.

So my question is: What is the correct syntax for storing a string to
a variable in the geometry scripting language?

Keith

[1]: http://onelab.info/pipermail/gmsh/2016/010946.html

-- 
Keith Prussing



More information about the gmsh mailing list