Table Classes

Generic Table Class

class ezdxf.sections.table.Table

Generic collection of table entries. Table entry names are case insensitive: 'Test' == 'TEST'.

static key(entity: Union[str, DXFEntity]) → str

Unified table entry key.

has_entry(name: Union[str, DXFEntity]) → bool

Returns True if an table entry name exist.

__contains__(name: Union[str, DXFEntity]) → bool

Returns True if an table entry name exist.

__len__() → int

Count of table entries.

__iter__() → Iterable[DXFEntity]

Iterable of all table entries.

new(name: str, dxfattribs: dict = None) → DXFEntity

Create a new table entry name.

Parameters
  • name – name of table entry, case insensitive

  • dxfattribs – additional DXF attributes for table entry

get(name: str) → DXFEntity

Get table entry name (case insensitive). Raises DXFValueError if table entry does not exist.

remove(name: str) → None

Removes table entry name. Raises DXFValueError if table-entry does not exist.

duplicate_entry(name: str, new_name: str) → DXFEntity

Returns a new table entry new_name as copy of name, replaces entry new_name if already exist.

Raises

DXFValueErrorname does not exist

Layer Table

class ezdxf.sections.table.LayerTable

Subclass of Table.

Collection of Layer objects.

Linetype Table

Generic table class of Table.

Collection of Linetype objects.

Style Table

class ezdxf.sections.table.StyleTable

Subclass of Table.

Collection of Textstyle objects.

get_shx(shxname: str) → Textstyle

Get existing shx entry, or create a new entry.

Parameters

shxname – shape file name like ‘ltypeshp.lin’

find_shx(shxname: str) → Optional[Textstyle]

Find .shx shape file table entry, by a case insensitive search.

A .shx shape file table entry has no name, so you have to search by the font attribute.

Parameters

shxname – .shx shape file name

DimStyle Table

Generic table class of Table.

Collection of DimStyle objects.

AppID Table

Generic table class of Table.

Collection of AppID objects.

UCS Table

Generic table class of Table.

Collection of UCSTable objects.

View Table

Generic table class of Table.

Collection of View objects.

Viewport Table

class ezdxf.sections.table.ViewportTable

The viewport table stores the modelspace viewport configurations. A viewport configuration is a tiled view of multiple viewports or just one viewport. In contrast to other tables the viewport table can have multiple entries with the same name, because all viewport entries of a multi-viewport configuration are having the same name - the viewport configuration name.

The name of the actual displayed viewport configuration is '*ACTIVE'.

Duplication of table entries is not supported: duplicate_entry() raises NotImplementedError

get_config(self, name: str) → List[Viewport]

Returns a list of Viewport objects, for the multi-viewport configuration name.

delete_config(name: str) → None

Delete all Viewport objects of the multi-viewport configuration name.

Block Record Table

Generic table class of Table.

Collection of BlockRecord objects.