मुख्य सामग्री पर जाएँ

raygeo.cnc.plan.drilling

CNC drilling plan builder.

Produces a plan that drills holes: one cycle per hole, all sharing the same parameters. Holes come either from an explicit center list or are detected automatically as circular island contours of the face. Cycles are expanded into explicit moves and wrapped in DRILL_CYCLE sections so encoders can substitute canned cycles.

Functions​

plan_drilling()​

plan_drilling(
part: ops.part.Part,
face_id: str = '',
cycle: str = 'plain',
diameter: float = 5,
target_z: float = -10,
tip_angle_deg: float = 118,
z_surface: float = 0,
rapid_z: float = 1,
safe_z: float = 5,
peck_increment: float = 1,
chip_break_retract: float = 0.5,
dwell_ms: float = 0,
feed_rate: Optional[float] = None,
plunge_feed: Optional[float] = None,
spindle_rpm: Optional[int] = None,
coolant: Optional[str] = None,
holes: Optional[Sequence[tuple[float, float]]] = None,
hole_tolerance: float = 0.1,
hole_order: str = 'detection',
) -> cnc.plan.Plan

Build a plan that drills holes on one face.

One cycle per hole; all holes share the parameters. Holes come from holes when given (explicit centers, in solid material — typical for spot drilling), otherwise they are detected as circular island contours of the face (existing bores, e.g. to re-drill or countersink). Islands smaller than the drill diameter are skipped in detection mode. target_z is the full-diameter depth; the tip descends deeper by the tip compensation (diameter / 2) / tan(tip_angle / 2). Holes needing different depths or parameters need a separate call.

Cycles: "plain" single plunge, "spot" shallow marking cycle, "peck" full-retract pecking (G83), "chip_break" chip-break pecking (G73).

ParameterTypeDescription
partops.part.Partpart whose face is drilled.
face_idstr = ''face to drill ("" is the default face).
cyclestr = 'plain'"plain", "spot", "peck" or "chip_break".
diameterfloat = 5drill (and hole) diameter (mm).
target_zfloat = -10full-diameter depth (mm).
tip_angle_degfloat = 118drill point angle in degrees (default 118).
z_surfacefloat = 0surface Z the holes start at (default 0).
rapid_zfloat = 1rapid plane above the surface (default 1).
safe_zfloat = 5safe rapid height (default 5).
peck_incrementfloat = 1axial depth per peck (mm); pecking cycles only.
chip_break_retractfloat = 0.5chip-break retract distance (mm); chip-break only.
dwell_msfloat = 0dwell at the bottom of every plunge (ms).
feed_rateOptional[float] = Nonecut feed (mm/min); None leaves the plan's cut state unset.
plunge_feedOptional[float] = Nonevertical plunge feed (mm/min); None falls back to the cut feed.
spindle_rpmOptional[int] = Nonespindle speed (rpm).
coolantOptional[str] = None"flood", "mist" or "off"; None leaves the plan's coolant unset.
holesOptional[Sequence[tuple[float, float]]] = Noneexplicit hole centers [(x, y), ...]; None detects circular islands on the face.
hole_tolerancefloat = 0.1max distance (mm) between an island contour sample and the fitted circle for it to count as a hole (default 0.1).
hole_orderstr = 'detection'"detection" or "nearest_neighbor".
Returnscnc.plan.Planthe drilling plan, one step per hole.

Peck drilling of two detected holes; right: the plunge/retract profile of the first cycle.

Peck drilling of two detected holes; right: the plunge/retract profile of the first cycle.

Plain cycles at explicit centers in solid material with safe-Z travel between holes.

Plain cycles at explicit centers in solid material with safe-Z travel between holes.