gerber

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Linear interpolation.
	InterpolationLinear Interpolation = iota
	// Clockwise arc interpolation
	InterpolationClockwise
	// Counter clockwise arc interpolation.
	InterpolationCCW

	// LineCapButt strokes do not extend beyond a line's two endpoints.
	LineCapButt LineCap = "butt"
	// LineCapRound strokes will be extended by a half circle with a diameter equal to the stroke width.
	LineCapRound LineCap = "round"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Arc added in v0.1.2

type Arc struct {
	Line    int
	EndX    int
	EndY    int
	StartX  int
	StartY  int
	CenterX int
	CenterY int
	Width   int
	Interpolation
}

func (*Arc) Bounds added in v0.1.2

func (e *Arc) Bounds() image.Rectangle

type Circle added in v0.1.2

type Circle struct {
	Line     int
	X        int
	Y        int
	Diameter int
	Polarity bool
}

func (*Circle) Bounds added in v0.1.2

func (e *Circle) Bounds() image.Rectangle

type Contour

type Contour struct {
	Line     int
	X        int
	Y        int
	Segments []Segment
	Polarity bool
}

A Contour is a closed sequence of connected linear or circular segments.

func (*Contour) Bounds added in v0.1.2

func (e *Contour) Bounds() image.Rectangle

type Interpolation

type Interpolation int

An Interpolation is a Gerber interpolation method.

type Line added in v0.1.2

type Line struct {
	Line     int
	StartX   int
	StartY   int
	EndX     int
	EndY     int
	Width    int
	Cap      LineCap
	Rotation float64
}

func (*Line) Bounds added in v0.1.2

func (e *Line) Bounds() image.Rectangle

type LineCap

type LineCap string

A LineCap is the shape at the endpoints of a line.

type LinePrimitiveNotClosedError

type LinePrimitiveNotClosedError struct {
	Line     int
	First    [2]float64
	Last     [2]float64
	FirstStr [2]string
	LastStr  [2]string
}

func (LinePrimitiveNotClosedError) Error

func (err LinePrimitiveNotClosedError) Error() string

type Loayer

type Loayer string
const (
	GTL Loayer = "GTL" //顶层走线
	GBL Loayer = "GBL" //底层走线
	GTO Loayer = "GTO" //顶层丝印
	GBO Loayer = "GBO" //底层丝印
	GTS Loayer = "GTS" // 顶层阻焊
	GBS Loayer = "GBS" //底层阻焊
	GPT Loayer = "GPT" //顶层主焊盘
	GPB Loayer = "GPB" //底层主焊盘
	G1  Loayer = "G1"  //内部走线层1
	G2  Loayer = "G2"  //内部走线层2
	G3  Loayer = "G3"  //内部走线层3
	G4  Loayer = "G4"  //内部走线层4
	GP1 Loayer = "GP1" //内平面1(负片)
	GP2 Loayer = "GP2" //内平面2(负片)
	GM1 Loayer = "GM1" //机械层1
	GM2 Loayer = "GM2" //机械层2
	GM3 Loayer = "GM3" //机械层3
	GM4 Loayer = "GM4" //机械层4
	GKO Loayer = "GKO" //禁止布线层(可做板子外形)
)

type Obround added in v0.1.2

type Obround struct {
	Line     int
	X        int
	Y        int
	Width    int
	Height   int
	Polarity bool
	Rotation float64
}

func (*Obround) Bounds added in v0.1.2

func (e *Obround) Bounds() image.Rectangle

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

A Parser is a Gerber format parser. For each graphical operation parsed from an input stream, Parser calls the corresponding method of its Processor.

func NewParser

func NewParser(pc Processor) *Parser

NewParser creates a Parser.

func (*Parser) Parse

func (parser *Parser) Parse(r io.Reader) error

Parse parses the Gerber format stream.

type Processor

type Processor interface {
	// Circle draws a circle.
	Circle(Circle)

	// Rectangle draws a rectangle.
	Rectangle(Rectangle)

	// Obround draws an obround.
	Obround(Obround)

	// Contour draws a contour.
	Contour(Contour) error

	// Line draws a line.
	Line(Line)

	// Arc draws an arc.
	Arc(Arc) error

	// SetViewbox sets the viewbox of the Gerber image.
	// It is called by the Parser when parsing has completed.
	SetViewbox(minX, maxX, minY, maxY int)
}

type Rectangle

type Rectangle struct {
	Line     int
	X        int
	Y        int
	Width    int
	Height   int
	CenterX  int
	CenterY  int
	Polarity bool
	Rotation float64
}

func (*Rectangle) Bounds added in v0.1.2

func (e *Rectangle) Bounds() image.Rectangle

type Segment

type Segment struct {
	Interpolation Interpolation
	X             int
	Y             int
	XCenter       int
	YCenter       int
}

A Segment is a stroked line.

type Unit added in v0.1.2

type Unit string
const (
	UnitMillimeter Unit = "mm"
	UnitInch       Unit = "inch"
)

Directories

Path Synopsis
Package svg parses Gerber to SVG.
Package svg parses Gerber to SVG.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL