Repository navigation
Open
Labels
bugSomething isn't working
Description
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!
Reacted by Eternal Sorrow
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
jmwright commentedon Sep 5, 2024
@TheLostLambda Could you post a screenshot for more context?
eternal-sorrow commentedon Feb 20, 2026
Here's a screenshot of my case:
The code:
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?
jmwright commentedon Feb 22, 2026
You can select circular edges with the
%CIRCLEtype 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