Documentation ¶
Overview ¶
Package drawing defines Drawing struct for DXF.
Index ¶
- func SectionTypeString(s SectionType) string
- type Drawing
- func (d *Drawing) AddEntity(e entity.Entity)
- func (d *Drawing) AddLayer(name string, cl color.ColorNumber, lt *table.LineType, setcurrent bool) (*table.Layer, error)
- func (d *Drawing) AddLineType(name string, desc string, ls ...float64) (*table.LineType, error)
- func (d *Drawing) AddStyle(name string, fontname, bigfontname string, setcurrent bool) (*table.Style, error)
- func (d *Drawing) AddToGroup(name string, es ...entity.Entity) error
- func (d *Drawing) Arc(x, y, z, r, start, end float64) (*entity.Arc, error)
- func (d *Drawing) ChangeLayer(name string) error
- func (d *Drawing) Circle(x, y, z, r float64) (*entity.Circle, error)
- func (d *Drawing) Close() error
- func (d *Drawing) Entities() entity.Entities
- func (d *Drawing) Group(name, desc string, es ...entity.Entity) (*object.Group, error)
- func (d *Drawing) Header() *header.Header
- func (d *Drawing) Layer(name string, setcurrent bool) (*table.Layer, error)
- func (d *Drawing) Line(x1, y1, z1, x2, y2, z2 float64) (*entity.Line, error)
- func (d *Drawing) LineType(name string) (*table.LineType, error)
- func (d *Drawing) LwPolyline(closed bool, vertices ...[]float64) (*entity.LwPolyline, error)
- func (d *Drawing) Point(x, y, z float64) (*entity.Point, error)
- func (d *Drawing) Polyline(closed bool, vertices ...[]float64) (*entity.Polyline, error)
- func (d *Drawing) Read(p []byte) (n int, err error)
- func (d *Drawing) Save() error
- func (d *Drawing) SaveAs(filename string) error
- func (d *Drawing) SetExt()
- func (d *Drawing) Style(name string, setcurrent bool) (*table.Style, error)
- func (d *Drawing) Text(str string, x, y, z, height float64) (*entity.Text, error)
- func (d *Drawing) ThreeDFace(points [][]float64) (*entity.ThreeDFace, error)
- func (d *Drawing) WriteTo(w io.Writer) (n int64, err error)
- type Section
- type SectionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SectionTypeString ¶
func SectionTypeString(s SectionType) string
SectionTypeString converts SectionType to string. If SectionType is out of range, it returns empty string.
Types ¶
type Drawing ¶
type Drawing struct { FileName string Layers map[string]*table.Layer Groups map[string]*object.Group Styles map[string]*table.Style CurrentLayer *table.Layer CurrentStyle *table.Style LwPolylines []*entity.LwPolyline Polylines []*entity.Polyline Faces3D []*entity.ThreeDFace Lines []*entity.Line Sections []Section PlotStyle handle.Handler // contains filtered or unexported fields }
Drawing contains DXF drawing data.
func (*Drawing) AddLayer ¶
func (d *Drawing) AddLayer(name string, cl color.ColorNumber, lt *table.LineType, setcurrent bool) (*table.Layer, error)
AddLayer adds a new layer with given name, color and line type. If setcurrent is true, set current layer to it.
func (*Drawing) AddLineType ¶
AddLineType adds a new linetype.
func (*Drawing) AddStyle ¶
func (d *Drawing) AddStyle(name string, fontname, bigfontname string, setcurrent bool) (*table.Style, error)
AddStyle adds a new text style. If setcurrent is true, set current style to it.
func (*Drawing) AddToGroup ¶
AddToGroup adds given entities to the named group. If the named group doesn't exist, returns error.
func (*Drawing) ChangeLayer ¶
ChangeLayer changes current layer to the named layer.
func (*Drawing) Close ¶
Close implements the standard Close interface: it close the buffer used by the read command if one was initilized, and frees the memory held by it. Close will always return nil for the error.
func (*Drawing) Group ¶
Group adds given entities to the named group. If the named group doesn't exist, create it.
func (*Drawing) Layer ¶
Layer returns the named layer if exists. If setcurrent is true, set current layer to it.
func (*Drawing) LwPolyline ¶
LwPolyline creates a new LWPOLYLINE with given vertices.
func (*Drawing) Read ¶
Read implements the standard Read interface: it reads data from a buffer containing the drawing, the buffer in initialized on the first read or a read call after a close. If the drawing is nil, read returns 0 for n, nil for the error.
func (*Drawing) SetExt ¶
func (d *Drawing) SetExt()
SetExt sets the extents of the drawing based on the entities in the drawing. If the drawing is nil, this function will panic.
func (*Drawing) Style ¶
Style returns the named text style if exists. If setcurrent is true, set current style to it.
func (*Drawing) ThreeDFace ¶
func (d *Drawing) ThreeDFace(points [][]float64) (*entity.ThreeDFace, error)
ThreeDFace creates a new 3DFACE with given points.
type SectionType ¶
type SectionType int
SectionType represents Section names (code 2)
const ( HEADER SectionType = iota CLASSES TABLES BLOCKS ENTITIES OBJECTS )
Section name: code 2
func SectionTypeValue ¶
func SectionTypeValue(s string) SectionType
SectionTypeValue converts string to SectionType. If string is unknown SectionType, it returns -1.