Drawing Header Section

The drawing settings are stored in the header section, which is accessible by the header attribute. See the online documentation from Autodesk for available header variables.

class HeaderSection
HeaderSection.__getitem__(key)

Get drawing settings by index operator like: drawing.header['$ACADVER']

HeaderSection.__setitem__(key, value)

Set drawing settings by index operator like: drawing.header['$ANGDIR'] = 1 # Clockwise angles

HeaderSection.custom_vars

Stores the custom drawing properties in CustomVars object.

class CustomVars

Stores custom properties in the DXF header as $CUSTOMPROPERTYTAG/$CUSTOMPROPERTY values. Custom properties are just supported at DXF version AC1018 (AutoCAD 2004) or newer. With ezdxf you can create custom properties on older DXF versions, but AutoCAD will not show this properties.

CustomVars.properties

List of custom drawing properties, stored as string tuples (tag, value). Multiple occurrence of the same custom tag is allowed, but not well supported by the interface. This is a standard python list and it is save to change this list as long you store just tuples of strings in the format (tag, value).

CustomVars.__len__()

Count of custom properties.

CustomVars.__iter__()

Iterate over all custom properties as (tag, value) tuples.

CustomVars.clear()

Removes all custom properties.

CustomVars.get(tag, default=None)

Returns the value of the first custom property tag.

CustomVars.has_tag(tag)

True if custom property tag exists, else False.

CustomVars.append(tag, value)

Add custom property as (tag, value) tuple.

CustomVars.replace(tag, value)

Replaces the value of the first custom property tag by a new value. Raises DXFValueError if tag does not exist.

CustomVars.remove(tag, all=False)

Removes the first occurrence of custom property tag, removes all occurrences if all is True. Raises DXFValueError if tag does not exist.