[Gmsh] Finding coordinates of transformed point in python api
Max Orok
morok at mevex.com
Mon Sep 30 20:39:45 CEST 2019
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>
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
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh
>
--
Max Orok
Contractor
www.mevex.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20190930/6e598684/attachment.html>
-------------- next part --------------
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)
print("x: {}, y: {}, z: {}".format(x, y, z))
gmsh.finalize()
More information about the gmsh
mailing list