Plotting to PDF
How a space of the presenter is plotted, as AutoCAD 2021 plots it: the page setup a layout keeps, the named page setups
of a drawing, the sheet the plot is laid on, the plot style tables, the PDF the presenter writes, printing on a printer of
Windows, and the commands PLOT (Ctrl+P), -PLOT, PREVIEW and PAGESETUP. The page setup and the sheet are worked out by
CadPlotSettings and
CadPlotPage with no window; the PDF is written by the controls'
CadPdfWriter, through SkiaSharp. Every example below was run on a plan of model space: a frame from (120, 60) to
(7 620, 5 360), 7 500 by 5 300, with ROOM 1 inside it in Arial.
The page setup
A drawing keeps how each space is plotted in the plot settings of its LAYOUT, model space's in the layout Model: the part
AcDbPlotSettings that AutoCAD writes. CadPlotSettings.Read takes them
from there, and ApplyTo writes them back as one undo step named PLOT,
as Apply to Layout does:
CadPlotSettings settings = CadPlotSettings.Read(document, document.ModelSpace);
settings.Area = CadPlotArea.Window;
settings.Window = new DisplayBox(120, 60, 7620, 5360);
settings.FitToPaper = false;
settings.PaperUnits = 1;
settings.DrawingUnits = 20; // 1:20
settings.StyleTable = CadPlotStyleTable.Monochrome;
CadEditResult result = settings.ApplyTo(document, document.ModelSpace);
// the layout Model: 74 of 4 (a window), 48 49 140 141 the window, 142 143 of 1 and 20, 75 of 23 (1:20), 7 monochrome.ctb
| Setting | Groups of AcDbPlotSettings |
|---|---|
the plotter, OpenCAD2D PDF |
2 |
the sheet, ISO_A3_(420.00_x_297.00_MM), its size and margins in millimetres |
4, 44, 45, 40 to 43, 72 of 1 |
| the turn: landscape or portrait as AutoCAD reckons it from the sheet as named, plus 180 upside down | 73 |
| the offset from the printable area's corner | 46, 47 |
| what is plotted: Display, Extents, Limits, View, Window or Layout; for a view its name | 74 (3 for a view), 6; the window 48, 49, 140, 141 |
| the scale: paper millimetres to drawing units; 75 with 147 and flag 16 where it is one of AutoCAD's standard scales, 75 of 0 for Fit | 142, 143, 75, 147 |
the plot style table by the name of its file (CadPlotSettings.StyleSheet), as monochrome.ctb; empty for none |
7 |
| centred (4), plot with plot styles (32), scale lineweights (64), plot lineweights (128) | 70 |
Read back after the drawing is saved and opened again, every one of them is as it was written. A DXF of AC1027 and one of AC1032 saved after a page setup applied to Model and to a layout pass AutoCAD 2021's AUDIT with 0 errors. Plot transparency is not written: a DXF keeps it in no group of the plot settings, and the display lists hold no transparency, so a plot is the same with it on or off.
A sheet the layout names is the standard one of its name and margins, else one made of the layout's size and margins,
so a layout of LAYOUT New, A3 with margins of 7.5 at the sides and 20 above and below, plots on the sheet its tab shows.
The page setups of the drawing's ACAD_PLOTSETTINGS are listed by
PageSetupNames and read by
ReadPageSetup; keeping them is under
Named page setups.
The sheet
CadPaper.Standard lists the sheets of OpenCAD2D PDF: ISO A0 to A4 and
ANSI A to E, each on its side, with margins of 5 all round. CadPlotPage.Compute
lays a plot on its sheet:
CadPlotPage page = CadPlotPage.Compute(document, document.ModelSpace, settings, view.VisibleBox);
// page.SheetWidth 420, SheetHeight 297; Printable (5, 5) to (415, 292)
// page.Scale 0.05; OffsetX 17.5, OffsetY 11: the plot 375 by 265, centred
// page.DrawingToSheet: (120, 60) at (22.5, 16), (7 620, 5 360) at (397.5, 281)
// page.SheetWidthPoints 1 190.55, SheetHeightPoints 841.89
| Case | What it gives |
|---|---|
| Fit to paper | the larger scale that keeps the area in the printable area: 1 mm to 18.4669 units for the window above, 406.13 by 287, moved (1.93, 0) |
| Portrait | the sheet upright, 297 by 420, its margins turning with it |
| Upside down | the sheet turned half round about its middle after the plot is laid: (120, 60) at (397.5, 281) |
| Not centred | the area's lower left corner at the printable corner plus the offset: (3, 4) puts (120, 60) at (8, 9) |
| Layout | a layout's sheet, its origin at the printable corner plus the offset, at 1:1 unless fitted: the paper (-7.5, -20) to (412.5, 277) of an A3 layout lies on the whole sheet |
| Limits | LIMMIN to LIMMAX in model space, a layout's own limits in a layout |
| Display | what the view shows, the extents where no view is given |
| View | the window of a named view of the space's kind (CadPlotSettings.ViewName): a view 2 000 wide and 1 000 high about (3 000, 2 000) plots (2 000, 1 500) to (4 000, 2 500), at 0.205 on A3 fitted; a view the drawing lacks plots the extents; a twist is not applied |
CadPlotScale.ListFor gives the Scale list: 1:1, 1:2, 1:5, 1:10, 1:20,
1:50, 1:100, 1:200, 1:500 and 1:1000, then the scales of the drawing's own list that are none of those.
Plot style tables
A plot style table is a .ctb file (colour-dependent: 255 styles, one for each colour of AutoCAD's index) or a .stb
file (named: Normal and the styles a drawing's objects and layers are given by name), as AutoCAD keeps them.
CadPlotStyleSheet reads and writes both:
CadPlotStyleSheet sheet = CadPlotStyleSheet.Load(@"D:\Plot Styles\site.ctb");
CadPlotStyle red = sheet.StyleForColorIndex(1); // colour 1, red
red.Rgb = 0x0000FF; // plots blue
red.Screening = 50; // half way to white: #8080FF
red.LineWeightIndex = sheet.LineWeightIndexOf(0.35);
red.Linetype = 1; // Dashed
red.LineEnd = CadPlotLineEnd.Round;
sheet.Save(@"D:\Plot Styles\site.ctb");
The file is the text of nested blocks (plot_style{ 0{ name="Color_1 … } }, the list custom_lineweight_table{ … }) packed as
AutoCAD packs its PIA files: the head PIAFILEVERSION_2.0,CTBVER1,compress (STBVER1 for a named table), a line break and
pmzlibcodec, three whole numbers of four bytes (the Adler-32 of the packed stream, the length of the text, the length of
the stream) and the text as a zlib stream. A table read and written again is the same text, byte for byte
(ToText()), and the same file where the same runtime deflates it (ToBytes()); AutoCAD's own files inflate to the text
the reader takes, a note after a number and a screening of 255 included. Each style keeps the properties of the editor:
colour, dithering, grayscale, the pen numbers, screening, linetype, adaptive adjustment, lineweight, line end, line join,
fill and its description.
What a plot does with a style. The colour (the object's own, or the style's), grayscale, screening, lineweight, linetype and the end and join of the line are applied in a PDF, an image and a printout alike:
| Property | Effect |
|---|---|
| Color | the style's colour, else the object's; the object's white (colour 7, or within 2 per cent of white) plots black, a colour the style sets plots as set |
| Convert to grayscale | the grey of the colour's brightness, 0.299 red + 0.587 green + 0.114 blue |
| Screening | 0 to 100 per cent: each channel part way to white, red #FF0000 at 50 is #FF8080 |
| Lineweight | the table's lineweight list (27 entries from 0.05 to 2.11 mm; entry 0 is the object's own) |
| Linetype | one of AutoCAD's 31 names (Solid, Dashed, … ISO Dash Triple Dot) as dashes of our own, a unit of which is a quarter of the style's pattern size (3.175 mm at 0.5 inch); the pattern is not adapted to the line's length |
| Line end, line join | butt, square, round, diamond (drawn round) and the object's own; miter, bevel, round, diamond (drawn mitred) |
| Dithering, pens, adaptive adjustment, fill style | kept and shown in the editor, not used: a PDF or an image has no pens to dither or number, and a filled area is plotted solid |
A colour-dependent table gives an object the style of its colour: a true colour takes the style of the colour of AutoCAD's
index nearest it (white is 7), and plots in its own colour where the style's colour is the object's. A named table gives it
the style its entity names (group 380 of 3 and 390, the entry of the drawing's ACAD_PLOTSTYLENAME), else its layer's (group
390 of the layer), else Normal; ByBlock is taken as Normal, and a block reference given a style gives it to everything it
draws. CadPlotStyleResolver does it for the items of a plot and
is open to a caller that plots by itself:
CadPlotStyleResolver resolver = CadPlotStyleResolver.Create(document, settings); // settings.StyleSheet, "site.ctb"
CadPlotPen pen = resolver.PenFor(item); // Rgb, LineWeight, Dashes, LineEnd, LineJoin
string name = resolver.StyleNameOf("Walls", handle); // Heavy, in a drawing of named plot styles
The folder. The tables are files of a folder, set in Global settings › Save and export › Plot style tables folder; where
that is empty, the folder PlotStyles beside the settings file (%AppData%\OpenCAD2D\PlotStyles). The
presenter makes it as it starts and writes the tables it makes itself there where they are missing, never replacing one
the user edited: acad.ctb (changes nothing), monochrome.ctb (every colour black), grayscale.ctb, Screening 25%.ctb,
50 and 75, and acad.stb, monochrome.stb, grayscale.stb. None is a file of AutoCAD's.
CadDocument.PlotStyleFolder is the folder a document plots from; left empty
no disk is read and the built-in tables stand in, as does a built-in table missing from the folder.
A table a drawing names that is not found, and is none of those, plots as None.
The plot style table settings. CadPlotSettings.StyleSheet is the
table's file name (group 7 of the plot settings), kept as the drawing spells it; StyleTable is the way in for the three
tables first made in code (monochrome.ctb, grayscale.ctb, none).
In the dialogs. The Plot style table list of the Plot and Page Setup dialogs shows None and the files of the folder of
the kind the drawing plots by (.ctb where $PSTYLEMODE is 1, .stb where it is 0), with Edit… (the Plot Style Table
Editor on the table chosen) and New… (Add Plot Style Table: a name and what to start from, nothing changed or a copy
of a table of the folder; the table is made, chosen and opened in the editor). -PLOT's Enter plot style table name takes a
name of the folder with or without its extension, and ? lists them.
The Plot Style Table Editor has three tabs. General: the file, its kind, the number of styles, its location, the description, Apply global scale factor to non-ISO linetypes and the scale factor. Table View: a row for each style and a column for each property. Form View: the list of styles on the left and the properties of the one chosen on the right, with Add Style and Delete Style for a named table (Normal can be neither deleted nor renamed). Save & Close writes the file, Save As… writes another; a value typed that a property cannot take is dropped and the box shows what it had.
STYLESMANAGER shows the Plot Styles folder: every .ctb and .stb file with its kind, description and the time it
was written, Edit… (or a double-click), New…, Delete and Open Folder. With no window it names the tables on the command line.
Not done: Edit Lineweights, the Add-A-Plot-Style-Table wizard's other sources (PCP and PC2 files), CONVERTCTB and
CONVERTPSTYLES, and the fill style of a filled area.
The colours of the three first tables. CadPlotStyles.Map gives the
colour an object plots in with each of the three tables first made in code, which a table not found falls back to, and
which monochrome.ctb, grayscale.ctb and acad.ctb of the folder give in the same colours:
| Table | Red | Green | Blue | White (colour 7) |
|---|---|---|---|---|
| Monochrome | black | black | black | black |
| Grayscale, 0.299 red + 0.587 green + 0.114 blue | #4C4C4C | #969696 | #1D1D1D | black |
| None | red | green | blue | black |
With Plot with plot styles off, the colours plot as with None.
The PDF
CadPdfWriter.Write(path, document, space, settings, display) writes one page through SkiaSharp's SKDocument.CreatePdf,
in vectors, from the display list the canvas draws, as a plotter draws rather than as the screen does: every item whatever
its size, every text however small, every line of a hatch, arcs flattened to a twentieth of a point, colours through the
table, and each line at its lineweight on the sheet, 0.5 mm as 1.417 points (scaled with the plot where Scale lineweights
is ticked), the thinnest line the reader draws where Plot object lineweights is off. The plot is clipped to the printable
area and to the area plotted. Solids and hatches are filled.
The page is the sheet's exact size: ISO A3 on its side is 1 190.5512 by 841.8898 points, where SkiaSharp alone writes 1 191
by 842. The text of a TrueType font is written as text with its font embedded and a map from its glyphs to its letters, so
a reader finds and copies ROOM 1; the text of an SHX font is its strokes, as the canvas draws it, and is not found. Only
the glyphs the pages show are embedded, as AutoCAD's PDFs and every PDF writer's do, and the font carries the tag of a
subset in its name (MYREES+ArialMT, six capitals made from the glyphs kept): a plot of 100 lines and one text in Arial
is 10 KB, where SkiaSharp alone embeds Arial whole and it was 543 KB. The glyphs keep their numbers, so the map to letters,
and with it the search and copy of Vietnamese (Đường Nguyễn Huệ), Korean and Chinese text, is as before; a font of a
collection (MS Gothic, SimSun, Microsoft YaHei, which SkiaSharp embeds as the whole .ttc, 10 to 20 MB) is cut from the face
the PDF names and embedded as a font of its own, so a plot with Chinese text in Microsoft YaHei is 16 KB. A font whose OS/2
table forbids subsetting (fsType bit 8), one of CFF outlines (an .otf), or one the cut cannot read stays whole.
PDFs are written one at a time: SkiaSharp's PDF writer shares the typefaces its font manager caches, and two pages written at once lost the map of their text in 3 to 6 of 64.
| Plot of the extents on ISO A3, best of 5 | .NET Framework 4.8 | .NET 8 | File |
|---|---|---|---|
| 100 lines and 1 text | 24.0 ms | 22.3 ms | 10 KB |
| 10 000 lines and 100 texts | 42.1 ms | 41.3 ms | 226 KB |
| 100 000 lines and 1 000 texts | 200.1 ms | 180.7 ms | 1 959 KB |
The timings are those of before the fonts were cut. The cut reads the pages' content once more, and adds about 6 ms to the two large plots (on .NET 8, 54.0 to 59.9 ms and 237.9 to 244.6 ms); the file written is smaller, and a publish of 18 pages of a small plan is 30.0 ms where it was 35.3 ms (the less it writes, the less it costs).
The commands
| Command | What it does |
|---|---|
| PLOT, Ctrl+P | the Plot dialog, expanded, on the space's page setup; OK asks for the file and writes the PDF, or the PNG or JPEG of a raster device; with no window, -PLOT's prompts |
| PAGESETUP | the Page Setup Manager, below; where a host shows none, the same dialog titled Page Setup, whose OK writes the page setup to the layout |
| STYLESMANAGER | the Plot Styles folder: the plot style tables to edit, make and delete, below |
| PREVIEW | the plot preview of the space's page setup over the whole window; its Plot asks for the file and writes the PDF |
| -PLOT | AutoCAD's plot on the command line |
The dialog follows AutoCAD's: the page setup's name, with Add… to keep the dialog's settings under a name; the plotter, OpenCAD2D PDF, PNG or JPG or a printer of Windows (None is listed greyed); the paper size and its small picture, and for a printer the number of copies; what to plot, and for a window the Window< button, which hides the dialog while "Specify first corner:" and "Specify opposite corner:" are answered on the drawing and shows it again with the window set, and for a view the View list of the drawing's named views (View, between Limits or Layout and Window, is greyed with the tip "The drawing has no named view: save one with VIEW first." where there is none; choosing it takes the first view, and a page setup whose view the drawing lacks takes the first view, or the display where there is none); the offset, or Center the plot; Fit to paper, or the scale and its two units; the plot style table; the plot options; and the orientation. Apply to Layout writes the page setup at once, Save changes to layout writes it when OK plots. Preview… shows the preview, whose Plot plots.
The preview shows the sheet on grey with its printable area dashed. A drag pans, zooms in real time (100 pixels up zoom twice in) or frames a window, as the toolbar or the right button's menu chooses; the wheel zooms about the cursor; Zoom Original shows the whole sheet; ESC or ENTER leaves it.
-PLOT asks AutoCAD 2021's prompts:
Detailed plot configuration? [Yes/No] <No>: Y
Enter a layout name or [?] <Model>:
Enter an output device name or [?] <OpenCAD2D PDF>:
Enter paper size or [?] <ISO A3 (420.00 x 297.00 MM)>:
Enter paper units [Inches/Millimeters] <Millimeters>:
Enter drawing orientation [Portrait/Landscape] <Landscape>:
Plot upside down? [Yes/No] <No>:
Enter plot area [Display/Extents/Limits/View/Window] <Display>: W
Enter lower left corner of window <0.000000,0.000000>: 120,60
Enter upper right corner of window <0.000000,0.000000>: 7620,5360
Enter plot scale (Plotted Millimeters=Drawing Units) or [Fit] <Fit>: 1=20
Enter plot offset (x,y) or [Center] <Center>:
Plot with plot styles? [Yes/No] <Yes>:
Enter plot style table name (enter . for none) or [?] <monochrome.ctb>:
Plot with lineweights? [Yes/No] <Yes>:
Enter shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual styles/Rendered] <As displayed>:
Enter file name <C:\Plans\plan-level2-Model.pdf>:
Save changes to page setup [Yes/No] <No>: Y
Proceed with plot [Yes/No] <Yes>:
Effective plotting area: 375.00 wide by 265.00 high
Without the detailed configuration it asks the layout, a page setup's name, the device and the file. In a layout the
area offers Layout in place of Limits, and the last prompts are Scale lineweights, Plot paper space first and Hide
paperspace objects; the last two, like the shade plot, change nothing in a 2D plot. View is always offered, as AutoCAD's
console offers it, and asks Enter view name:: a name the drawing has not, or none, says <x> not found. or No view specified. You must enter a view name. and asks again; letters of either case find a view. The file is written by the window, which holds the PDF writer.
Printing on a printer of Windows
The printers of Windows are listed in the Printer/plotter list after the three built-in plotters, by name, a printer on the
network (\\print\HP LaserJet M507) marked Windows · network, one on a USB port Windows · USB. Choosing one asks the printer for its sheets: the Paper size
list is then the printer's own, each sheet as the driver names it (A4, A3, Letter) at its size upright, with the
margins of the imageable area the driver gives for it. The sheet the plot was on stays where the printer has one of its size
in either turn: a plot on ISO A3 (420 by 297) moves to the printer's A3 (297 by 420), still on its side, and a printer with
no such sheet starts on the first it lists. A printer that lists no sheet at all offers the sheets of OpenCAD2D PDF.
Where says what the printer prints to: the port of a local printer (USB001), the share of one on the network
(\\office-srv\Office printer), or just Printer where the queue does not say. Plot to file, plain, is offered for a printer,
unticked, as AutoCAD leaves it; ticked, OK writes "Plot to file is not supported for this printer" in the footer and prints
nothing, a plot not being written through a printer's driver to a file. Number of copies takes 1 to 999.
OK on a printer draws the plot as the PDF writer does, through the same page CadPlotPage
lays out, with the same scale, offset, centring, turn, plot style table and lineweights, then hands it to the printer; no
file is asked. "Plot sent to Office printer." is written on the command line, or "The plot was not printed:" and the
printer's reason where it does not take the job. Save changes to layout writes the printer's name as the layout's plotter (group 2),
so that the next PLOT opens on that printer where the computer has it, and chooses OpenCAD2D PDF where it has not.
PREVIEW and the preview's Plot print too when the page setup names an installed printer.
-PLOT takes a printer of Windows by name at "Enter an output device name or [?]", letters of either case the same, and ?
lists the printers after OpenCAD2D PDF, PNG and JPG (a name with spaces, Microsoft Print to PDF, is typed as it is). The
prompt offers the printer the page setup names where the computer has it. A printer's sheets are its own: Enter paper size or [?] lists them by the names the driver gives (A4, A3, Letter), takes one by name, and starts on the sheet of the size
the plot was on (ISO A3 on its side, 420 by 297, becomes the printer's A3 upright, still on its side). No file is asked:
"Write the plot to a file [Yes/No]
Checked on this computer's "Microsoft Print to PDF" up to the print queue, not to the PDF it makes: that printer's port
opens a Save Print Output As dialog, which WPF's print queue gives no way to answer beforehand, so no test of the repository
prints to it unless a person sets the environment variable OPENCAD2D_PRINT_TO_PDF_TEST to 1 (the test then answers the
dialog of its own process by UI Automation and reads the MediaBox back). A paper printer has not been tried.
The page goes to the printer as pixels, not vectors: SkiaSharp's XPS writer stops the process ("Must set a PNG encoder"), so
the plot is drawn at up to 300 dots to the inch in bands of at most 4 million pixels and set into a WPF visual that WPF
prints, with a print ticket of the paper, the turn and the copies that the driver validates. A sheet of A3 is 4 961 by 3 508
pixels; a sheet that would take more than 40 million (A0 would take 139 million) is drawn at the resolution that keeps it
under, 160 dots to the inch for A0. A printer is reached through
IPlotPrinter, so that a host or a test gives a queue of its own:
WindowsPlotPrinter.Installed() lists the real ones, and MainViewModel.WindowsPrinters is where the window gives them.
Named page setups
A drawing keeps named page setups as PLOTSETTINGS in its dictionary ACAD_PLOTSETTINGS, in a DXF and in a DWG, as AutoCAD does.
A name is any of up to 255 letters but < > / \ " : ; ? * | , = and a back quote
(CheckPageSetupName). Each of these is one undo step named PAGESETUP:
| Member | What it does |
|---|---|
settings.SaveAsPageSetup(document, "A2 plan") |
writes the settings as the page setup of the name, added or, where the name has one (letters of either case the same), replaced; the layout is not touched |
CadPlotSettings.SetCurrentPageSetup(document, space, "A2 plan") |
copies the page setup into the space's layout with its name, as AutoCAD's CopyFrom does |
CadPlotSettings.CurrentPageSetupName(document, space) |
the name the layout keeps, as the drawing spells it; empty for none |
CadPlotSettings.RenamePageSetup(document, "A2 plan", "Roof plan") |
gives the page setup another name (a change of letters alone is one); a layout set to it follows it. Refused for a name AutoCAD refuses or another page setup's |
CadPlotSettings.DeletePageSetup(document, "Roof plan") |
takes the page setup out; a layout set to it keeps its settings and is set to none |
CadPlotSettings.ImportPageSetups(document, source, names) |
copies page setups of another drawing, adding (2), (3) where the name is taken |
CadPlotSettings.ReadPageSetup(source, "A2 plan", isModel) and PageSetupIsModel(source, "A2 plan") |
read a page setup of a drawing opened with no document, and say whether it was made for model space (flag 1024), which Import Page Setups lists as Model or Layout |
CadPlotSettings settings = CadPlotSettings.Read(document, document.ModelSpace);
settings.Paper = CadPaper.Standard[2]; // ISO A2
settings.SaveAsPageSetup(document, "A2 plan"); // PLOTSETTINGS "A2 plan", ISO_A2_(594.00_x_420.00_MM)
CadPlotSettings.SetCurrentPageSetup(document, document.ModelSpace, "a2 plan");
// CurrentPageSetupName: "A2 plan"; the layout Model is on ISO A2, and one undo takes it back
PAGESETUP opens the Page Setup Manager, drawn as the Design artifact's board PageSetup draws it. At the top is "Current layout:
Model" with a layout icon; the Page setups group holds "Current page setup: A2 plan" and the list, whose first row is the
layout's own setup, *Model* (*Layout1 (A2 plan)* in a layout whose page setup is A2 plan), chosen when the manager opens,
and under it the drawing's page setups by name. "Selected page setup details" is a group of its own: Device name, Plotter
(OpenCAD2D PDF · vector, built in), Plot size with its orientation (594.00 x 420.00 mm (Landscape), 1920 x 1080 pixels (Landscape)), Where (File, or the port or share of a printer; — for a printer this computer lacks) and Description. A box
"Display when creating a new layout" at the foot keeps the system variable SHOWPAGESETUPFORNEWLAYOUTS (0, or 1 once ticked); the
presenter makes no layouts of its own, so it only keeps the choice. Close is orange-red and Help opens this page.
Set Current sets the layout to the page setup chosen (it is greyed on the layout's own row and on the current one). New… asks a
name and what to start with, in a list box: <None> and <Default output device> (the defaults of a sheet in the space),
<Previous plot> (the settings of the last plot or print of the session, the defaults before one), the layout's own setup
(*Model*), then the page setups; it then shows the Page Setup dialog on it, and adds the page setup when OK is pressed there;
nothing is added when either is cancelled. Modify… (or a double click) shows the Page Setup dialog on the one chosen and writes
it back on OK; on the layout's own row it edits the layout, written as Apply to Layout writes it (one undo step named PLOT).
Import… asks a drawing, a DWG, DXF or DWT, lists its page setups in Import Page Setups, under "Source drawing name:" and the
drawing's full path, with a tick, the Name and the Location (Model or Layout) of each and the details of the one chosen, and
copies those left ticked. In the Page Setup dialog of the manager Window< and Add… are greyed.
Right-click on a page setup gives Set Current, Rename and Delete. Rename turns its name into a box to type in (Enter or a click away takes it, Escape leaves it) and Delete takes the page setup out; each is one undo step named PAGESETUP. The layout's own row has Set Current alone, being current already, and there is no page setup of the drawing to rename or delete in it. A layout set to a page setup that is renamed follows the new name; one set to a page setup that is deleted keeps its settings and is set to none. New Page Setup, Add Page Setup, Import Page Setups and the Plot dialog put OK before Cancel and have a Help button.
Add… of the Plot dialog asks Add Page Setup and keeps the dialog's settings under the name, which is then the one chosen in the Page setup list; a name the drawing has, or one AutoCAD refuses, is shown in red with its reason, the name box is framed in red and OK is greyed. Import… at the left of its footer asks a drawing as the manager's does and copies its page setups in, after which their names are taken.
A page setup that names a printer of Windows (group 2) is chosen in the Plot dialog when the computer has the printer; AutoCAD's
DWG To PDF.pc3 and a printer this computer lacks are read as OpenCAD2D PDF.
Plotting to an image
PLOT and -PLOT offer two raster devices beside OpenCAD2D PDF: OpenCAD2D PNG, which writes a PNG, lossless, and
OpenCAD2D JPG, which writes a JPEG at a quality of 90. Their Paper size list holds sizes in pixels rather than
sheets: 1280 x 720 (HD), 1600 x 1200 (UXGA), 1920 x 1080 (Full HD), 2560 x 1440 (QHD) and 3840 x 2160 (4K UHD), then the
sizes of your own, then Custom…, which asks a width and a height of 16 to 8 000 pixels each in Custom Image Size and adds
the size to the list as 2480 x 1754 Pixels (Custom). The ten newest sizes of your own are kept in the settings file
from one session to the next.
Choosing a raster device starts on 1920 x 1080, fitted to the image and centred, with no plot style table: the image is
drawn on white, as the paper, every colour as displayed except colour 7, which plots black. The whole image is printable,
the offset and the scale read in pixels (Fit to paper off, the scale is pixels per drawing unit), and each line is as wide
as its lineweight at 96 dots an inch, 0.5 mm being 1.9 pixels. The DPI box is grey, the size being set in pixels. The
plot is always to a file: OK asks for it through Browse for Plot File, offered as plan-level2-Model.png, or with FILEDIA
0 on the command line, Enter file name <C:\Plans\plan-level2-Model.png>:. Model space fitted to 1920 x 1080 is a PNG of
exactly 1920 by 1080 pixels. Going back to OpenCAD2D PDF gives back the sheet chosen before.
-PLOT takes the device by its name, and then the size as listed or as 2480 x 1754; its units are pixels alone:
Enter an output device name or [?] <OpenCAD2D PDF>: OpenCAD2D PNG
Enter paper size or [?] <1920 x 1080 Pixels (Full HD)>: 2480 x 1754
Enter paper units [Pixels] <Pixels>:
...
Enter plot scale (Plotted Pixels=Drawing Units) or [Fit] <Fit>:
...
Enter file name <C:\Plans\plan-level2-Model.png>:
A page setup saved with a raster device keeps the device's name and the size, its units written as pixels (group 72 = 2),
and is read back as that image. CadRasterWriter.WritePlot(path, document, space, settings, display) writes the image
where there is no window.
Images of the drawing area
PNGOUT, JPGOUT and BMPOUT write the drawing area as it is shown, as AutoCAD 2021's do. The window asks for the file in
its Create Raster File dialog; with no window the command asks on the command line, offering the drawing's name beside
it. A name typed without the extension has it added, and so does one with another: plan.jpeg given to JPGOUT is
written as plan.jpeg.jpg, as AutoCAD writes it. A name with no folder goes beside the drawing.
Command: PNGOUT
Enter file name <C:\Plans\plan-level2.png>: C:\Plans\level2
Select objects or <all objects and viewports>:
Enter writes the current view of model space or the layout at the drawing area's size in pixels (a canvas 1 600 by 900
at 150 per cent is an image of 2 400 by 1 350), on its background colour, with the grid where it is shown, and without
the cursor, the grips, the UCS icon or the highlight of a selection. Objects selected are written alone in the same view,
without the grid. A PNG is 8-bit red, green and blue; a JPEG is written at a quality of 90; a bitmap is 24 bits a pixel,
as BMPOUT's. The same view gives the same bytes. Nothing is printed when the file is written, and the drawing is not
changed, so there is no undo step. With no window, CadRasterWriter of the window's library
writes the CadImageJob the command hands over, at the session's view, or
at 1 920 by 1 080 showing the extents where there is none. A view of 1 920 by 1 080 of a drawing of 100 000 entities is
written as a PNG of 1.2 MB in 0.25 s (.NET Framework 4.8; 0.20 s on .NET 10).
Drawing with no window
CadRender (in OpenCAD2D.Rendering.dll, namespace OpenCAD2D) draws a drawing of a file to pixels, a PNG, an SVG or a
PDF with no window, through the renderer the canvas draws with. It uses the app's default settings, never the user's file,
so the same drawing gives the same picture on every machine that has the same fonts.
CadDocument document = CadDocument.Open("plan.dxf");
CadRender.WritePng("plan.png", document, new CadRenderOptions { Width = 1600 });
CadRender.WriteSvg("plan.svg", document, new CadRenderOptions { Layout = "Layout1" });
CadRender.WritePdf("plan.pdf", document, "Layout1");
CadRenderImage pixels = CadRender.Draw(document, null); // Rgb: 3 bytes a pixel, rows from the top
The size of a picture, where Width and Height do not give it: one of the two given, the other follows the aspect of the
part drawn, rounded (800 wide of a part 400 by 300 is 600 high); neither, a layout is its sheet in millimetres times Dpi over
25.4 (A3 is 1 587 by 1 123 pixels at 96 and 4 961 by 3 508 at 300) and model space is 1 600 pixels along the longer side (a
drawing 400 by 300 is 1 600 by 1 200). Box empty fits the extents with the 5 per cent margin of ZOOM Extents, a layout's
sheet among them; a Box is fitted with no margin. A picture over 16 384 pixels a side or 100 000 000 pixels is refused with an
ArgumentException. Lines keep the canvas's widths in pixels whatever the Dpi.
The pixels are the app's canvas: ten drawings built in code (every kind of entity, TrueType and SHX text, dimensions, blocks,
hatches, an image, a layout with two viewports) differ by 0 bytes from OpenCAD2D.exe --screenshot ... --canvas, which writes
the canvas's own bitmap, with the grid and the UCS icon off. CadRender.Prepare gives a drawing what the app gives it on
opening (the canvas's measure of TrueType letters, the fonts and the default lineweight) and lays out again what was laid out
before; every other member calls it.
An SVG is the PNG in vectors at the picture's size, so it keeps the screen's level of detail: an item under half a pixel is one dot, a text under 5 pixels high is a solid bar of its colour, a hatch whose lines are closer than 2 pixels is a tint. A PDF is the plot of EXPORTPDF, the page setup of the layout (a drawing with no page setup plots at what its file says, a bare DXF made in code at 1 unit to the inch), at full detail. One picture is drawn at a time in a process.
Measured on .NET Framework 4.8, a picture of 1 600 by 960 pixels of the ten test drawings: PNG 25 ms, SVG 0.5 to 1.4 ms, PDF 0.6 to 1.5 ms (26 ms for the page with TrueType text, whose font is subset), each the median of five; the first PNG of a process takes 0.36 s while the native library loads.
EXPORT and -EXPORT
EXPORT asks for the file in the window's Export Data dialog, which lists the types AutoCAD 2021's help gives for it: 3D
DWF, 3D DWFx, ACIS, Bitmap, Block, DXX Extract, Encapsulated PS, IGES, Lithography, Metafile, V7 DGN and V8 DGN
(CadExportJob.ExportFileTypes). Bitmap goes on as BMPOUT does, with
Select objects or <all objects and viewports>:. Metafile, Encapsulated PS, Block, DXX Extract and Lithography go on as
the commands that write them, after the file the dialog chose (below); the types
the presenter has no writer for (3D DWF, 3D DWFx, ACIS, IGES, V7 DGN and V8 DGN) are refused and nothing is written:
IGES (*.iges;*.igs) has no writer in the presenter: nothing was exported., with a pointer to the commands that write.
AutoCAD's EXPORT lists no DXF, PNG, JPG or PDF, and neither does this one. Bitmap is offered first; after that, the type last chosen is offered for the rest of the session. With FILEDIA 0, or
with no window, EXPORT asks Enter file name <C:\Plans\plan-level2.bmp>:. A name ending in the extension of a listed type
takes that type, as plan.dgn takes V7 DGN; any other name has the extension of the type last chosen added.
-EXPORT asks AutoCAD 2021's prompts, as its console writes them:
Command: -EXPORT
Enter file format [Dwf/dwfX/Pdf] <dwfX>P
Enter plot area [Display/Extents/Window] <Display>: E
Detailed plot configuration? [Yes/No] <No>:
On a layout the area is asked as Enter plot area [Current layout/All layouts] <Current Layout>:. Window asks
Specify first corner: and Specify opposite corner:. Yes at the detailed configuration asks the paper size, its units,
the orientation, the scale, the plot styles, the style table and the lineweights, in -PLOT's words. The file is then asked
in the window's Save As PDF dialog, or with FILEDIA 0 as Enter file name <C:\Plans\plan-level2-Model.pdf>:. -PLOT's
PDF writer writes it from the page setup of the space, with the area and the answers given. The format answered becomes
the default of the next -EXPORT, as AutoCAD keeps EXPORTEPLOTFORMAT. Dwf and dwfX have no writer; -EXPORT refuses both and
writes nothing. All layouts writes one PDF of a page for each layout, in the order of the tabs, each the size of its own
sheet and plotted by its own page setup, or by the detailed configuration where it was answered Yes; the file offered is
the drawing's name, C:\Plans\plan-level2.pdf. A drawing of Layout1 on ISO A3 and Layout2 on ISO A1 is a PDF of two pages,
1 190.5512 by 841.8898 and 2 383.937 by 1 683.7795 points, by
CadPdfWriter.WritePages from the request -PLOT whose payload is a
CadPlotBook.
WMFOUT, PSOUT, STLOUT and SVGOUT
These write the drawing as vectors, and are also the types of EXPORT that go on as they do. All four draw from the display
list of the space worked in (CadVectorPicture): lines, arcs taken in short chords, fills (a hatch, a solid, a wipeout
in white) and the words of text, each in its own colour, line weight and dashes. Colours are those of a white sheet: white,
and what is within 2 per cent of it, is black. Left out: images, the model that the viewports of a layout show, the grey
ground of a field and the tints of a hatch's loops; the part of a block outside its XCLIP is left out by its vertices. The files
are written by the command itself, with no window, so the same drawing gives the same bytes. The window asks the file in a
Save dialog of one type (Create WMF File, Create PostScript File, Create SVG File); with FILEDIA 0, or with no window,
the command asks Enter file name <C:\Plans\plan-level2.wmf>: (Enter PostScript file name for PSOUT).
WMFOUT asks the file, then Select objects:, and writes the objects selected as a placeable Windows Metafile.
Nothing selected writes nothing. The box of the objects is put into whole numbers, its longer side 20 000 logical units
long and y down, and the header gives 1 440 units to the inch, so a drawing 5 000 by 2 000 is a window of 20 000 by 8 000
that is 13.9 inches wide. A line is a Polyline with a pen of its colour and of its line weight (0.25 millimetres is 14
units); a dashed line has a pen of no width and the style dash or dot, as GDI draws no dash with a wide pen; a fill is a
PolyPolygon of a solid brush, filled by the even-odd rule, with no pen; a text of a TrueType font is a TextOut of a font of
its face, its height and angle, aligned to the left, centre or right of its point (the words of an SHX font come as their
strokes, Polylines).
A text's width factor and slant are not written. WMFIN reads the file back: the two lines of a drawing, one red along y = 20
and one green along y = 80, from x = 10 to 190, are the two shapes of colours 0xFF0000 and 0x00FF00 of a picture 20 000 by
6 667. Nothing is printed, the drawing is not changed, and there is no undo step.
PSOUT asks the file, then the questions of AutoCAD 2021's (read from its resource strings): What to plot -- Display, Extents, Limits, View, or Window <D>: (View asks Enter view name:, Window Specify window for export and its two corners;
a view the drawing does not have, or a window of no size, is Invalid view - output canceled. or Invalid window - output canceled.), Enter screen preview image type [None/EPSI/TIFF] <None>: (for EPSI and TIFF it asks the size of the
preview, [128/256/512] <128>, and says the file holds none), Enter size units [Inches/Millimeters] <Inches>:, Enter plotted Inches to drawing units (as P=D) or [Fit/? (help)] <F>: (a scale as 1=48, 1:48, or Fit; ? gives the help)
and Enter the Size or Width,Height (in Inches) <USER>: (a label of the table AutoCAD lists, A to K, A4 to A0 and USER, or
two numbers; Fit, and ?, print Standard values for output size, the table, as AutoCAD 2021's console does: A is 8.00 by
10.50, B 10.00 by 16.00, A4 7.80 by 11.20, USER 7.50 by 10.50). The answers to the area and the units are the next
defaults. Fit scales the area to the size given, or, with USER, to the USER size of 7.5 by 10.5 inches, the output being
the size the area then has (a drawing 200 by 100 shown in a window of the shape 942 by 534 is 7.50 wide by 4.25 high, as
AutoCAD's console wrote it); a scale with USER makes the output the size of the area; a scale and a size put the area in
the middle of the size, cut by it. Effective plotting area: 18.00 wide by 6.00 high ends it. The file is
Encapsulated PostScript level 2 (%!PS-Adobe-3.0 EPSF-3.0) with its %%BoundingBox the
output box rounded outwards: the lines 180 by 60 at 1=10 in millimetres are 51.024 by 17.008 points, 0 0 52 18. Lines
are moveto, lineto and stroke with their colour, line weight in points and dashes, fills are eofill, and a text is
one of the base fonts (Helvetica, Times or Courier, in the look of its bold and italic) at its height, angle, width
factor and slant, aligned by stringwidth; everything is clipped to the box. A letter beyond ASCII is written as its
octal code of Latin-1, which a base font's own encoding may show as another glyph.
STLOUT asks Select solids or watertight meshes: and, as the presenter has no solids, answers what is selected with
2 were filtered out (1 was filtered out) and asks again, as AutoCAD 2021's console does for a drawing of no solids
(probed); Enter on no objects asks again too, and only Esc ends it. Nothing is written. EXPORT of Lithography does the same.
SVGOUT is the presenter's own: AutoCAD 2021 writes no SVG. It asks the file, then Select objects or <all objects and viewports>:, and writes an SVG 1.1 file in UTF-8 whose viewBox is the box of the objects in drawing units with y turned
down, and whose width and height are in pixels, the longer side 1 333.33 of them (13.9 inches at 96 to the inch). Lines
are polylines of their colour and a stroke as wide as their line weight would be on that page (0.25 millimetres is 0.94
pixel), fills are paths of the even-odd rule, and a text is a text element with its font family, size, weight, style,
anchor, angle, width factor and slant.
EXPORT goes on as these do after its file: Metafile as WMFOUT (Select objects:), Encapsulated PS as PSOUT (from What to plot), Lithography as STLOUT, Block as -WBLOCK (Enter name of existing block or [= (block=output file)/* (whole drawing)] <define new drawing>:, then a base point and the objects), and DXX Extract as ATTEXT's DXF extract (Select objects:, then the blocks selected that have attributes, 3 objects in extract file.). A name whose extension is not the
type's has the type's added.
EXPORTPDF, EXPORTDWF and EXPORTDWFX
EXPORTPDF (EPDF) shows the window's Save As PDF dialog, as AutoCAD 2021's: the file, offered as
plan-level2-Model.pdf in model space, with Browse… for the Save dialog of PDF (*.pdf), and beside it the Output Controls.
- Open in viewer when done opens the PDF in the program Windows gives PDF files once it is written. It is on to start with, as AutoCAD's, and what it was left at is kept for the next EXPORTPDF until the app closes.
- Include plot stamp stamps the PDF; Plot Stamp… shows the Plot Stamp dialog over the stamp. The stamp and whether it is on become the session's when the PDF is exported, as PLOT's Plot stamp on does.
- Export lists Current layout and All layouts in a layout, Display, Extents and Window in model space. All layouts
writes one PDF of a page for each layout in the order of the tabs. Window < closes the dialog;
Specify first corner:andSpecify opposite corner:are then asked and the window is written. - Page setup Current writes each space by its own page setup. Override writes it by the one Page Setup Override… sets:
the paper size (the sheets of the PDF plotter, ISO A0 to A4 and ANSI A to E), the plot style table (None,
monochrome.ctb, grayscale.ctb), portrait or landscape, Fit to paper or a scale of millimetres to drawing units, and Scale
lineweights. A scale not above nought is refused with
Enter a scale above nought.; Override and its settings are kept for the next EXPORTPDF until the app closes. All layouts on ISO A1 portrait is a PDF whose pages are each 594 by 841 mm. - Options… shows Export to PDF Options. Include hyperlinks, on to start with, makes the first hyperlink of each object plotted a link of the page over the box of the object, a file's address as a file URI. An object of model space seen through a layout's viewport has a link in each viewport that shows it, over the box of what the viewport draws of it on the paper (a view twisted 30 degrees gives a line from (1 800, 1 200) to (2 200, 1 800) a box 2.3 wide, not the 32.3 wide box of its turned box) cut to the frame of the viewport (to the box of the outline where the viewport is clipped, and none where the object lies in the box of the outline but outside the outline: in the notch of an L-shaped clip); an object on a layer frozen in the viewport has none. A line from (1 800, 1 200) to (2 200, 1 800) in a viewport 200 by 150 at 1:20 about (2 000, 1 500) is a link over (140, 85) to (160, 115) of the sheet, the box of the same line drawn there; one running past the frame is cut at it. The other rows are greyed, as the writer always or never does them: lines are exact vectors, raster images keep their own resolution, TrueType fonts are embedded, and layers, bookmarks and text turned to geometry are not written.
Save writes the PDF by the writer of -PLOT; Cancel writes nothing. A window that shows no Save As PDF (a host that has not
set MainViewModel.ShowSaveAsPdf) shows the Save dialog alone and writes the current layout, or the display of model
space, by its page setup, as before. The command hangs the dialog's choices on its file request as
CadExportJob.PdfOptions, and asks the window to open the PDF by the request
OPENINVIEWER, the file its payload. With FILEDIA 0, or with no window, EXPORTPDF asks -EXPORT's questions on the command
line, which are the way to choose the area (Enter plot area [Display/Extents/Window] <Display>:, or [Current layout/All layouts] on a layout) and to override the page setup (Detailed plot configuration? [Yes/No] <No>:), then Enter file name <file>:. AutoCAD 2021's console asks nothing of EXPORTPDF, which is a dialog there, so the typed form is -EXPORT's
with its first question answered Pdf.
EXPORTDWF (EDWF) and EXPORTDWFX (EDWFX) are in the registry for the aliases of acad.pgp. The presenter has no DWF
writer, so each says DWF files have no writer in the presenter: nothing was exported. EXPORTPDF writes a PDF. and writes
nothing.
PUBLISH and -PUBLISH
PUBLISH plots several sheets at once, as AutoCAD 2021's Publish does: the Model and the layouts of the drawing open, and of
other drawing files, to one PDF or to the printers their page setups name. The Output tab's Batch Plot and the application
menu's Print, Batch Plot start it. The window's Publish dialog is over a list of sheets, each a row of Sheet Name,
Page Setup and Status. A drawing called plan-level2.dxf with a Model and two layouts opens it on
plan-level2-Model, plan-level2-Layout1 and plan-level2-Layout2, in the order of the tabs. The name is edited in the
row; one with < > / \ " : ? * | in it, or that another sheet has (letters of either case the same), is told and not taken,
and a sheet added twice from files of one name is numbered (plan-level2-Model (2)).
- Add Sheets… asks drawing files (DWG or DXF, several at once), reads each with the presenter's own readers and lists its
Model and layouts. The drawing that is open is used as it stands, with its edits not saved; a file that is not there, or
cannot be read, says so under the list (
Drawing not found,Drawing failed to load: …) and the others are added. Include when adding sheets Model and Layouts decide which spaces are listed. - Remove, Remove All, Move Up and Move Down change the list; sheets are published in its order.
- Page Setup of a row is its own list:
<Default: None>(the page setup its layout is set to,<Default: A4 sheet>where it has been set to one), the page setups of that sheet's drawing by name, and Import…, which asks another drawing and, where it holds several page setups, which one (Import Page Setups for Publishing); the row then readsImported: Big. A sheet plots by that page setup: its plotter, sheet, area, scale and offset. Status isLoadedfor a sheet that can be published, else why not (Drawing not found,Drawing failed to load,Layout not found,Page setup not found). - Publish to is the plotter named in the page setup, or PDF. For PDF, Multi-sheet file writes one file of a page for
each sheet, each page the size of its own sheet; Single-sheet files writes a file for each sheet, named by the sheet
(
plan-level2-Layout1.pdf) in the Output folder, which is the first drawing's folder where it is empty. The multi-sheet File name is the first drawing's name where it is empty (plan-level2.pdf). With the plotter named in the page setup, a sheet whose page setup names a printer this computer has (SavedPlotter, as the Plot dialog reads it) is printed there on the sheet of the printer's list nearest the size asked, Number of copies (1 to 99) times; a sheet whose plotter is not a printer here (AutoCAD'sDWG To PDF.pc3, or none) is written as a PDF of its own. DWF and DWFx have no writer: a list of AutoCAD's that asks them is published as PDF, and says so. - Publish in background is a box that does nothing here: a publish runs at once. Open in viewer when done opens each PDF written. The options a Publish was pressed with are the next dialog's.
- The session's plot stamp (when on) and PDFSHX go on every sheet, as on a plot.
The drawing open with a Model, Layout1 on ISO A3 and Layout2 on ISO A1, and a file added with Layout1 on ISO A4, published to
one PDF (Include Model off) is three pages of 1 190.5512 by 841.8898, 2 383.937 by 1 683.7795 and 841.8898 by 595.2756
points, by CadPdfWriter.WritePages of several drawings, the command line saying Published 3 sheets to C:\Plans\set.pdf.
and Publish complete: 3 sheets published. A sheet that cannot be published, or whose plot area is empty, is told
(ghost-Model: Drawing not found. Not published.) and the others are still written.
Load List… and Save List… read and write a sheet list file, AutoCAD's .dsd (Drawing Set Description), which holds the
sheets and where they go. A list loaded asks whether it replaces the sheets listed or is added after them. The file is
text of the INI kind, written with CRLF lines (ASCII, or UTF-16 with its byte order mark where a name has other letters) and
read as UTF-16 or UTF-8 by its byte order mark, else UTF-8, else Latin-1:
[DWF6Version]
Ver=1
[DWF6MinorVersion]
MinorVer=1
[DWF6Sheet:plan-level2-Layout1]
DWG=C:\Plans\plan-level2.dxf
Layout=Layout1
Setup=A4 sheet
OriginalSheetPath=C:\Plans\plan-level2.dxf
Has Plot Port=0
Has3DDWF=0
[Target]
Type=6
DWF=C:\Plans\plan-level2.pdf
OUT=C:\Plans\
PWD=
[SheetSet Properties]
NoOfCopies=1
ViewFile=FALSE
Setup is empty for the sheet's own page setup, the page setup's name, or name|C:\Other\other.dxf for one imported from
that drawing. Type is AutoCAD's SheetType: 0 single-sheet DWF, 1 multi-sheet DWF, 2 the plotter named in the page setup,
3 single-sheet DWFx, 4 multi-sheet DWFx, 5 single-sheet PDF, 6 multi-sheet PDF (the values read from
AutoCAD 2021's own Autodesk.AutoCAD.PlottingServices.SheetType). DWF is the multi-sheet file, OUT the output folder,
NoOfCopies the copies and ViewFile Open in viewer when done. A relative DWG is taken from the list's folder; a quoted path
is unquoted; a sheet of a drawing that is not there stays in the list with its status. The other sections of a list AutoCAD wrote
([PdfOptions], [AutoCAD Block Data], [MRU Local] …) are kept and written back as they were. A sheet list that is no INI
file (it has no [DWF6Version]) is told Error reading list file.
-PUBLISH asks Enter name of sheet list <C:\Plans\plan-level2.dsd>:, the drawing's name beside the drawing, loads the
file and publishes it at once, with no dialog: Could not locate sheet list file. where it is not there, Error reading list file., and There were no plottable sheets in the current operation. where no sheet of it can be published, the words of
AutoCAD 2021's own string table. With no window, or CMDDIA 0, PUBLISH asks the same question. The classes are
CadPublishList (the sheets, the options, Load, Save, Plan),
CadPublishOptions and
CadDsdFile; the window's CadPublisher carries the plan out.
PLOTSTAMP and -PLOTSTAMP
A plot stamp is a few lines of text in a corner of the sheet, and the same words added to a log file.
CadPlotStamp holds its settings, kept for the window (every drawing open
shares one, as AutoCAD stamps every plot of a session) and off until it is switched on. PLOTSTAMP (DDPLOTSTAMP) and
-PLOTSTAMP ask AutoCAD 2021's question, in its words as its console writes them, and come back to it after each option
until Enter:
Command: -PLOTSTAMP
Enter an option [On/OFF/Fields/User Fields/Log file/LOCation/Text Properties/UNits]: Fields
Stamp drawing name? [Yes/No] <Yes>:
Stamp layout name? [Yes/No] <No>:
Stamp date and time? [Yes/No] <Yes>:
Stamp login name? [Yes/No] <No>:
Stamp plot device name? [Yes/No] <Yes>:
Stamp paper size? [Yes/No] <No>:
Stamp plot scale? [Yes/No] <No>:
User Fields asks Enter user field 1: and field 2, a full stop clearing one. Log file asks Write plot stamp to log file? [Yes/No] <Yes>: and Enter log file path <plot.log>:. LOCation asks Enter location [TL/TR/BL/BR] <BL>:, Enter stamp orientation [Horizontal/Vertical] <Horizontal>:, Stamp upside-down? [Yes/No] <No>:, Specify plot stamp offset <0.1000,0.1000>: and Specify offset relative to [paper Border/printable Area] <printable Area>:. Text Properties asks the
font (Segoe UI), the height (0.2000) and Place plot stamp on single line? [Yes/No] <No>:. UNits asks Enter measurement units [Inches/Millimeters/Pixels] <Inches>:; the offset and the height are in those units, a pixel being 1/96 inch.
While the stamp is on, PLOT, -PLOT, EXPORTPDF and -EXPORT give the PDF they write a copy of it
(CadPlotSettings.PlotStamp), and OpenCAD2D PDF draws it as text, so
that a reader finds it. The fields come in AutoCAD's order: the drawing (with its folder), the layout, the date and time
(2026-06-09 14:05:09), the login name, the plotter, the sheet, the scale (1:20), then the two user fields that are not
empty; each is a line, or all in one line set apart by two spaces with Single line. With AutoCAD's start-up values a plot of
Plan.dxf on A3 is stamped with three lines of letters 0.2 inch (5.08 mm) high, their lower left corner 2.54 mm in from both
edges of the printable area. A vertical stamp reads up the sheet; upside down turns it half round. The corner is that of
the image as plotted, as AutoCAD's help says: a plot upside down turns the stamp half round with it, so that a stamp at the
lower left stands at the upper right of the sheet, reading upside down. OpenCAD2D PNG and JPG draw the stamp too,
at 96 pixels to the inch: 0.2 inch letters are 19.2 pixels high, 0.1 inch in from the corner of a 1920 by 1080 image is
9.6 pixels. The log file is appended with a line a plot (a line a page for a PDF of all layouts), beside the plot where its
path has no folder; a log that cannot be written is logged and the plot is not failed.
In the window PLOTSTAMP shows the Plot Stamp dialog over a copy of the stamp: the seven fields, two user fields each picked
from the list of the user's fields (CadPlotStamp.UserFields) or < none >, Add / Edit… showing User Defined Fields (Add
puts "New field" at the end, Edit and the Field text box change the one picked, Delete takes it out and a Field 1 or 2 that
showed it goes back to < none >), the plot stamp parameter file with Load… and Save As…, a preview of the corner the stamp
goes in, and Advanced Options (Location, Orientation, Upside-down, X and Y
offset from the printable area or the paper border, Font, Height above nought, Single line, Units, Create a log file and its
file). OK gives the session's stamp what was set; Cancel leaves it. The PLOT dialog's Plot stamp on box switches the stamp
for this plot and, on OK, for the session, and its … button opens the Plot Stamp dialog. With no window PLOTSTAMP asks
-PLOTSTAMP's questions. A .pss is AutoCAD's PIA file: the head PIAFILEVERSION_2.0,plotstampcompress and pmzlibcodec, the Adler-32 of a
zlib stream, the lengths of the text and of the stream, and the stream of a text of blocks (pstamp{ fields{ drawing_name=1 …
as AutoCAD 2021's mm.pss holds); CadPlotStamp.SaveParameterFile and LoadParameterFile write and read it, a file of another
kind refused, "other.pss" is not a plot stamp parameter file (.pss).. The codes of location (0 lower left, then lower right,
upper left, upper right), orientation and the user-field list (one str line a field) follow mm.pss for its defaults.
Orientation is the place in AutoCAD 2021's own list of the Advanced Options, Vertical then Horizontal, so 0 vertical and 1
horizontal, as mm.pss and Inches.pss both hold 1 for their horizontal stamp. Location 0 is the lower left of both files;
AutoCAD's strings list the corners Top left, Top right, Bottom left, Bottom right, which cannot be the order of the codes
since 0 is the lower left, and no file of another corner has been read, so codes 1 to 3 are not confirmed. A file AutoCAD
wrote with several user fields has not been read either. With no confirmation from AutoCAD's own output, a stamp of several
fields is one line a field.
PDFSHX
PDFSHX is 0 or 1, kept for the session and set by PDFSHX or its alias EPDFSHX. A text drawn in an SHX font is its
strokes in the PDF, which no reader's search finds. With PDFSHX 1 the writer writes its words again over the strokes,
in the canvas's own font and a letter opaque by 1 part in 255, which a PDF reader's search and copy find and no eye sees on a
sheet (a plot of ROOM 1 in opencad2d differs from one without by no more than one level in a pixel). AutoCAD writes the
text as comments of the PDF; the presenter writes it as the page's text. AutoCAD's initial value is 0, as here; its console
here had 1, a profile that had set it. Only the PDF writer reads PDFSHX, and a drawing keeps it nowhere.
CadPlotSettings.PdfShx carries it.
IMPORT
IMPORT (IMP) asks for the file in the window's Import File dialog (an Open dialog) or, with FILEDIA 0, Enter import file name:, as AutoCAD 2021's console does. A name that is not a file is answered Can't find file.. The presenter brings in a
DWG or a DXF drawing, as a block of the file's name placed as INSERT places one (Specify insertion point or [Basepoint/Scale/X/Y/Z/Rotate]:, then the scale and the rotation). Any other type, the WMF, ACIS, 3DS, IGES and the rest of
AutoCAD's list, has no reader here: .WMF files cannot be imported by the presenter, which reads a DWG or a DXF drawing: nothing was imported. AutoCAD's Import File lists none of DWG and DXF (they are for INSERT and OPEN), so this dialog's one
type, Drawing (*.dwg;*.dxf), is the presenter's own.
Layouts, viewports and a PDF from code
A program makes a sheet without the commands. CadLayouts does the work of LAYOUT New, the page setup and MVIEW with a
scale given, each call one undo step and none of them typed at a command prompt (so a name that starts with (, ! or ' is only a name):
| Call | What it does |
|---|---|
CadLayouts.List(document) |
how each space is set up, model space first: sheet, size in millimetres, turn, unit, what is plotted, scale as 1:50, plot style, viewports |
CadLayouts.Add(document, "Plate A3", "ISO_A3", true) |
adds a layout on a sheet of CadPaper.Standard (ISO_A3, ISO A3 and A3 are one), plotted at 1:1; refuses a name the drawing has, Model and AutoCAD's forbidden characters |
CadLayouts.SetPageSetup(document, "Layout1", "A2", null, "extents", "1:50", "acad.ctb") |
changes only what is given: sheet, landscape or portrait, layout/extents/display/limits, a scale as 1:50, 2:1, 0.02 or fit, the plot style table |
CadLayouts.AddViewport(document, "Layout1", new[] {20, 120, 220, 280}, "1:10", new[] {600.0, 400.0}, new[] {"Notes"}) |
a viewport whose frame is the rectangle on the sheet, showing 10 times its size of model space about the centre, with the layers frozen in it alone; gives its handle |
A frame 200 by 100 at 1:10 shows 2 000 by 1 000 units; a centre left out is the middle of what model space draws. CadPlot.WritePdf(path, document, "Layout1", paper, scale, fit) (in OpenCAD2D.Rendering.dll, beside CadRender) plots a layout as the PDF plotter does with the
layout's page setup, or with a sheet, a scale or fit given for that plot alone, and writes the text of an SHX font also as invisible text so that
the words of a plot can be found; it gives the CadPlotPage as it was laid on the sheet. From outside the app the same calls are
CadRemoteDocument.GetLayoutSetups, AddLayout, SetPageSetup and AddViewport (the request sheets). Python's drawing.layouts is the
guide.
See also
- Editing as AutoCAD does: the command line and the undo steps.
- The sheet of a layout: the LAYOUT the page setup is kept in, and its sheet.