GithubHelp home page GithubHelp logo

cmy235 / ezdxf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mozman/ezdxf

0.0 0.0 0.0 16.09 MB

Python interface to DXF

Home Page: https://ezdxf.mozman.at

License: Other

Python 99.35% CSS 0.14% HTML 0.06% JavaScript 0.45% Batchfile 0.01%

ezdxf's Introduction

ezdxf

Abstract

A Python package to create and modify DXF drawings, independent from the DXF version. You can open/save every DXF file without losing 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 create new DXF files and read/modify/write existing DXF files
  • the intended audience are developers
  • requires at least Python 3.6, for Python 3.5 use ezdxf < 0.11
  • OS independent
  • tested with CPython & pypy3 on Windows 10 & Manjaro Linux
  • additional required packages: pyparsing
  • MIT-License
  • read/write/new support for DXF versions: R12, R2000, R2004, R2007, R2010, R2013 and R2018
  • additional read support for DXF versions R13/R14 (upgraded to R2000)
  • additional read support for older DXF versions than R12 (upgraded to R12)
  • preserves third-party DXF content
  • additional fast DXF R12 writer, that creates just an ENTITIES section with support for the basic DXF entities

A simple example:

import ezdxf

# Create a new DXF document.
doc = ezdxf.new(dxfversion='R2010')

# Create new table entries (layers, linetypes, text styles, ...).
doc.layers.new('TEXTLAYER', dxfattribs={'color': 2})

# DXF entities (LINE, TEXT, ...) reside in a layout (modelspace, 
# paperspace layout or block definition).  
msp = doc.modelspace()

# Add entities to a layout by factory methods: layout.add_...() 
msp.add_line((0, 0), (10, 0), dxfattribs={'color': 7})
msp.add_text(
    'Test', 
    dxfattribs={
        'layer': 'TEXTLAYER'
    }).set_pos((0, 0.2), align='CENTER')

# Save DXF document.
doc.saveas('test.dxf')

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

from random import random
from ezdxf.r12writer import r12writer

MAX_X_COORD = 1000
MAX_Y_COORD = 1000

with r12writer("many_circles.dxf") as doc:
    for _ in range(100000):
        doc.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 for Python 3.6 and later:

pip install ezdxf

Install with pip for Python 3.5:

pip install ezdxf<0.11

Install latest development version with pip from GitHub:

pip install git+https://github.com/mozman/ezdxf.git@master

or from source:

python setup.py install

Website

https://ezdxf.mozman.at/

Documentation

Documentation of development version at https://ezdxf.mozman.at/docs

Documentation of latest release at http://ezdxf.readthedocs.io/

Contribution

The source code of ezdxf can be found at GitHub, target your pull requests to the master branch:

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

Feedback

Questions and feedback at Google Groups:

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

[email protected]

Questions at Stack Overflow:

Post questions at stack overflow and use the tag dxf or ezdxf.

Issue tracker at GitHub:

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

Contact

Please post questions at the forum or stack overflow to make answers available to other users as well.

[email protected]

Feedback is greatly appreciated.

Manfred

ezdxf's People

Contributors

mozman avatar chr15m avatar scotthilton avatar luzpaz avatar bdon avatar danielpompermayer avatar k3rn3l3rr0r avatar rossop avatar mihirat 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.