Chamfer difficulty

7 views
Skip to first unread message

Monty Zukowski

unread,
Apr 13, 2026, 12:18:41 PM (2 days ago) Apr 13
to CadQuery
I'm happy with this shape, a box with a long chamfer:


import cadquery as cqfrom cadquery.func import torus,box, cylinder, chamfer
from ocp_vscode import *

# measurements are in mm, hence the *25.4
die_radius = 4.2/2.0*25.4 # Radius of the plate
thickness = 1.0*25.4 # Thickness of the plate
wall_thickness = 3/8*25.4
fin_thickness = 1/8*25.4
cylinder_radius = 4.0/2.0*25.4 # Radius of extruded cylinder outer wall
chamfer_size = 10.0
chamfer_depth = 20.0

result4 = cq.Workplane("XY").box(cylinder_radius*2.0,fin_thickness,thickness/4.0).edges("|X and <Z").chamfer(3, fin_thickness/2.5)

show(result4)

However, when I try to embed it into my larger object like so, I get this error:

import cadquery as cq
from cadquery.func import torus,box, cylinder, chamfer
from ocp_vscode import *

# measurements are in mm, hence the *25.4
die_radius = 4.2/2.0*25.4 # Radius of the plate
thickness = 1.0*25.4 # Thickness of the plate
wall_thickness = 3/8*25.4
fin_thickness = 1/8*25.4
cylinder_radius = 4.0/2.0*25.4 # Radius of extruded cylinder outer wall
chamfer_size = 10.0
chamfer_depth = 20.0

result = ( cq.Workplane("XY")
.circle(cylinder_radius - wall_thickness)
.extrude(thickness)
.tag("base")
.edges(">Z").chamfer(chamfer_depth, chamfer_size)
.transformed(rotate=(0, 180, 0))
.text(
"""4.0" dia. tube\n3/8" thick""", # The text string
fontsize=12, # Size of the text
distance=0.33, # Extrusion distance (depth)
combine=True
)
.faces("<Z", tag="base").workplane()
.transformed(rotate=(0, 180, 0))
.circle(die_radius)
.circle(cylinder_radius)
.extrude(thickness)
.faces(">Z", tag="base").workplane()
.transformed(offset=(0,0,-0.125*thickness))
.box(cylinder_radius*2,fin_thickness,thickness/4.0)
.edges("|X and <Z").chamfer(3, fin_thickness/2.5)
)

result4 = cq.Workplane("XY").box(cylinder_radius*2.0,fin_thickness,thickness/4.0).edges("|X and <Z").chamfer(3, fin_thickness/2.5)

show(result)


Traceback (most recent call last):
File "/home/monty/code/extruder-cad/cylinder copy.py", line 34, in <module>
.edges("|X and <Z").chamfer(3, fin_thickness/2.5)
~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/home/monty/code/extruder-cad/.venv/lib/python3.13/site-packages/cadquery/cq.py", line 1278, in chamfer
s = solid.chamfer(length, length2, edgeList)
File "/home/monty/code/extruder-cad/.venv/lib/python3.13/site-packages/cadquery/occ_impl/shapes.py", line 3768, in chamfer
return self.__class__(chamfer_builder.Shape())
~~~~~~~~~~~~~~~~~~~~~^^
OCP.OCP.StdFail.StdFail_NotDone: BRep_API: command not done

Note that if I comment out the line starting with .edges(...), it makes the box the right size and puts it in the place I want it. I'm not sure why chamfer isn't working for me in this context but works in the standalone example.

Thanks,

Monty

Lorenz

unread,
Apr 13, 2026, 10:07:02 PM (2 days ago) Apr 13
to CadQuery

>  I'm not sure why chamfer isn't working for me in this context but works in the standalone example.

It doesn't work because the edge selector now returns edges that you didn't intend to select.  It is selecting many edges from the text.

I'd suggest to break this up so it is easier to select the edges you want.  Try something like this:



import cadquery as cq

# from cadquery.func import box

# from ocp_vscode import *


# measurements are in mm, hence the *25.4
die_radius = 4.2 / 2.0 * 25.4  # Radius of the plate
thickness = 1.0 * 25.4  # Thickness of the plate

wall_thickness = 3 / 8 * 25.4
fin_thickness = 1 / 8 * 25.4
cylinder_radius = 4.0 / 2.0 * 25.4  # Radius of extruded cylinder outer wall

chamfer_size = 10.0
chamfer_depth = 20.0

part1 = (

    cq.Workplane("XY")
    .circle(cylinder_radius - wall_thickness)
    .extrude(thickness)
    .edges(">Z")
    .chamfer(chamfer_depth, chamfer_size)
)

text1 = (
    cq.Workplane("XY")

    .text(
        """4.0" dia. tube\n3/8" thick""",  # The text string
        fontsize=12,  # Size of the text
        distance=0.33,  # Extrusion distance (depth)
    )
    .val()
    .moved(ry=180)
)
part1 = part1.union(text1)


part2 = (
    (
        cq.Workplane()
        .box(
            cylinder_radius * 2,
            fin_thickness,
            thickness / 4.0,
            centered=(True, True, False),
        )
        .edges("|X and <Z")
        .chamfer(3, fin_thickness / 2.5)
    )
    .val()
    .moved(z=thickness - thickness / 4.0)
)

# or free func version
# part2 = box(cylinder_radius * 2, fin_thickness, thickness / 4.0).moved(
#    z=thickness - thickness / 4.0
# )
# part2 = part2.chamfer(3, fin_thickness / 2.5, part2.edges("|X and <Z").Edges())


part3 = cq.Workplane().circle(die_radius).circle(cylinder_radius).extrude(thickness)

result = part1.union(part2).union(part3)

Monty Zukowski

unread,
Apr 14, 2026, 11:47:34 AM (23 hours ago) Apr 14
to CadQuery
Thanks Lorenz, that makes a lot of sense now. I appreciate you reworking my example! That gives me a better idea of how to structure things.

Monty
Reply all
Reply to author
Forward
0 new messages