dxfwrite /

Filename Size Date modified Message
doc
dxfwrite
tests
130 B
385 B
34.3 KB
114 B
1.1 KB
2.5 KB
469 B
1.2 KB
21.9 KB
1.3 KB

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

with pip:

pip 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

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.