Table of Contents

CadPlotSettings

from OpenCAD2D import CadPlotSettings

class CadPlotSettings(System.Object) · CadPlotSettings in the .NET reference

How a space is plotted, as AutoCAD's Plot dialog sets it: the plotter, the sheet and its turn, what part of the space, at what scale and where on the sheet, the plot style table and the lineweights. A drawing keeps it in the plot settings of each layout (the part AcDbPlotSettings of its LAYOUT, model space's in the layout Model): CadPlotSettings.Read takes them from there and CadPlotSettings.ApplyTo writes them back, as Apply to Layout and Save changes to layout do.

Constructors

__init__

def __init__(self) -> None

Properties and fields

JpgDevice

.NET

JpgDevice: ClassVar[str]

The name of the presenter's raster device that writes a JPEG at a quality of 90: "OpenCAD2D JPG".

PdfDevice

.NET

PdfDevice: ClassVar[str]

The name of the presenter's own plotter, which writes a PDF: "OpenCAD2D PDF".

PngDevice

.NET

PngDevice: ClassVar[str]

The name of the presenter's raster device that writes a PNG, lossless: "OpenCAD2D PNG".

Area

.NET

@property
def Area(self) -> CadPlotArea
@Area.setter
def Area(self, value: CadPlotArea) -> None

Gets or sets what part of the space is plotted; what the view shows by default.

Centered

.NET

@property
def Centered(self) -> bool
@Centered.setter
def Centered(self, value: bool) -> None

Gets or sets whether the plot is centred on the printable area; on by default. A plot of a layout's sheet is never centred.

DeviceName

.NET

@property
def DeviceName(self) -> str
@DeviceName.setter
def DeviceName(self, value: str | None) -> None

Gets or sets the name of the plotter; CadPlotSettings.PdfDevice by default, the one the presenter plots with.

DrawingUnits

.NET

@property
def DrawingUnits(self) -> float
@DrawingUnits.setter
def DrawingUnits(self, value: float) -> None

Gets or sets the drawing units the CadPlotSettings.PaperUnits stand for: 20 for 1:20; 1 by default.

EffectiveStyleSheet

.NET

@property
def EffectiveStyleSheet(self) -> str

Gets the file name of the plot style table the plot reads: CadPlotSettings.StyleSheet, or empty where CadPlotSettings.PlotWithPlotStyles is off.

EffectiveStyleTable

.NET

@property
def EffectiveStyleTable(self) -> CadPlotStyleTable

Gets the plot style table the colours are plotted by: CadPlotSettings.StyleTable, or none where CadPlotSettings.PlotWithPlotStyles is off.

FitToPaper

.NET

@property
def FitToPaper(self) -> bool
@FitToPaper.setter
def FitToPaper(self, value: bool) -> None

Gets or sets whether the plot is scaled to fill the printable area; on by default.

IsPrinter

.NET

@property
def IsPrinter(self) -> bool

Gets whether the plotter is a printer of Windows, chosen by CadPlotSettings.UsePrinter: neither CadPlotSettings.PdfDevice nor a raster device. Its sheets are the printer's own, and a plot goes to its paper.

IsRaster

.NET

@property
def IsRaster(self) -> bool

Gets whether the plotter is one of the raster devices, OpenCAD2D PNG or JPG, whose sheet is an image sized in pixels.

Landscape

.NET

@property
def Landscape(self) -> bool
@Landscape.setter
def Landscape(self, value: bool) -> None

Gets or sets whether the sheet lies on its side, wider than it is high; on by default.

OffsetX

.NET

@property
def OffsetX(self) -> float
@OffsetX.setter
def OffsetX(self, value: float) -> None

Gets or sets how far right of the printable area's corner the plot is moved, in millimetres, where it is not centred.

OffsetY

.NET

@property
def OffsetY(self) -> float
@OffsetY.setter
def OffsetY(self, value: float) -> None

Gets or sets how far up of the printable area's corner the plot is moved, in millimetres.

Paper

.NET

@property
def Paper(self) -> CadPaper
@Paper.setter
def Paper(self, value: CadPaper) -> None

Gets or sets the sheet; ISO A3 by default.

PaperUnits

.NET

@property
def PaperUnits(self) -> float
@PaperUnits.setter
def PaperUnits(self, value: float) -> None

Gets or sets the millimetres of the paper of the scale; 1 by default.

.NET

@property
def PdfHyperlinks(self) -> bool
@PdfHyperlinks.setter
def PdfHyperlinks(self, value: bool) -> None

Gets or sets whether each hyperlink of an object plotted becomes a link of the PDF over the object's box, as EXPORTPDF's Include hyperlinks; only the PDF writer reads it. Off by default.

PdfShx

.NET

@property
def PdfShx(self) -> bool
@PdfShx.setter
def PdfShx(self, value: bool) -> None

Gets or sets whether the text of an SHX font is also written to a PDF as text no eye can see, over its strokes, so that a reader's search finds it: AutoCAD's PDFSHX. Only the PDF writer reads it; the commands set it from PDFSHX, and a drawing keeps it nowhere. Off by default.

PlotLineweights

.NET

@property
def PlotLineweights(self) -> bool
@PlotLineweights.setter
def PlotLineweights(self, value: bool) -> None

Gets or sets whether the lines plot at their lineweights; off, every line is the thinnest the plotter draws. On by default.

PlotStamp

.NET

@property
def PlotStamp(self) -> CadPlotStamp | None
@PlotStamp.setter
def PlotStamp(self, value: CadPlotStamp | None) -> None

Gets or sets the plot stamp the plot carries, null for none. The commands set a copy of the session's stamp (CadCommandSession.PlotStamp) where it is on; only the PDF writer reads it, and a drawing keeps it nowhere. Null by default.

PlotTransparency

.NET

@property
def PlotTransparency(self) -> bool
@PlotTransparency.setter
def PlotTransparency(self, value: bool) -> None

Gets or sets whether the transparency of objects is plotted. The presenter's display lists carry no transparency, so a plot is the same either way; it is kept for the dialog and is not written to the drawing, which AutoCAD keeps it in no group of the plot settings a DXF holds.

PlotWithPlotStyles

.NET

@property
def PlotWithPlotStyles(self) -> bool
@PlotWithPlotStyles.setter
def PlotWithPlotStyles(self, value: bool) -> None

Gets or sets whether the plot style table is used; off, colours plot as with CadPlotStyleTable.None. On by default.

SavedPlotter

.NET

@property
def SavedPlotter(self) -> str

Gets the plotter the layout or page setup named when these settings were read (group 2), such as Microsoft Print to PDF or AutoCAD's DWG To PDF.pc3; empty where it named none, or these settings were not read from a drawing, or a plotter has been chosen since (CadPlotSettings.UseDevice, CadPlotSettings.UsePrinter). The Plot dialog chooses it again when it is a printer this computer has.

Scale

.NET

@property
def Scale(self) -> float

Gets the scale as millimetres of paper per drawing unit, where the plot is not fitted: 0.05 for 1:20.

ScaleLineweights

.NET

@property
def ScaleLineweights(self) -> bool
@ScaleLineweights.setter
def ScaleLineweights(self, value: bool) -> None

Gets or sets whether the lineweights are scaled with the plot: a line of 0.5 plotted at 1:2 is 0.25 wide, at 2:1 it is 1 wide.

StyleSheet

.NET

@property
def StyleSheet(self) -> str
@StyleSheet.setter
def StyleSheet(self, value: str | None) -> None

Gets or sets the plot style table by the name of its file, as AutoCAD's CurrentStyleSheet (group 7 of the plot settings): monochrome.ctb by default, acad.ctb, mine.stb; empty for none. A plot reads the file from the document's CadDocument.PlotStyleFolder (CadPlotStyleResolver). The name is trimmed and kept as given, in the case the drawing spells it, whether or not a file of it exists.

StyleTable

.NET

@property
def StyleTable(self) -> CadPlotStyleTable
@StyleTable.setter
def StyleTable(self, value: CadPlotStyleTable) -> None

Gets or sets the plot style table as one of the three the presenter made before tables were files: a name with monochrome in it is CadPlotStyleTable.Monochrome, one with grayscale is CadPlotStyleTable.Grayscale, any other and none are CadPlotStyleTable.None. Setting it sets CadPlotSettings.StyleSheet to monochrome.ctb, grayscale.ctb or none. Monochrome by default.

UpsideDown

.NET

@property
def UpsideDown(self) -> bool
@UpsideDown.setter
def UpsideDown(self, value: bool) -> None

Gets or sets whether the plot is turned half round on the sheet.

ViewName

.NET

@property
def ViewName(self) -> str
@ViewName.setter
def ViewName(self, value: str | None) -> None

Gets or sets the name of the named view plotted where CadPlotSettings.Area is CadPlotArea.View, as it is written in the page setup (group 6 of the plot settings); empty by default. The name is trimmed and kept as given; CadPlotSettings.ViewNames lists the views a drawing offers.

Window

.NET

@property
def Window(self) -> DisplayBox
@Window.setter
def Window(self, value: DisplayBox) -> None

Gets or sets the window plotted where CadPlotSettings.Area is CadPlotArea.Window, in drawing units.

Methods

ApplyTo

.NET

def ApplyTo(self, document: CadDocument, space: CadSpace) -> CadEditResult

Writes the settings into the plot settings of a space's LAYOUT, as Apply to Layout does, one undo step named PLOT: the plotter's name (group 2), the sheet's name, size and margins in millimetres (4, 40 to 45, 72), its turn (73) as AutoCAD reckons it from the sheet as named, the offset (46, 47), what is plotted (74) and the window (48, 49, 140, 141), the scale (142, 143, and 75 with 147 and flag 16 where it is one of AutoCAD's standard scales, scaled to fit as 75 of 0), centring (flag 4), the table (7) by the name of its file (CadPlotSettings.StyleSheet), and the flags of plot styles (32), lineweights (128) and their scaling (64). Plot transparency is not written. A layout's limits follow its sheet, as DxfLayout makes them.

CheckPageSetupName

.NET

@staticmethod
def CheckPageSetupName(name: str) -> str

Says why a name cannot name a page setup, as AutoCAD refuses one: empty, longer than 255 letters, or with a < > / \ " : ; ? * | , = ` in it.

Clone

.NET

def Clone(self) -> CadPlotSettings

Makes a copy that changes apart from this one.

CurrentPageSetupName

.NET

@staticmethod
def CurrentPageSetupName(document: CadDocument, space: CadSpace) -> str

Gets the name of the page setup a space is set to, as the Page Setup Manager shows it as the current one: the name its LAYOUT keeps (group 1) where the drawing has a page setup of it, written by CadPlotSettings.SetCurrentPageSetup.

DeletePageSetup

.NET

@staticmethod
def DeletePageSetup(document: CadDocument, name: str) -> CadEditResult

Takes a page setup out of the drawing, as Delete on the Page Setup Manager's list does, one undo step named PAGESETUP. A layout that was set to it keeps its settings and is set to no page setup.

ImportPageSetups

.NET

@staticmethod
def ImportPageSetups(
    document: CadDocument,
    source: DxfDatabase,
    names: System.Collections.Generic.IEnumerable[str],
) -> CadEditResult

Copies page setups of another drawing into this one, as Import of the Page Setup Manager does, one undo step named PAGESETUP. A page setup whose name the drawing has already is added as Name (2), Name (3) and on, so that none is lost.

IsRasterDevice

.NET

@staticmethod
def IsRasterDevice(name: str) -> bool

Gets whether a plotter's name is one of the raster devices, either case.

PageSetupIsModel

.NET

@staticmethod
def PageSetupIsModel(database: DxfDatabase, name: str) -> bool

Gets whether a page setup of a drawing was made for model space (flag 1024 of its group 70, AutoCAD's ModelType), the Model that Import Page Setups lists in its Location column; Layout otherwise.

PageSetupNames

.NET

@staticmethod
def PageSetupNames(database: DxfDatabase) -> System.Collections.Generic.IReadOnlyList[str]

Gets the page setups of another drawing by name, as Import in the Page Setup Manager lists them: the PLOTSETTINGS of its dictionary ACAD_PLOTSETTINGS, in ordinal order of their names, letters of either case the same.

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

Gets the page setups of a drawing by name, as the Name list of the Plot dialog's Page setup offers them: the PLOTSETTINGS of its dictionary ACAD_PLOTSETTINGS, in ordinal order of their names, letters of either case the same.

Read

.NET

@staticmethod
def Read(document: CadDocument, space: CadSpace) -> CadPlotSettings

Reads how a space is plotted from the drawing, as AutoCAD's Plot dialog opens on a layout's page setup: the plot settings of the space's LAYOUT, model space's from the layout Model. The sheet is the standard one of the name the layout gives and its margins, else one made of the layout's size and margins, ISO A3 where it gives none; a named view is kept by its name (CadPlotSettings.ViewName), a layout's sheet of model space as its extents; the plot style table is kept by the name of its file (CadPlotSettings.StyleSheet), monochrome.ctb reading as CadPlotStyleTable.Monochrome and grayscale.ctb as CadPlotStyleTable.Grayscale through CadPlotSettings.StyleTable. A space whose settings cannot be read is given the defaults, a layout plotting its sheet at 1:1.

ReadPageSetup

.NET

@staticmethod
def ReadPageSetup(database: DxfDatabase, name: str, isModel: bool) -> CadPlotSettings

Reads a page setup of a drawing opened without a document, as Import Page Setups shows the details of the one chosen: the settings read as CadPlotSettings.ReadPageSetup reads them.

@staticmethod
def ReadPageSetup(document: CadDocument, space: CadSpace, name: str) -> CadPlotSettings

Reads a page setup of the drawing by name, as choosing it in the Page setup list of the Plot dialog applies it to the space plotted: the settings read as CadPlotSettings.Read reads a layout's.

RenamePageSetup

.NET

@staticmethod
def RenamePageSetup(document: CadDocument, name: str, newName: str) -> CadEditResult

Gives a page setup of the drawing another name, as Rename on the Page Setup Manager's list does, one undo step named PAGESETUP. A layout set to the page setup is set to it under its new name. A change of letters alone (Small to SMALL) is a rename; another page setup's name, in either case, is not allowed.

SaveAsPageSetup

.NET

def SaveAsPageSetup(self, document: CadDocument, name: str) -> CadEditResult

Writes the settings as a named page setup of the drawing, one undo step named PAGESETUP, as the Plot dialog's Add… and the Page Setup Manager's New… and Modify… do: the PLOTSETTINGS of the name added to ACAD_PLOTSETTINGS (the dictionary made where the drawing has none), or replaced where the name, letters of either case the same, is taken. What is written is as CadPlotSettings.ApplyTo writes it into a layout.

SetCurrentPageSetup

.NET

@staticmethod
def SetCurrentPageSetup(document: CadDocument, space: CadSpace, name: str) -> CadEditResult

Sets a space to a page setup of the drawing, as Set Current of the Page Setup Manager does, one undo step named PAGESETUP: every setting of the page setup copied into the space's LAYOUT, its name with them, as AutoCAD's CopyFrom copies them.

UseDevice

.NET

def UseDevice(self, name: str) -> None

Chooses the plotter, as the Name list of the Plot dialog does. A raster device moving from the PDF one starts on 1920 by 1080 pixels, fitted, centred, with no offset and no plot style table, colours as displayed on white, colour 7 black; the PDF one moving from a raster device goes back to ISO A3 and the monochrome table. Moving between PNG and JPG keeps everything.

UsePrinter

.NET

def UsePrinter(self, name: str) -> None

Chooses a printer of Windows as the plotter, as the Name list of the Plot dialog does. Moving to it from a raster device gives back ISO A3 and the monochrome table, as moving to the PDF plotter does; the sheet is then one the printer lists, which the caller sets.

ViewNames

.NET

@staticmethod
def ViewNames(document: CadDocument, space: CadSpace) -> System.Collections.Generic.IReadOnlyList[str]

Gets the named views a space can plot, as the View list of the Plot dialog offers them: the views of model space for model space, those of paper space for a layout, in ordinal order of their names, letters of either case the same; empty where there are none, which is when the dialog greys View.