Transforms

Move, rotate, scale, and mirror shapes to position them precisely in 3D space

Overview

Transform operations allow you to manipulate shapes in 3D space without changing their geometry. These operations are essential for positioning components, creating symmetry, and building assemblies from individual parts.

All transform operations return a new shape object, leaving the original unchanged. This allows you to reuse base geometries in multiple positions or orientations.

Commands

translate

Moves a shape by a specified distance along the X, Y, and Z axes. This is the most common transform operation, used to position shapes in your design.

Parameters:

  • shape - The shape object to move
  • x - Distance to move along X axis (mm)
  • y - Distance to move along Y axis (mm)
  • z - Distance to move along Z axis (mm)
// Move a box 50mm along the X axis
box = create_box(20, 20, 20)
moved_box = translate(box, 50, 0, 0)

// Position a cylinder at a specific location
cylinder = create_cylinder(radius=10, height=30)
positioned = translate(cylinder, 25, 25, 10)

// Combine translation in all axes
sphere = create_sphere(radius=5)
sphere = translate(sphere, 10, 20, 30)

rotate

Rotates a shape around the X, Y, or Z axis by a specified angle in degrees. The rotation is performed around the origin (0, 0, 0).

Parameters:

  • shape - The shape object to rotate
  • axis - Rotation axis: "X", "Y", or "Z"
  • angle - Rotation angle in degrees (positive = counter-clockwise)
// Rotate a box 45 degrees around the Z axis
box = create_box(30, 10, 10)
rotated = rotate(box, "Z", 45)

// Create a tilted cylinder
cylinder = create_cylinder(radius=5, height=40)
tilted = rotate(cylinder, "Y", 30)

// Combine rotations (apply sequentially)
shape = create_box(40, 20, 10)
shape = rotate(shape, "Z", 45)
shape = rotate(shape, "X", 30)

// Rotation around different axis
cone = create_cone(radius1=10, radius2=5, height=30)
cone = rotate(cone, "Y", 90)  // Now points along X axis

Note: Rotation is always performed around the origin. To rotate around a different point, first translate to the origin, rotate, then translate back.

scale

Changes the size of a shape by multiplying its dimensions by scale factors. You can scale uniformly or non-uniformly along different axes.

Parameters:

  • shape - The shape object to scale
  • scale_x - Scale factor for X axis (1.0 = no change)
  • scale_y - Scale factor for Y axis (1.0 = no change)
  • scale_z - Scale factor for Z axis (1.0 = no change)
// Uniformly scale a shape to double its size
box = create_box(10, 10, 10)
larger = scale(box, 2.0, 2.0, 2.0)

// Non-uniform scaling (stretch along one axis)
cylinder = create_cylinder(radius=10, height=20)
stretched = scale(cylinder, 1.0, 1.0, 2.0)  // Double the height

// Create a flattened sphere (ellipsoid)
sphere = create_sphere(radius=20)
ellipsoid = scale(sphere, 1.0, 1.0, 0.5)

// Scale down to create smaller version
original = create_box(100, 80, 50)
miniature = scale(original, 0.1, 0.1, 0.1)

Warning: Negative scale factors will mirror and invert the shape. For mirroring, use the dedicated mirror() command instead.

mirror

Creates a mirror image of a shape across a specified plane. This is useful for creating symmetric designs and reducing modeling work.

Parameters:

  • shape - The shape object to mirror
  • plane - Mirror plane: "XY", "XZ", or "YZ"
// Mirror a shape across the YZ plane
original = create_box(30, 20, 10)
original = translate(original, 10, 0, 0)
mirrored = mirror(original, "YZ")

// Create a symmetric design by mirroring
left_half = create_box(20, 30, 10)
left_half = translate(left_half, -20, 0, 0)
right_half = mirror(left_half, "YZ")
symmetric = union(left_half, right_half)

// Mirror across XZ plane (flip top to bottom)
top_piece = create_cylinder(radius=15, height=10)
top_piece = translate(top_piece, 0, 0, 10)
bottom_piece = mirror(top_piece, "XZ")

// Complex symmetric shape
quarter = create_box(25, 25, 10)
quarter = translate(quarter, 0, 0, 0)
half = union(quarter, mirror(quarter, "YZ"))
full = union(half, mirror(half, "XZ"))

Transform Combinations

Transforms can be combined to achieve complex positioning. The order of operations matters - transforms are applied in the order they are called.

// Example: Position a tilted support beam
beam = create_box(100, 10, 10)

// First rotate around Y axis to tilt it
beam = rotate(beam, "Y", 30)

// Then translate to final position
beam = translate(beam, 50, 0, 25)

// Creating a circular array of shapes
base_shape = create_box(5, 5, 20)
base_shape = translate(base_shape, 30, 0, 0)  // Move away from center

array = [base_shape]
for i in range(1, 8):
    angle = i * 45  // 45 degrees apart
    rotated = rotate(base_shape, "Z", angle)
    array.append(rotated)

result = union(*array)

Coordinate Systems

Understanding Conjure's coordinate system is essential for effective use of transforms:

  • X axis - Typically represents left/right, positive to the right
  • Y axis - Typically represents front/back, positive toward the back
  • Z axis - Represents up/down, positive upward
  • Origin (0,0,0) - The center point where all axes meet
  • Rotations follow the right-hand rule: positive angles rotate counter-clockwise when looking along the axis toward the origin

Best Practices

  • Always create shapes at the origin first, then transform them into position
  • For complex assemblies, consider using variables to store key positions and reusing them
  • Use mirror operations instead of creating duplicate geometry manually - it's more efficient and easier to maintain
  • When combining rotate and translate, generally rotate first, then translate to avoid unexpected results
  • Use the measure() command to verify positions after transforms
  • Keep scale factors consistent across axes unless you specifically need distortion

Example: Creating a Wheel

This example demonstrates how transforms can build complex assemblies:

// Create the wheel rim
rim = create_cylinder(radius=50, height=10)

// Create a spoke
spoke = create_box(4, 100, 10)
spoke = translate(spoke, -2, -50, 0)

// Create an array of spokes by rotating
spokes = [spoke]
for i in range(1, 8):
    angle = i * 45
    rotated_spoke = rotate(spoke, "Z", angle)
    spokes.append(rotated_spoke)

// Combine rim and spokes
wheel = union(rim, *spokes)

// Add a hub at the center
hub = create_cylinder(radius=15, height=15)
hub = translate(hub, 0, 0, -2.5)
wheel = union(wheel, hub)

// Cut a hole for the axle
axle_hole = create_cylinder(radius=8, height=20)
axle_hole = translate(axle_hole, 0, 0, -5)
wheel = cut(wheel, axle_hole)

// Position the wheel where needed
wheel = rotate(wheel, "Y", 90)  // Orient horizontally
wheel = translate(wheel, 100, 0, 50)  // Move to position