Table of Contents

Class DxfLayout

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

A layout of a DXF file, as AutoCAD's Layout: a tab of the drawing, Model or a sheet of paper space, with its name, its place among the tabs, its limits and extents, the block that holds its entities and its viewports, and the settings it is plotted with (DxfPlotSettings).

public sealed class DxfLayout : DxfPlotSettings
Inheritance
DxfLayout
Inherited Members

Remarks

The layouts are Layouts, in the order of their tabs, and the entries of LayoutDictionary, by name. A drawing ezdxf made has Model and Layout1: Layout1's BlockTableRecord is *Paper_Space, its limits (0, 0) to (420, 297), a sheet of A3 on its side.

A layout is read; its name is set, the entry of the layout dictionary renamed with it. One made in code is added as AutoCAD's is, var plan = new DxfLayout { LayoutName = "Plan 1-50" }; plan.AddToLayoutDictionary(db, null); plan.Initialize();: its LAYOUT, its block and its entry by AddToLayoutDictionary(DxfDatabase, DxfBlockTableRecord), the viewport that shows its sheet by Initialize(). Its sheet is set as AutoCAD's PlotSettingsValidator sets it, once it is added: plan.CanonicalMediaName = "ISO_A2_(594.00_x_420.00_MM)" puts it on a sheet of A2 on its side, 594 by 420, its limits made (-7.5, -20) to (586.5, 400) with them; what is plotted, its scale, plot style table and flags are set as DxfPlotSettings says, and the rest of the plot settings are read, not set.

Constructors

DxfLayout()

Initializes a layout made in code, as AutoCAD's Layout(): give it its LayoutName, then add it to a drawing by AddToLayoutDictionary(DxfDatabase, DxfBlockTableRecord) and give it the viewport of its sheet by Initialize().

Properties

BlockTableRecord

Gets the block that holds the layout's entities (group 330 of AcDbLayout), as AutoCAD's BlockTableRecordId names it: ModelSpace for Model, PaperSpace for the layout last shown, *Paper_Space0 and on for the others; null where the drawing has no block of the handle, and for a layout made in code and not added.

Extents

Gets the box the entities of the layout fill as last worked out (groups 14, 24, 34 and 15, 25, 35), as AutoCAD's Extents; empty where the layout has none, as a new layout's least corner (1E+20, 1E+20, 1E+20) above its greatest says.

LayoutName

Gets or sets the name of the layout (group 1 of AcDbLayout), as AutoCAD's LayoutName: Model, Layout1; empty for a layout made in code and not named yet.

Limits

Gets the limits of the layout (groups 10, 20 and 11, 21 of AcDbLayout), as AutoCAD's Limits: the sheet a layout of paper space is drawn on, (0, 0) to (420, 297) for A3 on its side. A layout of paper space given a sheet, its margins, origin, units or turn (CanonicalMediaName and the others) has them made the sheet about its plotted area: (-7.5, -20) to (586.5, 400) for A2 on its side with margins 7.5 and 20.

TabOrder

Gets the place of the layout among the tabs (group 71), as AutoCAD's TabOrder: 0 for Model, 1 for the first sheet.

TabSelected

Gets whether the layout is the one shown when the drawing is opened, as AutoCAD's TabSelected says of the tab selected: Model where the header's $TILEMODE is 1 or not given, else the layout whose block is *Paper_Space. A drawing keeps no other selection of tabs; a layout made in code and not added is not selected.

Methods

AddToLayoutDictionary(DxfDatabase, DxfBlockTableRecord)

Adds a layout made in code to a drawing, as AutoCAD's AddToLayoutDictionary: a LAYOUT at the end of the OBJECTS section, named in the layout dictionary (ACAD_LAYOUT) by its LayoutName, on the tab after the last, with the plot settings of a sheet of A3 on its side and no plotter; and the block that holds its entities, whose BLOCK_RECORD names the layout (group 340), made where none is given. The layout has no viewport until Initialize() gives it one.

GetViewports()

Gets the viewports of the layout, as AutoCAD's GetViewports gives their ids: the VIEWPORTs of its block in the order of the file, the one of Number 1 that shows the sheet itself among them; none for Model.

Initialize()

Gives a layout of paper space the viewport that shows its sheet, as AutoCAD's Initialize: a VIEWPORT of Number 1 in its block ahead of the viewports it has, on and stacked first (68 of 1), about the middle of its Limits and 1.1 times their size, showing the sheet at 1:1, as ezdxf makes the main viewport of a layout; the layout's last active viewport (group 331) where it names none. A layout that has its viewport 1 is given nothing.

ToString()

Gives the layout as a line for debugging: its type, handle, name and tab.