Skip to content

cskHole generates incorrect results for shallow holes #1653

Open

Description

@TheLostLambda

cadquery/cadquery/cq.py

Lines 2930 to 2988 in 3cd327a

def cskHole(
self: T,
diameter: float,
cskDiameter: float,
cskAngle: float,
depth: Optional[float] = None,
clean: bool = True,
) -> T:
"""
Makes a countersunk hole for each item on the stack.
:param diameter: the diameter of the hole
:type diameter: float > 0
:param cskDiameter: the diameter of the countersink, must be greater than hole diameter
:param cskAngle: angle of the countersink, in degrees ( 82 is common )
:type cskAngle: float > 0
:param depth: the depth of the hole
:type depth: float > 0 or None to drill thru the entire part.
:param clean: call :meth:`clean` afterwards to have a clean shape
The surface of the hole is at the current workplane.
One hole is created for each item on the stack. A very common use case is to use a
construction rectangle to define the centers of a set of holes, like so::
s = (
Workplane()
.box(2, 4, 0.5)
.faces(">Z")
.workplane()
.rect(1.5, 3.5, forConstruction=True)
.vertices()
.cskHole(0.125, 0.25, 82, depth=None)
)
This sample creates a plate with a set of holes at the corners.
**Plugin Note**: this is one example of the power of plugins. CounterSunk holes are quite
time consuming to create, but are quite easily defined by users.
see :meth:`cboreHole` to make counterbores instead of countersinks
"""
if depth is None:
depth = self.largestDimension()
boreDir = Vector(0, 0, -1)
center = Vector()
# first make the hole
hole = Solid.makeCylinder(
diameter / 2.0, depth, center, boreDir
) # local coords!
r = cskDiameter / 2.0
h = r / math.tan(math.radians(cskAngle / 2.0))
csk = Solid.makeCone(r, 0.0, h, center, boreDir)
res = hole.fuse(csk)
return self.cutEach(lambda loc: res.moved(loc), True, clean)

If the cone generated by the angle and diameter is taller than the depth of the hole, it still cuts through and forms a conical cutout where I think it should be truncated.

I'll add more details soon, and am also happy to submit a PR myself unless someone beats me to it!

Activity

  1. jmwright commented on Sep 5, 2024

    @jmwright
    Member

    @TheLostLambda Could you post a screenshot for more context?

  2. eternal-sorrow commented on Feb 20, 2026

    @eternal-sorrow

    Here's a screenshot of my case:

    Image

    The code:

    result = (
    	cq.Workplane("XY")
    	.cylinder(15, 30)
    	.faces('>Z')
    	.workplane()
    	.cskHole(56, 58, 45, 13)
    )
    

    There is supposed to be no hole at the bottom of the "cup". Just a cup with a chamfer on the inner edge.

    Also since I'm here: I'm new with CadQuery, how do I chamfer of fillet circular edges, like a cylinder in my case?

  3. added
    bug
    on Feb 20, 2026
  4. jmwright commented on Feb 22, 2026

    @jmwright
    Member

    how do I chamfer of fillet circular edges, like a cylinder in my case?

    You can select circular edges with the %CIRCLE type selector. You can chain selectors too so that you can narrow the edge down even more. https://cadquery.readthedocs.io/en/latest/classreference.html#cadquery.TypeSelector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions