vpype_gscrib.renderer.heads
Tool head positioning and movement control.
This module provides implementations for controlling the movement of the machine’s head (tool carrier). It includes G-code generation for various movements such as safe retraction, normal retraction, plunging, controlled travel, and parking for service or maintenance.
- class vpype_gscrib.renderer.heads.AutoLevelingHead
Bases:
StandardHeadHead implementation with height map compensation.
This class handles auto-leveling operations for controlling the machine’s head. All work movements are transformed according to a height map, which allows for various applications:
Surface compensation: Maintains consistent tool engagement on uneven surfaces by automatically adjusting the Z height.
Auto-leveling: Compensates for machine bed imperfections or misalignment without manual bed leveling.
Texture mapping: Can be used artistically to transfer height map patterns into the work piece.
Depth control: Enables precise control over tool engagement across the entire work area for consistent results.
The height map adjusts the Z-axis position during plunging and work operations to maintain consistent tool engagement with the work surface. Work movements are interpolated across the height map to ensure smooth transitions between different surface heights.
- plunge(ctx: GContext)
Plunge the machine head to the work height.
Generates G-code commands to move the machine head to the plunge height at travel speed and then to the work height at controlled plunge speed. The final Z position is adjusted based on the height map value at the current XY position taking into account the offset between plunge_z and work_z heights.
- Parameters:
ctx (GContext) – The G-code generation context
- trace_to(ctx: GContext, x: float, y: float, tool_params: dict)
Trace a path to a specified position at work speed.
Generates G-code commands to move the machine head to the specified (x, y) coordinates at the configured work speed. The path is sampled against the height map and interpolated to ensure smooth Z-axis adjustments that follow the surface contours.
- class vpype_gscrib.renderer.heads.BaseHead
Bases:
ABCBase class for machine head movement implementations.
This abstract base class defines the interface for controlling the movement of the machine’s head (tool carrier). It handles all axis movements including safe positioning, rapid travels, and controlled motion paths. The movement is independent of the tool operation.
- abstractmethod park_for_service(ctx: GContext)
Move the head to the machine’s service/parking position.
Generates G-code commands to safely move the head to a position suitable for tool changes, maintenance, or end of operation. This typically involves moving the head to a safe Z height and then moving to a predefined XY position.
- Parameters:
ctx (GContext) – The G-code generation context
- abstractmethod plunge(ctx: GContext)
Lower the head to the working height.
Generates G-code commands to move the Z-axis down to the configured working height for the current operation.
- Parameters:
ctx (GContext) – The G-code generation context
- abstractmethod retract(ctx: GContext)
Move the head to the normal Z travel height.
Generates G-code commands for normal Z-axis retraction used between regular operations.
- Parameters:
ctx (GContext) – The G-code generation context
- abstractmethod safe_retract(ctx: GContext)
Move the head to a safe Z height.
Generates G-code commands for a Z-axis retraction to a safe height. This is typically used to move the head out of the way of the workpiece or to a height where it can be safely moved to a different location.
- Parameters:
ctx (GContext) – The G-code generation context
- abstractmethod trace_to(ctx: GContext, x: float, y: float, tool_params: dict)
Move the head to a new XY position using controlled movement.
Generates G-code commands for controlled, working moves. Used for actual cutting, drawing, or other operations where the tool is actively working.
- class vpype_gscrib.renderer.heads.HeadFactory
Bases:
objectA factory for creating head managers.
This factory creates specialized head managers that handle the control of machine tool heads. Head managers are responsible for controlling the movement, positioning, and operational parameters of the machine’s tool head, which is the assembly that holds the active tool.
- class vpype_gscrib.renderer.heads.StandardHead
Bases:
BaseHeadStandard machine head implementation.
This class handles basic operations for controlling the machine’s head, including safe retraction, plunging, traveling, tracing, and parking for service.
- park_for_service(ctx: GContext)
Park the machine head for service.
Generates G-code commands to move the machine head to a safe height and then to the absolute home position (0, 0) for service using rapid moves.
- Parameters:
ctx (GContext) – The G-code generation context
- plunge(ctx: GContext)
Plunge the machine head to the work height.
Generates G-code commands to move the machine head to the plunge height at travel speed and then to the work height at controlled plunge speed.
- Parameters:
ctx (GContext) – The G-code generation context
- retract(ctx: GContext)
Retract the machine head.
Generates G-code commands to move the machine head to a safe height using rapid moves.
- Parameters:
ctx (GContext) – The G-code generation context
- safe_retract(ctx: GContext)
Retract the machine head to a safe height.
Generates G-code commands to move the machine head to a safe height using rapid moves.
- Parameters:
ctx (GContext) – The G-code generation context
- trace_to(ctx: GContext, x: float, y: float, tool_params: dict)
Trace a path to a specified position at work speed.
Generates G-code commands to move the machine head to the specified (x, y) coordinates at the configured work speed.