示例#1
0
文件: point.go 项目: yofu/dxf
// Format writes data to formatter.
func (p *Point) Format(f format.Formatter) {
	p.entity.Format(f)
	f.WriteString(100, "AcDbPoint")
	for i := 0; i < 3; i++ {
		f.WriteFloat((i+1)*10, p.Coord[i])
	}
}
示例#2
0
文件: classes.go 项目: spyle/dxf
// WriteTo writes CLASSES data to formatter.
func (cs Classes) WriteTo(f format.Formatter) {
	f.WriteString(0, "SECTION")
	f.WriteString(2, "CLASSES")
	for _, c := range cs {
		c.Format(f)
	}
	f.WriteString(0, "ENDSEC")
}
示例#3
0
文件: objects.go 项目: spyle/dxf
// WriteTo writes OBJECTS data to formatter.
func (os Objects) WriteTo(f format.Formatter) {
	f.WriteString(0, "SECTION")
	f.WriteString(2, "OBJECTS")
	for _, o := range os {
		o.Format(f)
	}
	f.WriteString(0, "ENDSEC")
}
示例#4
0
文件: lwpolyline.go 项目: spyle/dxf
// Format writes data to formatter.
func (l *LwPolyline) Format(f format.Formatter) {
	l.entity.Format(f)
	f.WriteString(100, "AcDbPolyline")
	f.WriteInt(90, l.Num)
	if l.Closed {
		f.WriteInt(70, 1)
	} else {
		f.WriteInt(70, 0)
	}
	for i := 0; i < l.Num; i++ {
		for j := 0; j < 2; j++ {
			f.WriteFloat((j+1)*10, l.Vertices[i][j])
		}
	}
}
示例#5
0
文件: vertex.go 项目: spyle/dxf
// Format writes data to formatter.
func (v *Vertex) Format(f format.Formatter) {
	v.entity.Format(f)
	f.WriteString(100, "AcDbVertex")
	f.WriteString(100, "AcDb3dPolylineVertex")
	for i := 0; i < 3; i++ {
		f.WriteFloat((i+1)*10, v.Coord[i])
	}
	f.WriteInt(70, v.Flag)
}
示例#6
0
文件: circle.go 项目: spyle/dxf
// Format writes data to formatter.
func (c *Circle) Format(f format.Formatter) {
	c.entity.Format(f)
	f.WriteString(100, "AcDbCircle")
	for i := 0; i < 3; i++ {
		f.WriteFloat((i+1)*10, c.Center[i])
	}
	f.WriteFloat(40, c.Radius)
	for i := 0; i < 3; i++ {
		f.WriteFloat(200+(i+1)*10, c.Direction[i])
	}
}
示例#7
0
文件: tables.go 项目: spyle/dxf
// WriteTo writes TABLES data to formatter.
func (ts Tables) WriteTo(f format.Formatter) {
	f.WriteString(0, "SECTION")
	f.WriteString(2, "TABLES")
	for _, t := range ts {
		t.Format(f)
	}
	f.WriteString(0, "ENDSEC")
}
示例#8
0
文件: blocks.go 项目: spyle/dxf
// WriteTo writes BLOCKS data to formatter.
func (bs Blocks) WriteTo(f format.Formatter) {
	f.WriteString(0, "SECTION")
	f.WriteString(2, "BLOCKS")
	for _, b := range bs {
		b.Format(f)
	}
	f.WriteString(0, "ENDSEC")
}
示例#9
0
文件: entities.go 项目: spyle/dxf
// WriteTo writes ENTITIES data to formatter.
func (es Entities) WriteTo(f format.Formatter) {
	f.WriteString(0, "SECTION")
	f.WriteString(2, "ENTITIES")
	for _, e := range es {
		e.Format(f)
	}
	f.WriteString(0, "ENDSEC")
}
示例#10
0
文件: line.go 项目: spyle/dxf
// Format writes data to formatter.
func (l *Line) Format(f format.Formatter) {
	l.entity.Format(f)
	f.WriteString(100, "AcDbLine")
	for i := 0; i < 3; i++ {
		f.WriteFloat((i+1)*10, l.Start[i])
	}
	for i := 0; i < 3; i++ {
		f.WriteFloat((i+1)*10+1, l.End[i])
	}
}
示例#11
0
文件: 3dface.go 项目: spyle/dxf
// Format writes data to formatter.
func (f *ThreeDFace) Format(fm format.Formatter) {
	f.entity.Format(fm)
	fm.WriteString(100, "AcDbFace")
	for i := 0; i < 4; i++ {
		for j := 0; j < 3; j++ {
			fm.WriteFloat((j+1)*10+i, f.Points[i][j])
		}
	}
	if f.Flag != 0 {
		fm.WriteInt(70, f.Flag)
	}
}
示例#12
0
文件: classes.go 项目: spyle/dxf
// Format writes data to formatter.
func (c *Class) Format(f format.Formatter) {
	f.WriteString(0, "CLASS")
}
示例#13
0
文件: text.go 项目: spyle/dxf
// FormatString outputs data using given formatter.
func (t *Text) FormatString(f format.Formatter) string {
	t.Format(f)
	return f.Output()
}
示例#14
0
文件: text.go 项目: spyle/dxf
// Format writes data to formatter.
func (t *Text) Format(f format.Formatter) {
	t.entity.Format(f)
	f.WriteString(100, "AcDbText")
	for i := 0; i < 3; i++ {
		f.WriteFloat((i+1)*10, t.Coord1[i])
	}
	f.WriteFloat(40, t.Height)
	f.WriteString(1, t.Value)
	f.WriteString(7, t.Style.Name())
	if t.genflag != 0 {
		f.WriteInt(71, t.genflag)
	}
	if t.horizontalflag != 0 {
		f.WriteInt(72, t.horizontalflag)
		if t.verticalflag != 0 {
			for i := 0; i < 3; i++ {
				f.WriteFloat((i+1)*11, t.Coord1[i])
			}
		}
	}
	f.WriteString(100, "AcDbText")
	if t.verticalflag != 0 {
		f.WriteInt(73, t.verticalflag)
	}
}
示例#15
0
文件: 3dface.go 项目: spyle/dxf
// FormatString outputs data using given formatter.
func (f *ThreeDFace) FormatString(fm format.Formatter) string {
	f.Format(fm)
	return fm.Output()
}
示例#16
0
文件: dimstyle.go 项目: spyle/dxf
// Format writes data to formatter.
func (d *DimStyle) Format(f format.Formatter) {
	f.WriteString(0, "DIMSTYLE")
	f.WriteHex(105, d.handle)
	if d.owner != nil {
		f.WriteHex(330, d.owner.Handle())
	}
	f.WriteString(100, "AcDbSymbolTableRecord")
	f.WriteString(100, "AcDbDimStyleTableRecord")
	f.WriteString(2, d.name)
	f.WriteInt(70, 0)
}
示例#17
0
文件: group.go 项目: spyle/dxf
// FormatString outputs data using given formatter.
func (g *Group) FormatString(f format.Formatter) string {
	g.Format(f)
	return f.Output()
}
示例#18
0
文件: viewport.go 项目: spyle/dxf
// Format writes data to formatter.
func (v *Viewport) Format(f format.Formatter) {
	f.WriteString(0, "VPORT")
	f.WriteHex(5, v.handle)
	if v.owner != nil {
		f.WriteHex(330, v.owner.Handle())
	}
	f.WriteString(100, "AcDbSymbolTableRecord")
	f.WriteString(100, "AcDbViewportTableRecord")
	f.WriteString(2, v.name)
	f.WriteInt(70, 0)
	for i := 0; i < 2; i++ {
		f.WriteFloat((i+1)*10, v.LowerLeft[i])
	}
	for i := 0; i < 2; i++ {
		f.WriteFloat((i+1)*10+1, v.UpperRight[i])
	}
	for i := 0; i < 2; i++ {
		f.WriteFloat((i+1)*10+2, v.ViewCenter[i])
	}
	for i := 0; i < 2; i++ {
		f.WriteFloat((i+1)*10+3, v.SnapBase[i])
	}
	for i := 0; i < 2; i++ {
		f.WriteFloat((i+1)*10+4, v.SnapSpacing[i])
	}
	for i := 0; i < 2; i++ {
		f.WriteFloat((i+1)*10+5, v.GridSpacing[i])
	}
	for i := 0; i < 3; i++ {
		f.WriteFloat((i+1)*10+6, v.ViewDirection[i])
	}
	for i := 0; i < 3; i++ {
		f.WriteFloat((i+1)*10+7, v.ViewTarget[i])
	}
	f.WriteFloat(40, v.Height)
	f.WriteFloat(41, v.AspectRatio)
	f.WriteFloat(42, v.LensLength)
	f.WriteFloat(43, v.FrontClip)
	f.WriteFloat(44, v.BackClip)
	f.WriteFloat(50, v.SnapAngle)
	f.WriteFloat(51, v.TwistAngle)
}
示例#19
0
文件: style.go 项目: spyle/dxf
// FormatString outputs data using given formatter.
func (st *Style) FormatString(f format.Formatter) string {
	st.Format(f)
	return f.Output()
}
示例#20
0
文件: linetype.go 项目: spyle/dxf
// FormatString outputs data using given formatter.
func (lt *LineType) FormatString(f format.Formatter) string {
	lt.Format(f)
	return f.Output()
}
示例#21
0
文件: linetype.go 项目: spyle/dxf
// Format writes data to formatter.
func (lt *LineType) Format(f format.Formatter) {
	f.WriteString(0, "LTYPE")
	f.WriteHex(5, lt.handle)
	if lt.owner != nil {
		f.WriteHex(330, lt.owner.Handle())
	}
	f.WriteString(100, "AcDbSymbolTableRecord")
	f.WriteString(100, "AcDbLinetypeTableRecord")
	f.WriteString(2, lt.name)
	f.WriteInt(70, 0)
	f.WriteString(3, lt.Description)
	f.WriteInt(72, 65)
	f.WriteInt(73, len(lt.lengths))
	f.WriteFloat(40, lt.TotalLength())
	for _, l := range lt.lengths {
		f.WriteFloat(49, l)
		f.WriteInt(74, 0)
	}
}
示例#22
0
文件: dimstyle.go 项目: spyle/dxf
// FormatString outputs data using given formatter.
func (d *DimStyle) FormatString(f format.Formatter) string {
	d.Format(f)
	return f.Output()
}
示例#23
0
文件: classes.go 项目: spyle/dxf
// FormatString outputs data using given formatter.
func (c *Class) FormatString(f format.Formatter) string {
	c.Format(f)
	return f.Output()
}
示例#24
0
文件: entity.go 项目: yofu/dxf
// Format writes data to formatter.
func (e *entity) Format(f format.Formatter) {
	f.WriteString(0, EntityTypeString(e.Type))
	f.WriteHex(5, e.handle)
	if e.blockRecord != nil {
		f.WriteString(102, "{ACAD_REACTORS")
		f.WriteHex(330, e.blockRecord.Handle())
		f.WriteString(102, "}")
	}
	if e.owner != nil {
		f.WriteHex(330, e.owner.Handle())
	}
	f.WriteString(100, "AcDbEntity")
	f.WriteString(8, e.layer.Name())
}
示例#25
0
文件: style.go 项目: spyle/dxf
// Format writes data to formatter.
func (st *Style) Format(f format.Formatter) {
	f.WriteString(0, "STYLE")
	f.WriteHex(5, st.handle)
	if st.owner != nil {
		f.WriteHex(330, st.owner.Handle())
	}
	f.WriteString(100, "AcDbSymbolTableRecord")
	f.WriteString(100, "AcDbTextStyleTableRecord")
	f.WriteString(2, st.name)
	f.WriteInt(70, 0)
	f.WriteString(40, "0.0")
	f.WriteString(41, "1.0")
	f.WriteString(50, "0.0")
	f.WriteInt(71, 0)
	f.WriteString(42, "0.2")
	f.WriteString(3, st.FontName)
	f.WriteString(4, st.BigFontName)
}
示例#26
0
文件: entity.go 项目: yofu/dxf
// FormatString outputs data using given formatter.
func (e *entity) FormatString(f format.Formatter) string {
	e.Format(f)
	return f.Output()
}
示例#27
0
文件: point.go 项目: yofu/dxf
// FormatString outputs data using given formatter.
func (p *Point) FormatString(f format.Formatter) string {
	p.Format(f)
	return f.Output()
}
示例#28
0
文件: polyline.go 项目: yofu/dxf
// Format writes data to formatter.
func (p *Polyline) Format(f format.Formatter) {
	p.entity.Format(f)
	f.WriteString(100, "AcDb3dPolyline")
	f.WriteInt(66, 1)
	f.WriteString(10, "0.0")
	f.WriteString(20, "0.0")
	f.WriteString(30, "0.0")
	f.WriteInt(70, p.Flag)
	for _, v := range p.Vertices {
		v.Format(f)
	}
	f.WriteString(0, "SEQEND")
	f.WriteHex(5, p.endhandle)
	f.WriteString(100, "AcDbEntity")
	f.WriteString(8, p.Layer().Name())
}
示例#29
0
文件: lwpolyline.go 项目: spyle/dxf
// FormatString outputs data using given formatter.
func (l *LwPolyline) FormatString(f format.Formatter) string {
	l.Format(f)
	return f.Output()
}
示例#30
0
文件: viewport.go 项目: spyle/dxf
// FormatString outputs data using given formatter.
func (v *Viewport) FormatString(f format.Formatter) string {
	v.Format(f)
	return f.Output()
}