Table of Contents

CadLayouts

from OpenCAD2D import CadLayouts

class CadLayouts(System.Object) ยท CadLayouts in the .NET reference

Makes layouts and sets them up from code: a new layout on a sheet, its page setup (sheet, turn, what is plotted, scale and plot style) and viewports at a scale, the work of LAYOUT New, the page setup and MVIEW with a scale given. Each call is one undo step. A script that lays a sheet out, the Python package and the remote channel use it.

Methods

Add

.NET

@staticmethod
def Add(document: CadDocument, name: str, paper: str, landscape: bool) -> CadLayoutInfo

Adds a layout and sets its sheet, as LAYOUT New and the page setup do: the sheet of the paper given on its side or turned, what is plotted the layout itself at 1:1. It is not made the layout shown. One undo step.

AddViewport

.NET

@staticmethod
def AddViewport(
    document: CadDocument,
    layout: str,
    frame: Sequence[float] | System.Array[float],
    scale: str,
    center: Sequence[float] | System.Array[float],
    frozenLayers: System.Collections.Generic.IEnumerable[str],
) -> str

Adds a viewport to a layout that shows model space at a scale, as MVIEW with two corners and the scale of ZOOM nXP: the frame is the viewport's rectangle on the sheet, the view is centred on a point of model space and shows scale paper millimetres to the unit, and the layers named are frozen in this viewport only. A frame 200 wide and 100 high at 1:50 shows 10 000 by 5 000 units. One undo step.

List

.NET

@staticmethod
def List(document: CadDocument) -> System.Collections.Generic.IReadOnlyList[CadLayoutInfo]

Reads how every layout of a drawing is set up, model space first, then the tabs in their order.

Paper

.NET

@staticmethod
def Paper(name: str) -> CadPaper

The sheet of a name in the plotter's list: ISO A3, ISO_A3 and A3 are one, letters of either case the same.

ParseScale

.NET

@staticmethod
def ParseScale(text: str) -> tuple[float, float]

Reads a scale as paper millimetres to drawing units: 1:50 is 1 to 50, 2:1 is 2 to 1, and a plain number is paper millimetres to one unit (0.02 is 1:50).

ScaleText

.NET

@staticmethod
def ScaleText(scale: float) -> str

The scale as 1:50 or 2:1; null where it is not a number above nought.

SetPageSetup

.NET

@staticmethod
def SetPageSetup(
    document: CadDocument,
    layout: str,
    paper: str,
    orientation: str,
    area: str,
    scale: str,
    plotStyle: str,
) -> CadLayoutInfo

Changes the page setup of a layout, as the Page Setup dialog does: only what is given is changed. One undo step.