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