Workplane mental model

25 views
Skip to first unread message

Monty Zukowski

unread,
Mar 25, 2026, 12:26:41 PMMar 25
to CadQuery
This code will extrude a cylinder and then rotate the workplane and put some text on the bottom. It works, but I don't understand one thing. I would have expected that after extrusion, the face the text would be put on would be the top face, but it's actually the original circle I started with. Why is that? Is it because it's the first face of the object? If I wanted to put text on the top, would I have to select that top face first?

import cadquery as cq
from ocp_vscode import *

cyl = cq.Workplane("XY").circle(100).extrude(20).transformed(rotate=(0, 180, 0)).text(
"Cone Packs", # The text string
fontsize=15, # Size of the text
distance=1, # Extrusion distance (depth)
combine=True
)
result = cyl

show(result)

Lorenz

unread,
Mar 26, 2026, 9:42:11 PMMar 26
to CadQuery
Here is a diagram showing the chain of Workplane objects from this code example. Each step returns a new Workplane, and each one has:

- its own plane (o, x, z)
- its own list of objects
- a link to its parent

The current result is at the top and would return the Compound if you call `result.val()`.

- extrude() creates a solid, but it does not automatically move you onto the top face (see origin is always (0, 0, 0)).
- transformed() creates a new workplane orientation
- text() uses the current workplane node in the chain
- if you want the top face, explicitly select it with .faces(">Z").workplane()

diagram-wp.png

Monty Zukowski

unread,
Mar 27, 2026, 11:44:23 AMMar 27
to CadQuery
Thanks Lorenz, that's helpful to see.

Monty
Reply all
Reply to author
Forward
0 new messages