Keeping molecular structure intact during changes to the lattice parameters

There can be situations where it’s desirable to change the simulation cell dimension(s) while keeping the structure (inter-atomic arrangement) not to scale-along. For example, one may need to increase/reduce the vacuum space when modeling surfaces while keeping the surface slab intact. There’s a convenient utility in MS (Materials Studio) Visualizer for the purpose, by turning off the option, “Keep fractional coordinates fixed during changes to the lattice” (Menu Select Build | Symmetry | Lattice Parameters | Advanced | Keep fractional coordinates fixed during changes to the lattice). How would one achieve the same in MS scripting?

The attached simple script/example demonstrates how one may achieve such adjustment along the c-dimension of the simulation cell. One can adopt it to other dimensions through minor modification.

Note: There can be other approaches for the same purpose, cf. an early discussion by Carsten MENKE in this forum.