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: Optional[str]) Layout

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


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

new(name: str, dxfattribs: Optional[dict] = None) Paperspace

Returns a new Paperspace layout.

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

  • dxfattribs – additional DXF attributes for the DXFLayout entity

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.

  • old_name – actual layout name, case insensitive

  • new_name – new layout name, case insensitive

delete(name: str) None

Delete layout name and destroy all entities in that layout.


name (str) – layout name as shown in tabs

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.