Header Section

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

See also

DXF Internals: HEADER Section

class ezdxf.sections.header.HeaderSection
custom_vars

Stores the custom drawing properties in a CustomVars object.

__len__() → int

Returns count of header variables.

__contains__(key) → bool

Returns True if header variable key exist.

varnames() → KeysView

Returns an iterable of all header variable names.

get(key: str, default: Any = None) → Any

Returns value of header variable key if exist, else the default value.

__getitem__(key: str) → Any

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

__setitem__(key: str, value: Any) → None

Set header variable key to value by index operator like: drawing.header['$ANGDIR'] = 1

__delitem__(key: str) → None

Delete header variable key by index operator like: del drawing.header['$ANGDIR']

class ezdxf.sections.header.CustomVars

Stores custom properties in the DXF header as $CUSTOMPROPERTYTAG and $CUSTOMPROPERTY values. Custom properties are just supported by DXF R2004 (AC1018) or later. ezdxf can create custom properties at older DXF versions, but AutoCAD will not show this properties.

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).

__len__() → int

Count of custom properties.

__iter__() → Iterable[Tuple[str, str]]

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

clear() → None

Remove all custom properties.

get(tag: str, default: str = None)

Returns the value of the first custom property tag.

has_tag(tag: str) → bool

Returns True if custom property tag exist.

append(tag: str, value: str) → None

Add custom property as (tag, value) tuple.

replace(tag: str, value: str) → None

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

remove(tag: str, all: bool = False) → None

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