Skip to content

compas_cnc.toolpath_2d_ramp.toolpath_2d_ramp ¤

toolpath_2d_ramp(path, descent, step=None, ramp_angle=None, bottom_pass=True, safe_z=None, offset=0.0, notch=0.0, notch_flip=False, direction=None, pocket=True)

Ramp (linear-plunge) tool-path that descends gradually along an OPEN polyline, sweeping it back and forth.

The path may be a single straight line -- a narrow slot the tool cannot clear sideways, so it follows the centreline and saws straight down -- or a multi-segment path, e.g. the end-cap arc sliced out of a part's silhouette outline, so the tool can ramp down AROUND the end of a beam to cut it off instead of plunging straight. Each back-and-forth traverse of the path descends by step (Z interpolated by arc length, so the slope is even), down to the floor, then an optional flat finishing pass cleans the bottom.

Sequence of the path: plunge from safe_z to the start of the path, the descending sweeps, an optional flat floor pass, then a retract to safe_z.

Parameters:

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

    The open path to ramp along, positioned at the MOUTH (top) of the cut. A :class:~compas.geometry.Line or 2-point polyline gives a straight slot.

  • descent (:class:`compas.geometry.Vector`) –

    Vector from the mouth straight to the floor; its length is the cut depth and its direction is the descent direction (typically straight down).

  • step (float, default: None ) –

    Target vertical descent per pass; actual is <= step (pass count rounded up). Takes precedence over ramp_angle.

  • ramp_angle (float, default: None ) –

    Ramp angle in radians, used when step is not given: per-pass descent is path_length * tan(ramp_angle). Defaults to :data:RAMP_ANGLE_DEFAULT.

  • bottom_pass (bool, default: True ) –

    Add one flat finishing pass along the path at full depth. Defaults to True.

  • safe_z (float, default: None ) –

    World-Z to plunge from / retract to. Clamped up to at least :data:MIN_CLEARANCE above the mouth. Defaults to mouth_z + MIN_CLEARANCE.

  • offset (float, default: 0.0 ) –

    Offset the path in its plane BEFORE ramping. For an OPEN path this is a single-sided parallel offset (sign picks the side, via :func:compas.geometry.offset_polyline) -- use it to space parallel ramp lanes off one centreline. For a CLOSED path it is a uniform inset of the whole perimeter (positive insets, via :func:compas.geometry.offset_polygon), so a tool-radius band wraps every side and the incline is preserved. Defaults to 0.0 (no offset).

  • notch (float, default: 0.0 ) –

    Tool radius for inside-corner NOTCHES (dogbone corner relief). At every concave vertex the cut overcuts along the corner BISECTOR -- the average direction of the two edges, away from both neighbours into the solid -- so a round tool of this radius clears the corner. Penetration follows NGon's Ears.cs: R/sin(phi/2) - R for a corner of angle phi. The notch is an in-and-out excursion cut on every descending pass. Defaults to 0.0 (off).

  • notch_flip (bool, default: False ) –

    Which corner HANDEDNESS gets notched. By default the convex corners of a closed pocket (turn matching the path winding) -- the ones a round tool leaves material in; flip for the other handedness (an island's corners, or the other side of an open path). Defaults to False.

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

    Milling direction for hard materials (assumes a CW / M3 tool; on M4 pick the opposite label). Only applies to a CLOSED ramp loop: it winds every lap the same way to suit. An OPEN ramp is a plunge, so direction is a no-op there. Defaults to None.

  • pocket (bool, default: True ) –

    For a closed loop with direction set: True if the loop is a pocket / outer wall (cleared region inside), False if it profiles an island / part outline (kept material inside). Sets which winding is climb. Defaults to True.

Attributes:

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

    The full tool-centre path: plunge, ramp, floor pass, retract.

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

    The descending sweeps (and floor pass), without the lead-in/out.

  • notches (list[tuple[:class:`compas.geometry.Point`, :class:`compas.geometry.Point`]]) –

    (corner, tip) pairs at the mouth, one per notched inside corner.

  • passes (int) –
  • step (float) –
  • ramp_angle (float) –
  • depth (float) –
  • safe_z (float) –
  • offset (float) –

from_box classmethod ¤

from_box(mesh, end_inset=0.0, step=None, ramp_angle=None, bottom_pass=True, safe_z=None, offset=0.0)

Build a straight-slot ramp from a thin box-shaped cutter solid.

A slot only as wide as the tool cannot be cleared sideways, so the tool follows the slot's CENTRELINE and ramps down. The box's three edge directions are recovered from a corner. The edge most aligned with world Z is the DEPTH (descent) axis; of the other two the longer is the cut LINE and the shorter is the slot WIDTH (ignored -- it is what makes the slot too narrow to clear sideways). The centreline runs along the cut axis, centred in width, at the top of the depth axis.

Parameters:

  • mesh (:class:`compas.datastructures.Mesh`) –

    A box cutter (8 vertices, every corner of degree 3).

  • end_inset (float, default: 0.0 ) –

    Pull the centreline ends in from the short end faces by this much (e.g. the tool radius, so the tool stays within the slot). Defaults to 0.0.

Returns:

  • class:`toolpath_2d_ramp` | None

    None if mesh is not a clean box.

from_outline classmethod ¤

from_outline(outline, depth, top_z=0.0, end='start', cap=None, axis=None, step=None, ramp_angle=None, bottom_pass=True, safe_z=None, offset=0.0, notch=0.0, notch_flip=False)

Slice the cap around ONE end out of a closed silhouette and ramp it down.

The beam's long axis is taken from axis or, by default, the longer side of the outline's bounding box. Outline vertices within cap of the chosen end (along that axis) form a single contiguous arc -- the end cap -- which is lifted to top_z and ramped straight down by depth.

Parameters:

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

    A closed silhouette outline (e.g. from :func:compas_cnc.outline).

  • depth (float) –

    How far to descend (the beam height at the end).

  • top_z (float, default: 0.0 ) –

    Z of the mouth -- the top of the beam where cutting starts. The outline is flat, so its own Z is replaced by this. Defaults to 0.0.

  • end ((start, end), default: "start" ) –

    Which end along the axis: "start" is the low-coordinate end, "end" the high one. Defaults to "start".

  • cap (float, default: None ) –

    How far in from the end (along the axis) to include. Small values give a near-straight line across the end; larger values wrap further down the sides. Defaults to the full cross-width of the outline.

  • axis (tuple, default: None ) –

    (x, y) beam long-axis direction. Defaults to the outline's longer bounding-box side.

Returns:

  • class:`toolpath_2d_ramp`