Documentation ¶
Overview ¶
Package gerber writes Gerber RS274X files (for PCBs).
Index ¶
- Constants
- Variables
- type Aperture
- type ArcT
- type CircleT
- type Gerber
- func (g *Gerber) BottomCopper() *Layer
- func (g *Gerber) BottomSilkscreen() *Layer
- func (g *Gerber) BottomSolderMask() *Layer
- func (g *Gerber) Drill() *Layer
- func (g *Gerber) LayerN(n int) *Layer
- func (g *Gerber) MBB() MBB
- func (g *Gerber) Outline() *Layer
- func (g *Gerber) TopCopper() *Layer
- func (g *Gerber) TopSilkscreen() *Layer
- func (g *Gerber) TopSolderMask() *Layer
- func (g *Gerber) WriteGerber() error
- type Layer
- type LineT
- type MBB
- type PolygonT
- type Primitive
- type Pt
- type Shape
- type TextOpts
- type TextT
Constants ¶
Variables ¶
var ( BottomLeft = fonts.BottomLeft BottomCenter = fonts.BottomCenter BottomRight = fonts.BottomRight CenterLeft = fonts.CenterLeft Center = fonts.Center CenterRight = fonts.CenterRight TopLeft = fonts.TopLeft TopCenter = fonts.TopCenter TopRight = fonts.TopRight )
Functions ¶
This section is empty.
Types ¶
type Aperture ¶
Aperture represents the nature of the primitive and satisfies the Primitive interface.
type ArcT ¶
type ArcT struct { Center Pt Radius float64 Shape Shape XScale float64 YScale float64 StartAngle float64 EndAngle float64 Thickness float64 // contains filtered or unexported fields }
ArcT represents an arc and satisfies the Primitive interface.
func Arc ¶
func Arc( center Pt, radius float64, shape Shape, xScale, yScale, startAngle, endAngle float64, thickness float64) *ArcT
Arc returns an arc primitive. All dimensions are in millimeters. Angles are specified in degrees (and stored as radians).
type CircleT ¶
type CircleT struct {
// contains filtered or unexported fields
}
CircleT represents a circle and satisfies the Primitive interface.
type Gerber ¶
type Gerber struct { // FilenamePrefix is the filename prefix for the Gerber design files. FilenamePrefix string // Layers represents the layers making up the Gerber design. Layers []*Layer // contains filtered or unexported fields }
Gerber represents the layers needed to build a PCB.
func New ¶
New returns a new Gerber design. filenamePrefix is the base filename for all gerber files (e.g. "bifilar-coil").
func (*Gerber) BottomCopper ¶
BottomCopper adds a bottom copper layer to the design and returns the layer.
func (*Gerber) BottomSilkscreen ¶
BottomSilkscreen adds a bottom silkscreen layer to the design and returns the layer.
func (*Gerber) BottomSolderMask ¶
BottomSolderMask adds a bottom solder mask layer to the design and returns the layer.
func (*Gerber) LayerN ¶
LayerN adds a layer-n copper layer to a multi-layer design and returns the layer.
func (*Gerber) TopSilkscreen ¶
TopSilkscreen adds a top silkscreen layer to the design and returns the layer.
func (*Gerber) TopSolderMask ¶
TopSolderMask adds a top solder mask layer to the design and returns the layer.
func (*Gerber) WriteGerber ¶
WriteGerber writes all the Gerber layers to their respective files then zips them all together into a ZIP file with the same prefix for sending to PCB manufacturers.
type Layer ¶
type Layer struct { // Filename is the filename of the Gerber layer. Filename string // Primitives represents the collection of primitives. Primitives []Primitive // Apertures represents the apertures used in the layer. Apertures []*Aperture // contains filtered or unexported fields }
Layer represents a printed circuit board layer.
type LineT ¶
type LineT struct {
P1, P2 Pt
Shape Shape
Thickness float64
// contains filtered or unexported fields
}
LineT represents a line and satisfies the Primitive interface.
type PolygonT ¶
PolygonT represents a polygon and satisfies the Primitive interface.
type Primitive ¶
type Primitive interface { WriteGerber(w io.Writer, apertureIndex int) error Aperture() *Aperture // MBB returns the minimum bounding box in millimeters. MBB() MBB }
Primitive is a Gerber primitive.
type TextOpts ¶
TextOpts provides options for positioning (aligning) the text based on its minimum bounding box.
type TextT ¶
TextT represents text and satisfies the Primitive interface.
func Text ¶
Text returns a text primitive. All dimensions are in millimeters. xScale is 1.0 for top silkscreen and -1.0 for bottom silkscreen.
func TextBox ¶
TextBox returns a text primitive where the text fills the MBB and aligns the text according to TextOpts. All dimensions are in millimeters. xScale is 1.0 for top silkscreen and -1.0 for bottom silkscreen.