cadquery
Sketch
Workplane
Assembly

Sketch.circle()

The Sketch.circle() method is used in CADQuery to create a 2D circular sketch.

Syntax

circle(radius, forConstruction=False)

Parameters

  • radius (float): The radius of the circle to create.
  • forConstruction (optional, bool): If set to True, the circle will be created as a construction feature, which will not be included in the final model.

Returns

A Workplane object with the circle sketch added.

Example

import cadquery as cq

# create a new 2D sketch
c = cq.Workplane("XY").circle(10)

# create a cylindrical object from the sketch
s = c.extrude(5)

# show the resulting object
show_object(s)

In this example, Sketch.circle() is used to create a circle with a radius of 10. This circle is then extruded into a cylinder with a height of 5 using the extrude() method. Finally, the resulting object is shown using the show_object() method.

Notes

  • The Sketch.circle() method creates a circle centered at the origin of the current workplane.
  • The circle can be moved or rotated using the move() and rotate() methods.
  • Multiple circles can be created on the same workplane by calling circle() multiple times, or by passing a list of radii to the circle() method.