Skip to content

compas_cnc.toolpath_2d_drill.toolpath_2d_drill ¤

toolpath_2d_drill(axis, hole_radius, tool_diameter, ramp_angle=None, bottom_pass=True, floor=None, safe_z=None, direction=None)

Helical drilling / boring tool-path that spirals down a cylindrical hole.

A flat end mill of diameter tool_diameter cannot plunge straight into a hole wider than itself and clear it, so it descends on a HELIX instead (helical interpolation). The tool CENTRE travels on a helix of radius hole_radius - tool_radius around the axis -- so the tool's outer edge just reaches the hole wall -- spiralling down at ramp_angle. An optional finishing circle at the bottom cleans the floor.

The axis need not be vertical: the helix is built in the plane perpendicular to axis and descends along it, so it works for the horizontal bolt-holes in the column example as well as for vertical drilling.

If the tool is as wide as (or wider than) the hole a helix is impossible, so the path degenerates to a straight plunge down the axis (an ordinary drill) and :attr:is_drill is set.

Parameters:

  • axis (:class:`compas.geometry.Line`) –

    Hole axis. The endpoint with the larger Z is taken as the TOP (the mouth, where the tool enters); the other is the bottom. Its length is the drilling depth and its direction is the descent direction.

  • hole_radius (float) –

    Radius of the hole to bore.

  • tool_diameter (float) –

    Diameter of the cutting tool.

  • ramp_angle (float | None, default: None ) –

    Helix descent angle in RADIANS -- how steeply the tool spirals down. The tool drops 2*pi*helix_radius * tan(ramp_angle) per turn, which sets the turn count. Gentle (a few degrees) for hard material, steeper for soft. Defaults to :data:RAMP_ANGLE_DEFAULT (15 deg). Must be in (0, 90) degrees.

  • bottom_pass (bool, default: True ) –

    Add one full finishing circle at the bottom of the hole. Defaults to True.

  • floor (float | None, default: None ) –

    Lowest world-Z the tool may reach. If the bottom is below it, the bottom is raised along the axis until it sits at floor (the drill "stops there"). Skipped for a horizontal axis (no Z component to clamp). Defaults to None (no limit).

  • safe_z (float | None, default: None ) –

    World-Z for the approach and retract. The path rapids down to the entry at this Z, descends, retracts straight up at the end (same XY, Z to safe_z) and traverses home. Clamped up to at least :data:MIN_CLEARANCE above the whole descent. Defaults to that clearance height -- z-safety is ALWAYS part of the path.

  • direction ((None, climb, conventional), default: None ) –

    Milling direction for hard materials. Assumes a CW (M3) tool. The default helix already CLIMBS the bore, so None and "climb" are identical; "conventional" reverses the helix winding. No-op for a straight plunge (tool >= hole). On an M4 spindle, pick the opposite label. Defaults to None.

Attributes:

  • path (:class:`compas.geometry.Polyline`) –

    The full tool-centre path: safe-Z approach, the helix (and optional floor circle), the retract, then the safe-Z move home. Starts and ends at the same safe-Z home position.

  • helix (:class:`compas.geometry.Polyline`) –

    Just the raw descent (helix + optional floor circle), without z-safety.

  • safe_z (float) –

    The effective approach/retract height (always set).

  • drill_axis (:class:`compas.geometry.Line`) –

    The effective axis actually drilled (top -> bottom) after floor is applied.

  • depth (float) –

    Length of :attr:drill_axis.

  • helix_radius (float) –

    Radius of the helical tool-centre path (0 for a straight plunge).

  • turns (int) –

    Number of WHOLE revolutions in the descent (rounded UP so the actual ramp angle is <= the requested one, and so the helix ends under the entry, same XY, letting the tool retract straight up).

  • ramp_angle (float) –

    The ACTUAL helix angle (radians) after rounding to whole turns -- close to the requested angle; 0 for a straight plunge.

  • is_drill (bool) –

    True when the path degenerated to a straight plunge (tool >= hole).