Primitives

Create basic 3D geometric shapes as building blocks for your CAD designs

Overview

Primitive shapes are the fundamental building blocks of CAD modeling. Conjure provides a set of common 3D primitives that can be created, positioned, and combined to form more complex geometries.

All primitives are created at the origin by default and can be positioned using transform operations. Each primitive returns a shape object that can be used in subsequent operations.

Commands

box

Creates a rectangular box (cuboid) with specified dimensions along the X, Y, and Z axes.

Parameters:

  • length - Size along the X axis (mm)
  • width - Size along the Y axis (mm)
  • height - Size along the Z axis (mm)
// Create a 10mm cube
create_box(10, 10, 10)

// Create a rectangular box
create_box(length=50, width=30, height=20)

cylinder

Creates a cylindrical shape with a circular base. The cylinder is centered at the origin and extends along the Z axis.

Parameters:

  • radius - Radius of the circular base (mm)
  • height - Height along the Z axis (mm)
// Create a cylinder with 10mm radius and 50mm height
create_cylinder(radius=10, height=50)

// Create a thin disk
create_cylinder(radius=25, height=2)

sphere

Creates a perfect sphere centered at the origin. Useful for rounded features and ball joints.

Parameters:

  • radius - Radius of the sphere (mm)
// Create a sphere with 15mm radius
create_sphere(radius=15)

// Create a small ball bearing
create_sphere(radius=5)

cone

Creates a conical shape with a circular base tapering to a point or smaller circle at the top.

Parameters:

  • radius1 - Radius at the base (mm)
  • radius2 - Radius at the top (mm, default: 0 for pointed cone)
  • height - Height along the Z axis (mm)
// Create a pointed cone
create_cone(radius1=20, radius2=0, height=40)

// Create a truncated cone (frustum)
create_cone(radius1=20, radius2=10, height=30)

torus

Creates a torus (donut shape) by revolving a circle around an axis. Useful for O-rings, gaskets, and decorative elements.

Parameters:

  • major_radius - Distance from center to the tube center (mm)
  • minor_radius - Radius of the tube cross-section (mm)
// Create an O-ring shape
create_torus(major_radius=30, minor_radius=5)

// Create a large torus
create_torus(major_radius=50, minor_radius=10)

create_helix

Create a helix wire for springs, threads, worms, and spiral ramps.

  • radius - Helix radius in mm (minor radius for conical)
  • pitch - Vertical advance per revolution (mm)
  • height - Total height (mm)
  • angle - Cone angle in degrees (0=cylindrical, default 0)
  • left_hand - True for left-handed helix (default false)
// Cylindrical helix for a spring
create_helix(radius=10, pitch=5, height=50)

// Conical helix (tapered spring)
create_helix(radius=8, pitch=4, height=40, angle=15)

// Left-handed helix
create_helix(radius=10, pitch=5, height=50, left_hand=true)

Usage Tips

  • All dimensions are in millimeters (mm) by default
  • Primitives are created at the origin (0, 0, 0) - use translate() to position them
  • Combine primitives using boolean operations like union(), cut(), and intersect()
  • Use primitives as starting points for more complex features like fillets, chamfers, and extrusions

Example: Creating a Bolt

Here's how to combine primitives to create a simple bolt:

// Create the bolt head (hexagonal approximation using a cylinder)
head = create_cylinder(radius=8, height=5)

// Create the bolt shaft
shaft = create_cylinder(radius=4, height=30)
shaft = translate(shaft, 0, 0, 5)

// Combine head and shaft
bolt = union(head, shaft)

// Add a chamfer at the tip (using a cone)
tip = create_cone(radius1=4, radius2=0, height=4)
tip = translate(tip, 0, 0, 35)
bolt = union(bolt, tip)