创建dxf r12图形的python库。

dxfwrite的Python项目详细描述


dxfwrite

摘要

创建dxf r12图形的python库。

一个简单的例子:

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()

支持的dxf r12实体

  • 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)
  • VIEWPORT

不支持dxf r12实体

  • DIMENSION

来自dxf r13及更高版本的模拟实体

  • 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

复合实体

  • 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

读/写autocad ctb文件

模块acadctb提供读取和写入AutoCAD ctb文件的能力。 使用CTB文件,可以为DXF颜色索引指定新的颜色或线宽 打印或打印,但这必须由使用的应用程序支持。

一个简单的例子:

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')

安装

使用pip:

pip install dxfwrite

或来源:

python setup.py install

文件

http://dxfwrite.readthedocs.org

http://packages.python.org/dxfwrite/

dxfwrite的源代码库可以在github.com上找到:

https://github.com/mozman/dxfwrite.git

非常感谢您的反馈。

莫兹曼<;mozman@gmx.at>

新闻

版本1.2.1-2017-01-22

版本1.2.0-2012-08-01

  • License changed to MIT License
  • tested on Win7 with: CPython2.7, CPython3.2, CPython3.3 beta, pypy-1.9

版本1.1.0-2011-12-29

  • rewrite of DXF-String building process
  • refactored MText class
  • changed Viewport table entry to VPort and DXFEngine.viewport to DXFEngine.vport. This was necessary to implement the VIEWPORT (Entity)
  • added VIEWPORT (Entity) to create viewports in paper space
  • view docs also on http://dxfwrite.readthedocs.org
  • added some docs
  • changed clothoid mirror parameters
  • added methods to class Layer: on(), off(), freeze(), thaw(), lock(), unlock()
  • tested on Win7 32 Bit with CPython-2.7, CPython-3.2 and pypy-1.7, IronPython 2.7 failed tests - unicode issues
  • tested on Ubuntu 11.10 64 Bit with CPython-2.7, CPython-3.2 and pypy-1.7

版本1.0.2-2011-12-08

  • raw unicode encoding by Toni Ruža - use any unicode character for text and table-entries.

版本1.0.1-2011-03-26

  • added easy usage of modelspace/paperspace, see examples/paperspace.py
  • BUGFIX: removed dict-comprehension in module htmlcolors.py for backward-compatibility to Python 2.5 and 2.6, works with pypy 1.4.1

版本1.0.0-2011-03-11

  • changed: set DXF Header variables now looks like dwg.header[‘$VAR’] = value, see http://packages.python.org/dxfwrite/headervars.html
  • splitted makedxfexamples.py into several files and moved them into the subdir ‘examples’
  • curves.Ellpise: radiusx -> rx; radiusy -> ry
  • moved documentation to: http://packages.python.org/dxfwrite, and using Sphinx (http://sphinx.pocoo.org)
  • tested with Python 3.2 - OK
  • further compatibility-tests only for CPython 2.7 & CPython 3.2+
  • added Drawing.add_xref(filename), for usage see examples/xref.py
  • adding relative attributes by Insert.add() consider the xy-scaling
  • added Howtos section to documentation

版本0.3.6-2010-11-14

  • moved dxfwrite.drawing.ENCODING to class Drawing
  • Python 3.1 support

版本0.3.5-2010-09-10

  • new: package and tests run with Python 2.7

版本0.3.4-2010-08-29

  • status: 5 - Production/Stable
  • new: package and tests run with Python 2.5 (tests need unittest2)

版本0.3.3-2010-04-27

  • BUGFIX: makedxfexamples.py - attdef keyword error

版本0.3.2-2010-04-27

  • BUGFIX: Drawing.__dxf__() - StringIO() does not support ‘with’ statement

版本0.3.1-2010-04-24

  • new: insert2, insert block reference with automatic attrib filling
  • changed interface for DXFEngine.attrib()

版本0.3.0b1-2010-03-28

  • 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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java这种src与构建树时间戳的比较如何更快?   java如何在两个命令处理程序之间通信   java下拉框值更改   Java如何从另一个类中提取字段的值   无字段名的java Jackson序列化   java游戏循环和方法调用   java Spring Security permitAll()匹配器被忽略   java如何在一个方法中将数组中的int作为单独的int传递?   使用ArrayList在Java中实现同步队列   java JButton的操作侦听器在JTable中不工作   java中C++ OOP指针的技巧   java My regex搜索只打印出最后一个匹配项   java如何在Hadoop中序列化非常大的可写对象   spring Paypal JavaSDK支付执行问题   带有SPNEGO SSO的java Tomcat 6仍会提示输入登录名和密码   java HttpResponse主体正在更改   java如何在RxJava中实现链锁   为什么我需要java。lang.ClassNotFoundException:com。mysql。希杰。jdbc。mysqlconnectorjava8时的驱动程序。0.16.jar在类路径中?   java输入错误。即使在接受新输入后仍使用旧输入