cadquery
Sketch
Workplane
Assembly

Workplane.circle()

The Workplane.circle() method is used to create a circle on a Workplane object in CadQuery. It takes two parameters: the radius of the circle and an optional number of segments used to create the circle.

Syntax

Workplane.circle(radius, segments)
  • radius (float): the radius of the circle to be created.
  • segments (int, optional): the number of segments used to create the circle. Default value is 32.

Returns

The Workplane.circle() method returns a new Workplane object with a circle on it.

Examples

Create a circle with a default number of segments

import cadquery as cq

# Create a new Workplane object
result = cq.Workplane("XY")

# Create a circle with a radius of 1.0
circle = result.circle(1.0)

# Display the result
show_object(circle)

Output:

Circle with default number of segments

Create a circle with a specific number of segments

import cadquery as cq

# Create a new Workplane object
result = cq.Workplane("XY")

# Create a circle with a radius of 1.0 and 64 segments
circle = result.circle(1.0, segments=64)

# Display the result
show_object(circle)

Output:

Circle with specified number of segments

Notes

  • The number of segments used to create the circle determines the smoothness of its edges. A higher number of segments results in a smoother, more accurate circle.
  • If the radius of the circle is negative, a circle with clockwise orientation will be created.