Layout Manager

The layout manager is unique to each DXF drawing, access the layout manager as layouts attribute of the Drawing object (e.g. doc.layouts.rename("Layout1", "PlanView")).

class ezdxf.layouts.Layouts

The Layouts class manages Paperspace layouts and the Modelspace.

__len__() int

Returns count of existing layouts, including the modelspace layout.

__contains__(name: str) bool

Returns True if layout name exist.

__iter__() Iterator[Layout]

Returns iterable of all layouts as Layout objects, including the modelspace layout.

names() list[str]

Returns a list of all layout names, all names in original case sensitive form.

names_in_taborder() list[str]

Returns all layout names in tab order as shown in CAD applications.

modelspace() Modelspace

Returns the Modelspace layout.

get(name: str | None) Layout

Returns Layout by name, case insensitive “Model” == “MODEL”.

Parameters:

name – layout name as shown in tab, e.g. 'Model' for modelspace

new(name: str, dxfattribs=None) Paperspace

Returns a new Paperspace layout.

Parameters:
  • name – layout name as shown in tabs in CAD applications

  • dxfattribs – additional DXF attributes for the DXFLayout entity

Raises:
rename(old_name: str, new_name: str) None

Rename a layout from old_name to new_name. Can not rename layout 'Model' and the new name of a layout must not exist.

Parameters:
  • old_name – actual layout name, case insensitive

  • new_name – new layout name, case insensitive

Raises:
delete(name: str) None

Delete layout name and destroy all entities in that layout.

Parameters:

name (str) – layout name as shown in tabs

Raises:
active_layout() Paperspace

Returns the active paperspace layout.

set_active_layout(name: str) None

Set layout name as active paperspace layout.

get_layout_for_entity(entity: DXFEntity) Layout

Returns the owner layout for a DXF entity.