Code Monkey home page Code Monkey logo

ezdxf's Introduction

ezdxf

Read The Docs

Abstract

A Python package to create and modify DXF drawings, independent from the DXF version. You can open/save every DXF file without loosing any content (except comments), Unknown tags in the DXF file will be ignored but preserved for saving. With this behavior it is possible to open also DXF drawings that contains data from 3rd party applications.

Quick-Info

  • ezdxf is a Python package to read and write DXF drawings
  • intended audience: Developer
  • requires Python 2.7 or later, runs on CPython and pypy, maybe on IronPython and Jython
  • OS independent
  • additional required packages: pyparsing
  • MIT-License
  • supported DXF versions read/new: R12, R2000, R2004, R2007, R2010, R2013 and R2018
  • support for DXF versions R13/R14 (AC1012/AC1014), will be upgraded to R2000 (AC1015)
  • support for older versions than R12, will be upgraded to R12 (AC1009)
  • preserves third-party DXF content
  • additional fast and simple DXF R12 file/stream writer, just the ENTITIES section with support for LINE, CIRCLE, ARC, TEXT, POINT, SOLID, 3DFACE and POLYLINE.

a simple example:

import ezdxf

drawing = ezdxf.new(dxfversion='AC1024')  # or use the AutoCAD release name ezdxf.new(dxfversion='R2010')
modelspace = drawing.modelspace()
modelspace.add_line((0, 0), (10, 0), dxfattribs={'color': 7})
drawing.layers.new('TEXTLAYER', dxfattribs={'color': 2})
# use set_pos() for proper TEXT alignment - the relations between halign, valign, insert and align_point are tricky.
modelspace.add_text('Test', dxfattribs={'layer': 'TEXTLAYER'}).set_pos((0, 0.2), align='CENTER')
drawing.saveas('test.dxf')

example for the r12writer, writes a simple DXF R12 file without in-memory structures:

from random import random
from ezdxf.r12writer import r12writer

MAX_X_COORD = 1000.0
MAX_Y_COORD = 1000.0
CIRCLE_COUNT = 100000

with r12writer("many_circles.dxf") as dxf:
    for i in range(CIRCLE_COUNT):
        dxf.add_circle((MAX_X_COORD*random(), MAX_Y_COORD*random()), radius=2)

The r12writer supports only the ENTITIES section of a DXF R12 drawing, no HEADER, TABLES or BLOCKS section is present, except FIXED-TABLES are written, than some additional predefined text styles and line types are available.

Installation

Install with pip:

pip install ezdxf

or from source:

python setup.py install

Documentation

http://ezdxf.readthedocs.io/

The source code of ezdxf can be found on GitHub.com at:

http://github.com/mozman/ezdxf.git

Feedback

Issue Tracker at:

http://github.com/mozman/ezdxf/issues

Feedback, Q&A, Discussions at Google Groups:

https://groups.google.com/d/forum/python-ezdxf

Mailing List:

[email protected]

Feedback is greatly appreciated.

Manfred

[email protected]

ezdxf's People

Contributors

bdon avatar rossop avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.