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 deg
(
self: T,
diameter: float,
cskDiameter: float,
cskAngle: float,
depth: Optional[float] = None,
clean: bool = True,
)
| 2871 | # TODO: almost all code duplicated! |
| 2872 | # but parameter list is different so a simple function pointer won't work |
| 2873 | def cskHole( |
| 2874 | self: T, |
| 2875 | diameter: float, |
| 2876 | cskDiameter: float, |
| 2877 | cskAngle: float, |
| 2878 | depth: Optional[float] = None, |
| 2879 | clean: bool = True, |
| 2880 | ) -> T: |
| 2881 | """ |
| 2882 | Makes a countersunk hole for each item on the stack. |
| 2883 | |
| 2884 | :param diameter: the diameter of the hole |
| 2885 | :type diameter: float > 0 |
| 2886 | :param cskDiameter: the diameter of the countersink, must be greater than hole diameter |
| 2887 | :param cskAngle: angle of the countersink, in degrees ( 82 is common ) |
| 2888 | :type cskAngle: float > 0 |
| 2889 | :param depth: the depth of the hole |
| 2890 | :type depth: float > 0 or None to drill thru the entire part. |
| 2891 | :param clean: call :meth:`clean` afterwards to have a clean shape |
| 2892 | |
| 2893 | The surface of the hole is at the current workplane. |
| 2894 | |
| 2895 | One hole is created for each item on the stack. A very common use case is to use a |
| 2896 | construction rectangle to define the centers of a set of holes, like so:: |
| 2897 | |
| 2898 | s = ( |
| 2899 | Workplane() |
| 2900 | .box(2, 4, 0.5) |
| 2901 | .faces(">Z") |
| 2902 | .workplane() |
| 2903 | .rect(1.5, 3.5, forConstruction=True) |
| 2904 | .vertices() |
| 2905 | .cskHole(0.125, 0.25, 82, depth=None) |
| 2906 | ) |
| 2907 | |
| 2908 | This sample creates a plate with a set of holes at the corners. |
| 2909 | |
| 2910 | **Plugin Note**: this is one example of the power of plugins. CounterSunk holes are quite |
| 2911 | time consuming to create, but are quite easily defined by users. |
| 2912 | |
| 2913 | see :meth:`cboreHole` to make counterbores instead of countersinks |
| 2914 | """ |
| 2915 | |
| 2916 | if depth is None: |
| 2917 | depth = self.largestDimension() |
| 2918 | |
| 2919 | boreDir = Vector(0, 0, -1) |
| 2920 | center = Vector() |
| 2921 | |
| 2922 | # first make the hole |
| 2923 | hole = Solid.makeCylinder( |
| 2924 | diameter / 2.0, depth, center, boreDir |
| 2925 | ) # local coords! |
| 2926 | r = cskDiameter / 2.0 |
| 2927 | h = r / math.tan(math.radians(cskAngle / 2.0)) |
| 2928 | csk = Solid.makeCone(r, 0.0, h, center, boreDir) |
| 2929 | res = hole.fuse(csk) |
| 2930 |