r12strict

Added in version 1.1.

Due to ACAD release 14 the resource names, such as layer-, linetype, text style-, dimstyle- and block names, were limited to 31 characters in length and all names were uppercase.

Names can include the letters A to Z, the numerals 0 to 9, and the special characters, dollar sign "$", underscore "_", hyphen "-" and the asterix "*" as first character for special names like anonymous blocks. Most applications do not care about that and work fine with longer names and any characters used in names for some exceptions, but of course Autodesk applications are very picky about that.

The function make_acad_compatible() makes DXF R12 drawings to 100% compatible to Autodesk products and does everything at once, but the different processing steps can be called manually.

Important

This module can only process DXF R12 file and will throw a DXFVersionError otherwise. For exporting any DXF document as DXF R12 use the ezdxf.addons.r12export add-on.

Usage

import ezdxf
from ezdxf import r12strict

doc = ezdxf.readfile("r12sloppy.dxf")
r12strict.make_acad_compatible(doc)
doc.saveas("r12strict.dxf")

Functions

make_acad_compatible

Apply all DXF R12 requirements, so Autodesk products will load the document.

translate_names

Translate table and block names into strict DXF R12 names.

clean

Removes all features that are not supported for DXF R12 by Autodesk products.

ezdxf.r12strict.make_acad_compatible(doc: Drawing) None

Apply all DXF R12 requirements, so Autodesk products will load the document.

ezdxf.r12strict.translate_names(doc: Drawing) None

Translate table and block names into strict DXF R12 names.

ACAD Releases upto 14 limit names to 31 characters in length and all names are uppercase. Names can include the letters A to Z, the numerals 0 to 9, and the special characters, dollar sign ($), underscore (_), hyphen (-) and the asterix (*) as first character for special names like anonymous blocks.

Most applications do not care about that and work fine with longer names and any characters used in names for some exceptions, but of course Autodesk applications are very picky about that.

Note

This is a destructive process and modifies the internals of the DXF document.

ezdxf.r12strict.clean(doc: Drawing) None

Removes all features that are not supported for DXF R12 by Autodesk products.

class ezdxf.r12strict.R12NameTranslator

Translate table and block names into strict DXF R12 names.

ACAD Releases upto 14 limit names to 31 characters in length and all names are uppercase. Names can include the letters A to Z, the numerals 0 to 9, and the special characters, dollar sign ($), underscore (_), hyphen (-) and the asterix (*) as first character for special names like anonymous blocks.

reset() None
translate(name: str) str