Search code examples
pythoncaddxf

How to add a tagging or label(the same thing in a cad file) through ezdxf or dxfwrite of python?


I want to born a file which can be open by CAD software.

I choose the library named 'ezdxf'.

I get trouble when I want to add a label(or tagging, I mean,the function provide by CAD software to show the begin and end point of a line segment).

I had tried to read the documents of the 'ezdxf',but did not found anything about the label or tagging(en,with my poor English and the Google translation).

So, the question:

If I want to born a file like 'XXX.dxf',which library of python has more function(s) and provide the function above ---- add a label or tagging?


Solution

  • Create a new Drawing with ezdxf:

    import ezdxf
    drawing = ezdxf.new(dxfversion='AC1009')
    

    Supported DXF versions:

    • AC1009 AutoCAD R12
    • AC1015 AutoCAD R2000
    • AC1018 AutoCAD R2004
    • AC1021 AutoCAD R2007
    • AC1024 AutoCAD R2010
    • AC1027 AutoCAD R2013
    • AC1032 AutoCAD R2018

    The title of dxfwrite at github is:

    Outdated DXF R12 writer, please switch to ezdxf

    There exists no library which provides exact what you need, ezdxf is just an interface to the DXF format not a CAD application.