[Gmsh] Finding coordinates of transformed point in python api

Peter Johnston p.johnston at griffith.edu.au
Tue Oct 1 02:21:45 CEST 2019


Thanks Max,

That worked fine. I don’t know why I didn’t see it.

Regards,

Peter.

---------------------------------------------------------------------

Associate Professor Peter Johnston (FAustMS, FIMA)
School of Environment and Science
Griffith University | Nathan | QLD 4111 | Technology (N44) Room 3.19
T +61 7 373 57748| F +61 7 373 57656 Email p.johnston at griffith.edu.au
On 1 Oct 2019, 4:40 AM +1000, Max Orok <morok at mevex.com>, wrote:
Hi Peter,

I think you can use the getValue function for this.
Here's a short example that looks up the coordinates of a translated point:

import gmsh

gmsh.initialize()

p1 = gmsh.model.occ.addPoint(0, 0, 0)
gmsh.model.occ.translate([(0, p1)], 1.0, 1.0, 1.0)

# need to synchronize before looking up the point
gmsh.model.occ.synchronize()

no_parametrization = []
[x, y, z] = gmsh.model.getValue(0, p1, no_parametrization)

# will print 1.0, 1.0, 1.0
print("x: {}, y: {}, z: {}".format(x, y, z))

gmsh.finalize()

I hope this helps!
Max

On Mon, Sep 30, 2019 at 2:27 AM Peter Johnston <p.johnston at griffith.edu.au<mailto:p.johnston at griffith.edu.au>> wrote:
Hello,

My apologies if this is a dumb question, but I am having difficulty working out how to find the coordinates of a transformed point in the python api.

I have created a point with:

apex_pt = gmsh.model.occ.addPoint(a_epi,0.0,0.0,0,-1)

and transform it (translate and rotate) with a routine that I wrote:

transform([0,apex_pt])

Having inspected the geometry and mesh, I know that the transformation puts the point in the correct position. However, I cannot work out how to find the coordinates of the new point. I have tried using getEntities (for dimension 0 entities) and getNodes for each entity returned, but this does not work for the one particular entity which is my apex_pt.

Any help would be much appreciated.

Thanks,

Peter.

---------------------------------------------------------------------

Associate Professor Peter Johnston (FAustMS, FIMA)
School of Environment and Science
Griffith University | Nathan | QLD 4111 | Technology (N44) Room 3.19
T +61 7 373 57748| F +61 7 373 57656 Email p.johnston at griffith.edu.au<mailto:p.johnston at griffith.edu.au>
_______________________________________________
gmsh mailing list
gmsh at onelab.info<mailto:gmsh at onelab.info>
http://onelab.info/mailman/listinfo/gmsh<http://onelab.info/mailman/listinfo/gmsh>


--
Max Orok
Contractor
www.mevex.com<http://www.mevex.com>

[https://docs.google.com/uc?export=download&id=1fHTIiW4OMUjQr1iOkspQ7wiEsxunoOs0&revid=0B6x5w-5zVaEjSkpwbm5oY29jbG1XMzJoYldXTmJpNGFtb3dVPQ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20191001/63355d50/attachment-0001.html>


More information about the gmsh mailing list