Documentation
¶
Index ¶
- Variables
- func ConvertSVGToGCodeWithVpype(out io.Writer, svgPath string, optFN string, flavorOverride string) error
- func DecodeInteractiveState[T any]() (T, error)
- func InteractiveStateRaw() (json.RawMessage, error)
- func JsonPlotter(out io.Writer, p Canvas, d Drawing) error
- func PlotGCodeWithVpype(out io.Writer, p Canvas, d Drawing, optFN string, flavorOverride string) error
- func PlotSVGWithVpype(out io.Writer, p Canvas, d Drawing) error
- func Run(p Canvas, d DrawFunc, opts ...RunOpt)
- type Arc
- type ArgSpec
- type ArgType
- type BezierCurve
- type Canvas
- type Debug
- type DrawFunc
- type Drawable
- type Drawing
- type GCodeCommand
- type GCodeFlavor
- type GCodeLift
- type GCodeLinearMoveXY
- type GCodeOpts
- type InteractiveAction
- type InteractiveApplyResult
- type InteractiveCanvas
- type InteractiveHooks
- type InteractiveManifest
- type InteractiveRegion
- type InteractiveTool
- type Line
- type OptimisationFunc
- type PlotFunc
- type RunConfig
- type RunOpt
- type XY
Constants ¶
This section is empty.
Variables ¶
var A4 = XY{210, 297}
Functions ¶
func ConvertSVGToGCodeWithVpype ¶
func ConvertSVGToGCodeWithVpype(out io.Writer, svgPath string, optFN string, flavorOverride string) error
ConvertSVGToGCodeWithVpype converts an existing SVG file into G-code using vpype's gwrite plug-in and the repo's G-code option schema.
func DecodeInteractiveState ¶
func InteractiveStateRaw ¶
func InteractiveStateRaw() (json.RawMessage, error)
func PlotGCodeWithVpype ¶
func PlotGCodeWithVpype(out io.Writer, p Canvas, d Drawing, optFN string, flavorOverride string) error
PlotGCodeWithVpype renders SVG, applies vpype post-processing, and emits G-code using the vpype-gcode plug-in. If vpype or the plug-in is missing, or if vpype fails, it falls back to the native G-code generator.
func PlotSVGWithVpype ¶
PlotSVGWithVpype renders SVG and applies vpype post-processing if available. If vpype is missing or fails, it falls back to plain SVG output.
Types ¶
type ArgSpec ¶
type ArgSpec struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Type ArgType `json:"type"`
Default *string `json:"default,omitempty"`
Min *float64 `json:"min,omitempty"`
Max *float64 `json:"max,omitempty"`
}
type BezierCurve ¶
type BezierCurve struct {
ControlPoints []XY
}
BezierCurve is a drawable bezier curve
type Canvas ¶
type Canvas struct {
Size XY
DPI int
Bleed XY
// PenWidth controls rendered stroke width for image/vector devices.
// If unset or <= 0, a width of 1 is used.
PenWidth float64
}
Canvas describes the canvas on which we'll draw
func (Canvas) FrameBleed ¶
Frame returns a frame around the canvas respecting the bleed
func (Canvas) StrokeWidth ¶
type Debug ¶
type Debug struct {
D Drawable
}
Debug helps debugging other drawables. Use `AsDebug()`.
type Drawable ¶
type Drawable interface {
// contains filtered or unexported methods
}
Drawable marks all drawable elements
type GCodeCommand ¶
type GCodeFlavor ¶
type GCodeFlavor string
const ( GCodeFlavorVanilla GCodeFlavor = "vanilla" GCodeFlavorMK4S GCodeFlavor = "mk4s" )
func ParseGCodeFlavor ¶
func ParseGCodeFlavor(v string) (GCodeFlavor, error)
type GCodeLift ¶
func (GCodeLift) ModifyState ¶
func (l GCodeLift) ModifyState(s *gcodeState)
type GCodeLinearMoveXY ¶
func (GCodeLinearMoveXY) ModifyState ¶
func (l GCodeLinearMoveXY) ModifyState(s *gcodeState)
func (GCodeLinearMoveXY) String ¶
func (l GCodeLinearMoveXY) String() string
type GCodeOpts ¶
type GCodeOpts struct {
DrawFeed int `json:"drawFeed"`
DrawLift int `json:"drawLift"`
TravelFeed int `json:"travelFeed"`
TravelLift int `json:"travelLift"`
Scale float64 `json:"scale"`
Offset XY `json:"offset"`
Flavor string `json:"flavor,omitempty"`
}
func NewDefaultGCodeOpts ¶
func NewDefaultGCodeOpts() *GCodeOpts
type InteractiveAction ¶
type InteractiveApplyResult ¶
type InteractiveApplyResult struct {
State json.RawMessage `json:"state,omitempty"`
}
type InteractiveCanvas ¶
type InteractiveHooks ¶
type InteractiveHooks struct {
Describe func(p Canvas, args map[string]string, state json.RawMessage) (InteractiveManifest, error)
Apply func(p Canvas, args map[string]string, state json.RawMessage, action InteractiveAction) (json.RawMessage, error)
}
type InteractiveManifest ¶
type InteractiveManifest struct {
Canvas InteractiveCanvas `json:"canvas"`
Tools []InteractiveTool `json:"tools"`
Regions []InteractiveRegion `json:"regions"`
DefaultTool string `json:"defaultTool,omitempty"`
}
type InteractiveRegion ¶
type InteractiveRegion struct {
ID string `json:"id"`
X int `json:"x"`
Y int `json:"y"`
Width int `json:"width"`
Height int `json:"height"`
Label string `json:"label,omitempty"`
Hint string `json:"hint,omitempty"`
Stroke string `json:"stroke,omitempty"`
Fill string `json:"fill,omitempty"`
TextColor string `json:"textColor,omitempty"`
}
type InteractiveTool ¶
type PlotFunc ¶
PlotFunc plots a drawing to some output device
func NewPNGPlotter ¶
func NewPNGPlotter() PlotFunc
func NewSVGPlotter ¶
func NewSVGPlotter() PlotFunc
NewSVGPlotter returns a PlotFunc that writes SVG output.
type RunConfig ¶
type RunConfig struct {
ArgsSchema []ArgSpec
Interactive *InteractiveHooks
}
type RunOpt ¶
type RunOpt func(*RunConfig)
func WithArgSchema ¶
func WithArgsSchema ¶
func WithInteractive ¶
func WithInteractive(h InteractiveHooks) RunOpt