skip to navigation
skip to content

dxfwrite 0.3.5

A Python library to create DXF R12 drawings.

Downloads ↓ | Package Documentation

Latest Version: 1.1.0

dxfwrite

Abstract

A Python library to create DXF R12 drawings.

a simple example:

from dxfwrite import DXFEngine as dxf
drawing = dxf.drawing('test.dxf')
drawing.add(dxf.line((0, 0), (10, 0), color=7))
drawing.add_layer('TEXTLAYER', color=2)
drawing.add(dxf.text('Test', insert=(0, 0.2), layer='TEXTLAYER')
drawing.save()

supported DXF R12 entities

  • ARC
  • ATTDEF
  • ATTRIB
  • BLOCK
  • CIRCLE
  • 3DFACE
  • INSERT
  • LINE
  • POINT
  • POLYLINE (special Polyface and Polymesh objects are available)
  • SHAPE (not tested)
  • SOLID
  • TRACE
  • TEXT
  • VERTEX (only for internal use, see Polyline, Polyface and Polymesh objects)

not supported DXF R12 entities

  • DIMENSION

emulated entities from DXF R13 and later

  • MTEXT (R13) ... emulated as composite entity MText
  • ELLIPSE (R13) ... approximated by Ellipse
  • SPLINE (R13) ... approximated by Spline
  • LWPOLYLINE (R13) ... use POLYLINE
  • TABLE (R2005) ... emulated as composite entity Table

composite entities

  • MText -- multi line text
  • LinearDimension
  • AngularDimension
  • ArcDimension
  • RadialDimension
  • Table -- text and blockrefs containing table like a HTML-table
  • Ellipse -- approximated as POLYLINE
  • Spline -- cubic spline curve through breakpoints without additional control points, approximated as POLYLINE
  • Bezier -- cubic bezier curve through breakpoints with additional control points, approximated as POLYLINE
  • Clothoid -- Euler spiral, approximated as POLYLINE

read/write AutoCAD ctb-files

The module acadctb provides the ability to read and write AutoCAD ctb-files. With ctb-files you can assign a new color or lineweight to a dxf-color-index for plotting or printing, but this has to be supported by the used application.

a simple example:

from dxfwrite import acadctb
ctb = acadctb.load('test.ctb')
style1 = ctb.get_style(1) # dxf color index (1 .. 255)
style1.set_color(23, 177, 68) # set rgb values (0..255)
style1.set_lineweight(0.7)
ctb.save('new.ctb')

Installation

with easy_install:

easy_install dxfwrite

or from source:

python setup.py install

Documentation

http://bitbucket.org/mozman/dxfwrite/wiki/Home

Good Luck! Feedback is greatly appreciated.

Manfred

mozman@gmx.at

dxfwrite can be found on bitbucket.org at:

http://bitbucket.org/mozman/dxfwrite NEWS ====

Version 0.3.5 - 10 September 2010
  • new: package and tests run with Python 2.7
Version 0.3.4 - 29 August 2010
  • status: 5 - Production/Stable
  • new: package and tests run with Python 2.5 (tests need unittest2)
Version 0.3.3 - 27 April 2010
  • BUGFIX: makedxfexamples.py - attdef keyword error
Version 0.3.2 - 27 April 2010
  • BUGFIX: Drawing.__dxf__() - StringIO() does not support 'with' statement
Version 0.3.1 - 24 April 2010
  • new: insert2, insert block reference with automatic attrib filling
  • changed interface for DXFEngine.attrib()
Version 0.3.0b1 - 28 March 2010
  • new: subpackage algebra: circle, ray, clothoid, cspline, bezier (27.03.2010)
  • new: Spline, Bezier, Clothoid and Ellipse - curves (27.03.2010)
  • new: acadctb.py to read, write and create AutoCAD ctb-files (25.03.2010)
  • splitted buildups.py into mtext.py and rect.py
Version 0.2.0 - 21 March 2010
  • Alpha status - api may change
Version 0.1.0 - 14 March 2010
  • Pre-Alpha status
  • Initial release
 
File Type Py Version Uploaded on Size # downloads
dxfwrite-0.3.5.tar.gz (md5) Source 2010-09-10 127KB 341
dxfwrite-0.3.5.zip (md5) Source 2010-09-10 161KB 321