> On 13 Jan 2020, at 19:15, Max Orok <[email protected]> wrote:
> 
> Hi Jeremy, thanks for your response. 
> This is kind of what I've got going right now with the attached scripts: 
> 
> I'd like to be able to do this in the GUI, just because the adjustment is a 
> little touchy. 
> Maybe an extension could be to combine these into a ONELAB client and try it 
> that way. 
> I also considered adding a plugin but perhaps the ONELAB route is fastest. 
> 

You can directly change the mesh and run the GUI in the script:

import sys
import gmsh

if len(sys.argv) != 5:
    print("usage: shift.py <mesh-file.msh> x-shift y-shift z-shift > out-nodes")
    exit(1)

fname = sys.argv[1]
x_shift = float(sys.argv[2])
y_shift = float(sys.argv[3])
z_shift = float(sys.argv[4])

gmsh.initialize()
gmsh.open(fname)

(nodes, coords, _) = gmsh.model.mesh.getNodes()

for i, tag in enumerate(nodes):
    gmsh.model.mesh.setNode(tag, [coords[3*i] + x_shift, coords[3*i+1] + y_shift, coords[3*i+2] + z_shift], [])

gmsh.fltk.run()

gmsh.finalize()

Christophe

> Max 
> <scale.py><shift.py>_______________________________________________
> gmsh mailing list
> [email protected]
> http://onelab.info/mailman/listinfo/gmsh

— 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine



_______________________________________________
gmsh mailing list
[email protected]
http://onelab.info/mailman/listinfo/gmsh

Reply via email to