Перейти до основного вмісту

raygeo.cnc.plan.thread_milling

CNC thread-milling plan builder.

Produces a plan that thread-mills internal threads: one helical interpolation cycle per pilot bore, all sharing the same thread parameters. Bores come either from an explicit center list or are detected automatically as circular island contours of the face and validated against the thread geometry.

Functions​

plan_thread_milling()​

plan_thread_milling(
part: ops.part.Part,
face_id: str = '',
nominal_diameter: float = 6,
pitch: float = 1,
tool_diameter: float = 4,
z_top: float = 0,
z_bottom: float = -12,
handedness: str = 'rh',
safe_z: float = 5,
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 thread-mills internal threads on one face.

One helical-interpolation cycle per pilot bore; all bores share the thread parameters. Bores come from holes when given (explicit centers), otherwise they are detected as circular island contours of the face and validated: the thread mill must fit into the bore, and the bore must not be oversized beyond the thread minor diameter (or there is nothing left to thread). The thread length (z_top - z_bottom) must be an integer multiple of the pitch. Bores needing different parameters need a separate call.

ParameterTypeDescription
partops.part.Partpart whose face is threaded.
face_idstr = ''face to thread ("" is the default face).
nominal_diameterfloat = 6nominal (major) thread diameter (mm).
pitchfloat = 1thread pitch (lead) (mm).
tool_diameterfloat = 4thread mill cutter diameter (mm); must be below the minor diameter.
z_topfloat = 0Z of the top end of the thread (default 0).
z_bottomfloat = -12Z of the bottom end of the thread.
handednessstr = 'rh'"rh" (default) or "lh".
safe_zfloat = 5safe rapid height (default 5).
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 pilot-bore 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 bore (default 0.1).
hole_orderstr = 'detection'"detection" or "nearest_neighbor".
Returnscnc.plan.Planthe thread-milling plan, one step per bore.

Thread milling M6x1 threads on two detected pilot bores; the helix climbs one pitch per revolution.

Thread milling M6x1 threads on two detected pilot bores; the helix climbs one pitch per revolution.