Table of Contents

CadAttachRequest

from OpenCAD2D import CadAttachRequest

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

The Attach External Reference and Attach Image dialogs of XATTACH and IMAGEATTACH, as data the command and the window share: the file, its name and path type, and the insertion point, scale and rotation, each given or asked on the command line after OK. Setting CadAttachRequest.FileName reads what the dialog shows of the file: a picture's pixels and size, a drawing's unit.

Constructors

__init__

.NET

def __init__(self, document: CadDocument, kind: CadAttachKind) -> None

Makes the request of a document, as the dialog opens: the point asked, scale 1, no rotation, a relative path.

Properties and fields

Action

.NET

@property
def Action(self) -> CadDialogAction
@Action.setter
def Action(self, value: CadDialogAction) -> None

Gets or sets what the window's dialog was closed with; Cancel until set.

BaseHeight

.NET

@property
def BaseHeight(self) -> float

Gets the height of the picture at scale 1 in the drawing's units, in the measure of its width.

BaseWidth

.NET

@property
def BaseWidth(self) -> float

Gets the width of the picture at scale 1 in the drawing's units, as AutoCAD 2021 sizes it: its pixels over its resolution where the file gives one and the drawing has a unit (40 pixels of 96 dots an inch are 10.5833 mm), else 1, as AutoCAD sizes a picture of no resolution one unit wide.

Document

.NET

@property
def Document(self) -> CadDocument

Gets the document attached to.

Drawing

.NET

@property
def Drawing(self) -> DxfDatabase | None

Gets the drawing read for an external reference, to preview it; null for an image or a file that cannot be read.

Error

.NET

@property
def Error(self) -> str | None

Gets why the file chosen cannot be attached, in AutoCAD's words; null where it can.

FileName

.NET

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

Gets or sets the full path of the file chosen. Set, the name becomes the file's name without its extension, and the file is read: a picture's pixels and resolution, a drawing's unit; CadAttachRequest.Error says why one cannot be attached.

HasResolution

.NET

@property
def HasResolution(self) -> bool

Gets whether the picture read gives its resolution, which sizes it in the drawing's unit.

IsOverlay

.NET

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

Gets or sets whether the drawing is overlaid rather than attached (Reference Type); not for an image.

IsRelativeFallingBack

.NET

@property
def IsRelativeFallingBack(self) -> bool

Gets whether Relative is asked of a drawing not saved yet, which is written with the full path instead.

Kind

.NET

@property
def Kind(self) -> CadAttachKind

Gets what is attached.

Name

.NET

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

Gets or sets the name: of the external reference's block, or of the image definition; the file's name until set.

PageCount

.NET

@property
def PageCount(self) -> int

Gets how many pages the PDF chosen has; nought before one is chosen.

PathType

.NET

@property
def PathType(self) -> CadPathType
@PathType.setter
def PathType(self, value: CadPathType) -> None

Gets or sets how the path is written; Relative until set, as AutoCAD 2021's dialog opens.

PixelHeight

.NET

@property
def PixelHeight(self) -> int

Gets the pixels up of the picture read; nought before.

PixelWidth

.NET

@property
def PixelWidth(self) -> int

Gets the pixels across of the picture read; nought before.

Point

.NET

@property
def Point(self) -> GeoPoint3
@Point.setter
def Point(self, value: GeoPoint3) -> None

Gets or sets the insertion point where it is not asked.

Rotation

.NET

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

Gets or sets the rotation where it is not asked, in radians.

SavedPath

.NET

@property
def SavedPath(self) -> str

Gets the path written for the file: as CadAttachRequest.PathType says, from the drawing's folder for Relative, the full path while the drawing has no file yet; empty while no file is chosen.

Scale

.NET

@property
def Scale(self) -> GeoVector3
@Scale.setter
def Scale(self, value: GeoVector3) -> None

Gets or sets the scale along X, Y and Z where it is not asked; 1, 1, 1 until set. An image takes X alone.

SelectedPages

.NET

@property
def SelectedPages(self) -> System.Collections.Generic.List[int]

Gets the pages chosen, by number from 1, in the order they are attached: page 1 once a PDF is chosen, as AutoCAD 2021 selects the first page; the dialog changes the list, a typed -PDFATTACH sets the one page it asks for.

SpecifyPointOnScreen

.NET

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

Gets or sets whether the insertion point is asked on the command line; true until set.

SpecifyRotationOnScreen

.NET

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

Gets or sets whether the rotation is asked on the command line.

SpecifyScaleOnScreen

.NET

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

Gets or sets whether the scale is asked on the command line.

UniformScale

.NET

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

Gets or sets whether the external reference is scaled alike along every axis (Uniform Scale); true until set.

UnitFactor

.NET

@property
def UnitFactor(self) -> float

Gets the factor an external reference is scaled by, from its drawing's unit to this drawing's (Factor); 1 for an image.

Units

.NET

@property
def Units(self) -> DxfUnits

Gets the unit: of the drawing read for an external reference (Block Unit), of this drawing for an image.

Methods

PageHeight

.NET

def PageHeight(self, page: int) -> float

Gets the height of a page of the PDF chosen in inches.

PageWidth

.NET

def PageWidth(self, page: int) -> float

Gets the width of a page of the PDF chosen in inches, as AutoCAD 2021 measures it (a point is 1/72 of an inch); nought for a page it has not.