3DCoatScripting  4.8.31Ξ²
You can manage 3DΠ‘oat features with help of scripting
πŸŒ€ Mesh Transform

If you already can create meshes, then you're ready to learn how to transform them.

Now with scripts you may make 3 changes to a mesh like:

  1. Mesh position
  2. Rotation
  3. Scale

Position

Complete example for changing coordinates of the existing mesh:

void main() {

    // prepare scene
    SculptRoom room;
    room.clear().toSurface();

    // build capsule
    Builder builder;
    Mesh mesh = builder.capsule()
      .startPosition( Vec3( 0 ) )
      .endPosition( Vec3( 40, 50, 60 ) )
      .startRadius( 30 )
      .endRadius( 50 )
      .details( 0.1 )
      .build();

    // change capsule position
    mesh.tools().transform()
      .position( Vec3( 100, 50, 200 ) )
      .run();
      
    // put capsule into scene
    room += mesh;
}

For mesh transformation this class is used ToolsMeshTransform.

Rotation

We'll skip mesh creation part of the code for a more compact view in the following examples.

    // rotate capsule
    mesh.tools().transform()
      .rotation( Angles( 30, 90, 200 ) )
      .run();

Scale

    // scale capsule
    mesh.tools().transform()
      .scale( Vec3( 2, 1.5, 0.7 ) )
      .run();

Together

With fluent-interface you may simply write your code like this:

    // change position, rotate, and scale capsule
    mesh.tools().transform()
      .position( Vec3( 100, 50, 200 ) )
      .rotation( Angles( 30, 90, 200 ) )
      .scale( Vec3( 2, 1.5, 0.7 ) )
      .run();
See Also
πŸŒ€ Boolean operations for meshes
πŸŒ€ Math for 3D graphics