Table of Contents

Class DxfPdfUnderlay

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

A PDFUNDERLAY of a DXF file, as AutoCAD's PdfReference: one page of a PDF file placed in the drawing, its file and page named by its PDFDEFINITION (Definition), shown at a place, a scale and a turn, faded, in grey or clipped as its record says. The library reads no PDF: it places, scales and clips the underlay as its record says.

public sealed class DxfPdfUnderlay : DxfEntity
Inheritance
DxfPdfUnderlay
Inherited Members

Remarks

The record holds the insertion point (groups 10, 20, 30) where the lower left corner of the page stands, the scale along the page's two sides and its depth (41, 42, 43), the turn (50, in degrees as the file writes it, in radians here) about the insertion point in the plane of the extrusion (210, 220, 230), the display flags (280), the contrast (281, 0 to 100, 100 as it is) and the fade (282, 0 to 100, 0 as it is), and the clip boundary (the run of 11 with its 21).

The page is measured in inches, as AutoCAD 2021 measures it: a page of 200 by 100 points, 1/72 of an inch each, is 2.7778 by 1.3889 at scale 1, and 200 by 100 points at scale 72 is the size it is printed on a sheet in inches. The clip boundary is in the same inches from the page's lower left corner, before the scale: the corners (1, 1) and (2, 2) of a page placed at (10, 20) with the scale 2 show the part from (12, 22) to (14, 24). Two corners are a rectangle, which AutoCAD stores as its upper left and lower right (0, 20) and (30, 0); three or more are a polygon, open as AutoCAD keeps it.

A file older than R2010 has no PDF underlays: one is not added to it. Every group the class does not set is kept as it was.

Constructors

DxfPdfUnderlay(DxfPdfDefinition)

Initializes an underlay made in code of a definition of a drawing, as AutoCAD's new PdfReference() given its DefinitionId: its corner at the origin, scale 1 along every side, not turned, shown, its colours adjusted, its contrast 100 and its fade 0, with no clip boundary, as AutoCAD 2021 writes a new one. Appended to a block of the definition's drawing by AppendEntity(DxfEntity), it is counted by GetEntityCount().

Properties

AdjustColorForBackground

Gets or sets whether the colours are adjusted for the background, as AutoCAD's AdjustColorForBackground (flag 8); true as it is made.

Contrast

Gets or sets the contrast (group 281), as AutoCAD's Contrast: 0 to 100, 100 as it is made, where the colours are as the PDF has them.

Definition

Gets the definition the underlay shows (group 340), as AutoCAD's DefinitionId names it: of its drawing, of the drawing it was copied from for a copy in no file; null where the drawing has no PDFDEFINITION of the handle.

Fade

Gets or sets the fade (group 282), as AutoCAD's Fade: 0 to 100, 0 as it is made, where the colours are as the PDF has them; 100 fades them into the background.

HasClipBoundary

Gets whether the underlay has a clip boundary, two corners or a polygon (the run of 11 with its 21), whether or not it is on (IsClipped).

IsClipInverted

Gets or sets whether the underlay shows what lies outside its boundary and hides what lies inside, as AutoCAD's IsClipInverted (flag 16); false as it is made.

IsClipped

Gets or sets whether the underlay is clipped, as AutoCAD's IsClipped (flag 1): true as it is made, which clips nothing while the underlay has no boundary (HasClipBoundary), as AutoCAD 2021 keeps a new one.

IsOn

Gets or sets whether the underlay is shown, as AutoCAD's IsOn (flag 2 of group 280); true as it is made.

Monochrome

Gets or sets whether the underlay is shown in monochrome, as AutoCAD's Monochrome (flag 4); false as it is made.

Name

Gets the name of the underlay, as AutoCAD's Name: the name its PDFDEFINITION has in the dictionary of PDF underlays (ACAD_PDFUNDERLAYS), such as sample - Page_1; null where it shows no definition of the dictionary.

NameOfSheet

Gets the name of the page, as AutoCAD's NameOfSheet: the number of the page as text, 1 for the first; empty where it shows none.

Normal

Gets or sets the normal of the plane the underlay lies in, as AutoCAD's Normal (groups 210, 220, 230): (0, 0, 1) for one laid in the plane xy, as it is made.

Path

Gets the path of the PDF file, as AutoCAD's Path: the path its definition names, as the file writes it; empty where it shows none.

Position

Gets or sets the corner of the page, as AutoCAD's Position: where the lower left corner of the page stands, in world coordinates (groups 10, 20, 30).

Rotation

Gets or sets the turn of the underlay about its corner, as AutoCAD's Rotation, in radians in the plane of the Normal; the file writes degrees (group 50): 0.5 radian is 28.6479.

ScaleFactors

Gets or sets the scale along the page's width, its height and its depth, as AutoCAD's ScaleFactors (groups 41, 42, 43): 1 for every side as it is made. The page 2.7778 by 1.3889 inches given the scale (25.4, 25.4, 25.4) is 70.56 by 35.28.

Transform

Gets the transformation from the page's inches to the world, as AutoCAD's Transform: the page's (x, y), from its lower left corner, scaled, turned in the plane of the normal and moved to the corner. The page 2.7778 inches wide at the scale 2 at (10, 20) takes (1, 0) to (12, 20, 0); turned a quarter turn, to (10, 22, 0).

Methods

ClearClipBoundary()

Takes the clip boundary away, as AutoCAD's PDFCLIP Delete: the whole page is shown, the clip on as a new underlay has it.

GetClipBoundary()

Gets the clip boundary, as AutoCAD's GetClipBoundary: in the page's inches from its lower left corner, before the scale. Two corners for a rectangle, as AutoCAD stores it, the upper left and the lower right; the corners of a polygon otherwise, not repeating the first at the end; none for an underlay with no boundary.

GetClipFrame()

Gets the clip boundary as a closed polygon in world coordinates, as AutoCAD's frame draws it: the rectangle's four corners or the polygon's, laid through Transform; none for an underlay with no boundary.

SetClipBoundary(IReadOnlyList<GeoPoint2>)

Sets the clip boundary, as AutoCAD's SetClipBoundary, and switches the clip on: two corners are a rectangle, written as AutoCAD 2021 writes it, the upper left and the lower right, so that (1, 1) and (2, 2) are (1, 2) and (2, 1); three or more are a polygon, written as given. The page's inches from its lower left corner, before the scale.

SetDefinition(DxfPdfDefinition)

Makes the underlay show another definition of its drawing, as AutoCAD's DefinitionId set: its 340 the definition's handle, the definition's reactors given the underlay.