Underlay

UNDERLAY entity (DXF Reference) links an underlay file to the DXF file, the file itself is not embedded into the DXF file, it is always a separated file. The (PDF)UNDERLAY entity is like a block reference, you can use it multiple times to add the underlay on different locations with different scales and rotations. But therefore you need a also a (PDF)DEFINITION entity, see UnderlayDefinition.

The DXF standard supports three different file formats: PDF, DWF (DWFx) and DGN. An Underlay can be clipped by a rectangle or a polygon path. The clipping coordinates are 2D OCS coordinates in drawing units but without scaling.

Subclass of ezdxf.entities.DXFGraphic
DXF type internal base class
Factory function ezdxf.layouts.BaseLayout.add_underlay()
Inherited DXF attributes Common graphical DXF attributes
Required DXF version DXF R2000 ('AC1015')
class ezdxf.entities.Underlay

Base class of PdfUnderlay, DwfUnderlay and DgnUnderlay

dxf.insert

Insertion point, lower left corner of the image in OCS.

dxf.scale_x

Scaling factor in x-direction (float)

dxf.scale_y

Scaling factor in y-direction (float)

dxf.scale_z

Scaling factor in z-direction (float)

dxf.rotation

ccw rotation in degrees around the extrusion vector (float)

dxf.extrusion

extrusion vector, default = (0, 0, 1)

dxf.underlay_def_handle

Handle to the underlay definition entity, see UnderlayDefinition

dxf.flags
dxf.flags Value Description
UNDERLAY_CLIPPING 1 clipping is on/off
UNDERLAY_ON 2 underlay is on/off
UNDERLAY_MONOCHROME 4 Monochrome
UNDERLAY_ADJUST_FOR_BACKGROUND 8 Adjust for background
dxf.contrast

Contrast value (20 - 100; default = 100)

dxf.fade

Fade value (0 - 80; default = 0)

clipping

True or False (read/write)

on

True or False (read/write)

monochrome

True or False (read/write)

adjust_for_background

True or False (read/write)

scale

Scaling (x, y, z) tuple (read/write)

boundary_path

Boundary path as list of vertices (read/write).

Two vertices describe a rectangle (lower left and upper right corner), more than two vertices is a polygon as clipping path.

get_underlay_def()

Returns the associated DEFINITION entity. see UnderlayDefinition.

set_underlay_def()

Set the associated DEFINITION entity. see UnderlayDefinition.

reset_boundary_path() → None

Removes the clipping path.

PdfUnderlay

Subclass of ezdxf.entities.Underlay
DXF type 'PDFUNDERLAY'
Factory function ezdxf.layouts.BaseLayout.add_underlay()
Inherited DXF attributes Common graphical DXF attributes
Required DXF version DXF R2000 ('AC1015')
class ezdxf.entities.PdfUnderlay

PDF underlay.

DwfUnderlay

Subclass of ezdxf.entities.Underlay
DXF type 'DWFUNDERLAY'
Factory function ezdxf.layouts.BaseLayout.add_underlay()
Inherited DXF attributes Common graphical DXF attributes
Required DXF version DXF R2000 ('AC1015')
class ezdxf.entities.DwfUnderlay

DWF underlay.

DgnUnderlay

Subclass of ezdxf.entities.Underlay
DXF type 'DGNUNDERLAY'
Factory function ezdxf.layouts.BaseLayout.add_underlay()
Inherited DXF attributes Common graphical DXF attributes
Required DXF version DXF R2000 ('AC1015')
class ezdxf.entities.DgnUnderlay

DGN underlay.