Table of Contents

Class DxfOle2Frame

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

An OLE2FRAME of a DXF file, as AutoCAD's Ole2Frame: an OLE object shown in a frame, a picture pasted, a sheet of Excel embedded or a document linked. The library reads where it stands and what it is, gives the picture of a static one, and moves, scales and sizes it as AutoCAD 2021 does, upright along x and y.

public sealed class DxfOle2Frame : DxfEntity
Inheritance
DxfOle2Frame
Inherited Members

Remarks

The object is its binary (every group 310 in turn, whatever length its 90 gives): AutoCAD's head of 128 bytes, which holds the four corners of the frame in world coordinates, then the compound file the object is saved in, as Windows' OLE writes it. The groups 10 and 11 are copies of two of the corners, which AutoCAD 2021 does not read: where a file another writer moved gives other corners there, the head's are taken, as AutoCAD takes them, and the difference is said once in the log at Debug. AutoCAD keeps the turn and look of the frame beside the binary, in the extended data of ACAD between OLEBEGIN and OLEEND (Rotation, LockAspect, AutoOutputQuality), and how it is plotted in group 73 (OutputQuality).

A picture of 3 by 2 pixels pasted with its lower left corner at (10, 20, 0) and stretched to 30 by 20 has its head's corners (10, 40, 0), (40, 40, 0), (40, 20, 0) and (10, 20, 0): Location (10, 20, 0), WcsWidth 30, WcsHeight 20, the box of GeometricExtents from (10, 20, 0) to (40, 40, 0).

A binary too short to hold the corners, or one that holds a corner not of finite numbers, gives those of 10 and 11 as the corners of a frame along the world's x and y, as ezdxf and ACadSharp read every frame; a compound file damaged gives the kind of the object (group 71) and its user type (group 3) as the record writes them, and no picture. Where AutoCAD 2021 cannot read the compound file it empties the frame when it opens the drawing, its corners and user type gone.

It is copied, by Clone(), into this drawing or another, with its binary and its extended data as they are, and given the marks of the space it is copied into; read and saved, its record is written byte for byte. TransformBy(GeoTransform3) moves its corners in the head of the binary, which AutoCAD reads, and in groups 10 and 11; AutoCAD 2021 keeps a frame upright, so a move, a scale by one factor and a mirror about a line along x or y are taken, the picture not turned over, and a turn, a shear or a stretch refused, as is an INSERT exploded with such a placing, which leaves the frame out. AutoCAD's OleObject, the object of the running application, and Position2d, the frame in pixels of the window it is shown in, are not given: a file holds neither. The OLEFRAME of AutoCAD R13, an object of OLE 1, has no class of AutoCAD's .NET API, and stays a DxfUnknownEntity.

Constructors

DxfOle2Frame(byte[])

Makes a static picture of a bitmap or a PNG, as AutoCAD 2021 makes one of a bitmap pasted: the .bmp given, or the .bmp of 32 bits a pixel the PNG is read into, its alpha laid over white, as the stream CONTENTS of a compound file of the class StaticDib, as Windows' OLE saves it, behind AutoCAD's head of 128 bytes and with the extended data AutoCAD writes for it. The library's own: AutoCAD's .NET API makes no OLE object. The frame stands along x and y with its lower left corner at the origin, at the picture's natural size in millimetres, its pixels across and up over its pixels a metre (3 780, 96 dots an inch, where the picture gives none): a picture of 610 by 224 pixels of 96 dots an inch is 161.38 by 59.26. Placed and sized by Position3d, WcsWidth or TransformBy(GeoTransform3); added to a drawing by AppendEntity(DxfEntity), which gives it the marks of its space.

Properties

AutoOutputQuality

Gets whether the plot quality is chosen by the kind of object, as AutoCAD 2021's AutoOutputQuality reads it from the extended data (code 70 between OLEBEGIN and OLEEND): 1 chosen so, as AutoCAD writes a picture pasted, 0 the OutputQuality kept; 1 where the record has none.

GeometricExtents

Gets the box of the frame, as AutoCAD 2021's GeometricExtents: that of its four corners, z among them, (10, 20, 0) to (40, 40, 0) for the picture 30 by 20 with its lower left corner at (10, 20, 0).

IsLinked

Gets whether the object is linked to a document outside the drawing, as AutoCAD's IsLinked: whether Type is Link.

LinkName

Gets the source a linked object is linked to, as ObjectARX's getLinkName words it: the display name of the moniker its \1Ole stream holds, its absolute one where it has one, such as C:\Drawings\cost.xlsx!Sheet1!R1C1:R4C3, its file and the item in it; empty for an object not linked, and where the moniker is not of a file, an item or a composite of them. AutoCAD 2021 throws for a static object; the library gives it empty.

LinkPath

Gets the file a linked object is linked to, as ObjectARX's getLinkPath words it: the path of the first file of its moniker, C:\Drawings\cost.xlsx for the link to a range of that workbook; empty for an object not linked, as LinkName says.

Location

Gets the lower left corner of the frame, as AutoCAD 2021's Location gives it from the head of its binary: (10, 20, 0) for the picture pasted with its lower left corner there. The DXF reference has group 10 for it, which is the upper left corner, and ODA's documents too; AutoCAD 2021 gives the lower left. The origin for a frame of no corners, its binary holding none and its record no 10 or 11, as AutoCAD 2021 gives a frame it could not read.

LockAspect

Gets whether a change of the width or height of the frame changes the other with it, as AutoCAD 2021's LockAspect reads it from the extended data (code 71 between OLEBEGIN and OLEEND, 1 for locked); true where the record has none, as AutoCAD gives a frame read with no extended data.

OutputQuality

Gets how the object is plotted, as AutoCAD 2021's OutputQuality reads it from group 73: 0 monochrome, 1 low graphics, 2 high graphics, as AutoCAD writes a picture pasted; 1 where the record has none, as AutoCAD gives a new frame.

Position3d

Gets the four corners of the frame in world coordinates, as AutoCAD 2021's Position3d gives them from the head of its binary, as they are held, of any shape AutoCAD stores: turned, sheared or out of the plane xy. The picture 30 by 20 with its lower left corner at (10, 20, 0) gives the upper left (10, 40, 0), upper right (40, 40, 0), lower left (10, 20, 0) and lower right (40, 20, 0).

Rotation

Gets the angle the frame is said to be turned by, in radians, as AutoCAD 2021's Rotation reads it: the number AutoCAD keeps in the extended data (code 40 between OLEBEGIN and OLEEND), not worked out from the corners, which it keeps along x and y as it turns a frame; the number as it is stored, a NaN another writer stored given as it is (AutoCAD 2021 writes 0 for the NaN it holds in memory after a quarter turn); 0 where the record has no such data or no number there.

ScaleHeight

Gets the height of the frame in percent of its height at 100 percent, which AutoCAD keeps in the extended data (code 42 between OLEBEGIN and OLEEND), as ScaleWidth gives the width's: 100 where the record keeps none; 0 for a frame of no height.

ScaleWidth

Gets the width of the frame in percent of its width at 100 percent, which AutoCAD keeps in the extended data (code 41 between OLEBEGIN and OLEEND) as it pastes the object and does not change as it scales or sizes the frame: the picture pasted 83.58 wide and scaled by a half in AutoCAD 2021 is 41.79 wide with 83.58 kept, 50 percent. 100 where the record keeps no such width; 0 for a frame of no width. AutoCAD's console gives 100 for every frame it reads; its palette shows the scale against the kept width.

Type

Gets the kind of the object, as AutoCAD's Type, MFC's COleClientItem::GetType, finds it in the compound file: Link where it is of the class of a link or its \1Ole stream says it is linked, Static where it is of the class of a static picture (a bitmap, a metafile, an enhanced metafile), Embedded for any other class, as a sheet of Excel or a file packed. Where the compound file is damaged, the kind group 71 gives; 0, no kind, where that is none of the three either, as ObjectARX's getType gives 0 on an error.

UserType

Gets the name of the kind of the object, as AutoCAD's UserType: Picture (Device Independent Bitmap) for a bitmap pasted. AutoCAD 2021 asks Windows' registry for the name of the class of the compound file; the library gives the name of a static picture's class as Windows names it (Picture (Metafile), Picture (Enhanced Metafile)), and for another class the name its \1CompObj stream holds, as OLE Package; where the compound file is damaged or holds no name, group 3 as the record writes it; empty where it has none.

WcsHeight

Gets the height of the frame, as AutoCAD 2021's WcsHeight works it out: the y of the upper left corner less that of the lower left, its run along y; 20 for the picture 30 by 20.

WcsWidth

Gets the width of the frame, as AutoCAD 2021's WcsWidth works it out: the x of the upper right corner less that of the upper left, its run along x and not the length of its top, so that the frame 30 wide turned 30 degrees about z is 25.98 wide; 30 for the picture 30 by 20.

Methods

Explode()

Gets the lines the frame breaks into, as AutoCAD 2021's Explode breaks an OLE2FRAME into four LINEs along its edges: a LINE along each side of the frame of GetGeometry(), from the upper left corner round by the upper right, each with the frame's look, a side of no length left out. The picture 30 by 20 gives four, from (10, 40, 0) to (40, 40, 0) and round. The object itself is not kept. A frame of no corners, its binary holding none and its record no 10 or 11, gives no lines: AutoCAD 2021 gives four of no length, which the library leaves out, as it does for an IMAGE.

GetCompoundDocument()

Gives the compound file the object is saved in, as it is written after the head of the binary: as many bytes as the head counts, or as there are where it counts more; null where the binary is too short to hold its head of 128 bytes. The library's own, as ODA's getCompoundDocument: AutoCAD's .NET API gives none. Written to a file, it is a compound file Windows opens, a .doc of OLE's structured storage.

GetPictureData(out DxfOlePictureFormat)

Gives the picture of a static object as the bytes of its file, the library's own: of a bitmap pasted, the .bmp its CONTENTS stream holds, as Windows wrote it; of a metafile, a placeable .wmf; of an enhanced metafile, the .emf. The picture of 3 by 2 pixels of 24 bits gives a .bmp of 78 bytes, of 96 dots an inch where it was so made. None for an object embedded or linked, which AutoCAD shows through its application, and for a compound file damaged, which is said in the log at Debug.