cadquery
Sketch
Workplane
Assembly

Workplane.moveTo()

The moveTo() method of the Workplane class in CadQuery moves the current workplane to a new location in 3D space.

Syntax

moveTo(point: Tuple[float, float, float]) -> 'Workplane'

The point parameter is a tuple representing the new location of the workplane in 3D space. The values in the tuple represent the X, Y, and Z coordinates respectively.

Example Usage

import cadquery as cq

# Create a box
box = cq.Workplane("XY").box(1, 1, 1)

# Move the workplane to a new location
box = box.moveTo((0, 0, 2))

# Extrude the box
result = box.extrude(1)

In this example, a new workplane is created on the XY plane and a 1 x 1 x 1 box is created. The moveTo() method is then used to move the workplane to a new location 2 units along the Z axis. Finally, the box is extruded by 1 unit to create a rectangular prism.

Returns

The moveTo() method returns a new Workplane object that represents the updated position of the workplane.

Notes

  • The moveTo() method does not affect the location of any existing geometry on the workplane. It only affects the position of the workplane itself.
  • The moveTo() method can be used multiple times to change the position of the workplane as needed.