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.

Max
import sys
import gmsh

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

fname = sys.argv[1]

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

if len(sys.argv) == 5:
    x_scale = float(sys.argv[2])
    y_scale = float(sys.argv[3])
    z_scale = float(sys.argv[4])

    for i, tag in enumerate(nodes):
        print(str(i+1), coords[3*i] * x_scale, coords[3*i+1] * y_scale, coords[3*i+2] * z_scale)

else:
    glob_scale = float(sys.argv[2])
    for i, tag in enumerate(nodes):
        print(str(i+1), coords[3*i] * glob_scale, coords[3*i+1] * glob_scale, coords[3*i+2] * glob_scale)

gmsh.finalize()
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):
    print(str(i+1), coords[3*i] + x_shift, coords[3*i+1] + y_shift, coords[3*i+2] + z_shift)

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

Reply via email to