How to apply transformations (e.g. Rotation, Translation, Scaling) to model objects using Python?

There are Python commands to apply Scaling, Translation, or Rotation transformations to any model entity.
 You first have to import the right module:
from s4l_v1.model import Vec3, Translation, Transform
 Then you have to define a transformation:
t = Translation(Vec3(20, 16, 10)) # for a translation t = Rotation(Vec3(0, 0, 1), numpy.pi / 4) # for a rotation of angle pi/4 around the zaxis
 Finally you can apply the transformation to a model entity:
case = model.CreateSolidBlock(Vec3(0, 0, 0), Vec3(40, 16, 140)) case.ApplyTransform( t )
For further example, users are encouraged to look at the tutorial Python Scripts, as described in section "2.19.2 Examples" of Sim4Life user manual:
Complete Python script examples can be found in the Public Documents folder of your system under:
\Sim4Life\3.4\Documentation\Tutorials\Tutorial Scripts.
Alternatively, access the Tutorials folder via the Windows start menu →→ All Programs →→ Sim4Life V 3.4 →→ Documentation →→Explore Documentation and open Tutorials  Tutorial Scripts. These scripts can be executed directly in Sim4Life and faithfully reproduce the workflow of many > of the provided tutorials. They contain diverse examples of: how to generate 3D model objects
 how to set up different types of simulations
 how to postprocess the results
Note also that you can find documentation regarding the different possible transformation in the API Browser (click VIEW> API Browser in the main menu) or type help(Translation) (for example) in the Console:
>>> help(Translation) Help on builtin function Translation in module XCoreMath: Translation(...) Translation( (Vec3)translation_vec3) > Transform : Constructs a translation Transform given by a translation Vec3. >>> help(Rotation) Help on builtin function Rotation in module XCoreMath: Rotation(...) Rotation( (Vec3)axis, (float)angle_in_rad) > Transform : Constructs a rotation Transform given the rotation axis as a Vec3 and the rotation angle in radians. Rotation( (int)axis, (float)angle_in_rad) > Transform : Constructs a rotation Transform given the rotation axis as an integer (0,1,2) and the rotation angle in radians. Rotation( (Vec3)axis, (Vec3)origin, (float)angle_in_rad) > Transform : Constructs a rotation around the given axis at origin by given angle in radians. Rotation( (Vec3)from_vector, (Vec3)to_vector) > Transform : <p>Constructs a rotation which maps from a given direction vector to another.</p><p>The rotation axis is chosen to be perpendicular to the plane defined by the two vectors such that the rotational path is the shortest.</p>