Table of Contents

Method WblockCloneObjects

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

WblockCloneObjects(IEnumerable<DxfEntity>, DxfBlockTableRecord)

Copies entities of this drawing into a block of another drawing, or of this one, together, as AutoCAD's WblockCloneObjects copies the objects of ids: each as Clone() copies it, added to the block as AppendEntity(DxfEntity) adds one, with what it brings (its layer, linetype, text and dimension styles, the blocks it is drawn by); and what one of them points to among the others pointing to the copy of that other, as AutoCAD's map of ids keeps it across the objects copied together.

public IReadOnlyList<DxfEntity> WblockCloneObjects(IEnumerable<DxfEntity> source, DxfBlockTableRecord owner)

Parameters

source IEnumerable<DxfEntity>

The entities, of this drawing and not erased, each once.

owner DxfBlockTableRecord

The block of model space, paper space or a block of a drawing the copies are added to.

Returns

IReadOnlyList<DxfEntity>

The copies, in the order of the entities given.

Remarks

A HATCH copied with every object its loops follow follows their copies, and is associative, as the HATCH is; with some of them left behind it follows none, as a HATCH copied alone. A MULTILEADER of a block copied with an INSERT places the copy of its block and draws its arrows by the copies of theirs, where those blocks come along, as a block W holding a multileader of the block GKTAG and an INSERT of GKTAG brings GKTAG; so too an ACAD_TABLE points to the copies of its picture and of the blocks of its cells, and a LEADER or a dimension whose dimension style is overridden with an arrow block (DIMLDRBLK, DIMBLK, DIMBLK1, DIMBLK2) names the copy of that block, whichever of the two is copied first: a block W holding the leader with DIMLDRBLK GKTAG brings GKTAG after W, and the copy of the leader names it. A LEADER copied with the MTEXT, TOLERANCE or INSERT it points to points to its copy; copied alone into another drawing, it brings that annotation with it, which it points at by a hard pointer (340), as AutoCAD 2021's WblockCloneObjects brought the MTEXT of a leader copied alone, the copy of the annotation not among those given back; copied alone within this drawing, it points to none (AnnoType NoAnnotation). A handle of extended data (1005) naming an entity copied with it names that entity's copy; one naming anything else is null (0) in a copy into another drawing, in its place, as AutoCAD keeps it. The field of a text's words (GetField()), and of each attribute of an INSERT copied, is copied with it and listed in the drawing's list of fields. No GROUP is copied, as AutoCAD 2021's WblockCloneObjects copies none: Insert(GeoTransform3, DxfDatabase, bool) copies them.

Every copy is checked to be one the block's drawing can hold before any is added, so that a copy refused changes nothing: a SPLINE into a drawing of R12 refuses the whole set, and so does a block the copies bring that would insert itself once written, by its own INSERTs or theirs, through the blocks of the drawing copied into: that drawing's P holding an INSERT of M, a block it has not (as a drawing read from a file may), and this drawing's M an INSERT of P, an INSERT of M copied would bring an M that places P, which places that M, without end. A set whose INSERTs would bring blocks that come back to the block they are added to is refused too. A block AutoCAD names itself that one entity of the set brings takes no name an INSERT in a block another brings gives of a block neither drawing has, as a block one entity brings takes none of its own: this drawing having *U1 and *U2, and the other's Q an INSERT of *U3, which it has not, an INSERT of its *U1 copied with one of Q brings *U1 as *U4, and Q's INSERT of *U3 places nothing, as where it came from. INSERTs of blocks their drawing has not, in the blocks the set brings, are copied as they are and said in one Debug line for the set. An MTEXT added to a drawing of R12 is written as TEXTs, as AppendEntity(DxfEntity) writes it, and its place in the list given back is the MTEXT itself, in no file. A block AutoCAD names itself that several of the entities draw by is copied once for the call, as AutoCAD's map of ids keeps one: two INSERTs of one *U1 copied together place one copy, and copied by two calls a copy each.

A dynamic INSERT copied into another drawing of R2010 (AC1024) or later stays dynamic, as Insert(GeoTransform3, DxfDatabase, bool) keeps it: the dynamic block it places comes with it, or the one its anonymous block stands for where it places a *U, as AutoCAD's deep clone brings it by the pointer of the INSERT's representation, and then what makes them dynamic, as that Insert copies it. An INSERT of GH_PANEL set to a Width of 200, copied alone into a new drawing, brings *U1 and GH_PANEL, reads Width 200 and is set again as the one it was copied from. A block of the name the drawing has is its own: the copies stand for it where it is dynamic, and are static otherwise; a drawing older than R2010 takes a static copy of the INSERT's block alone, as before.

A viewport clipped by an entity (NonRectClipEntity) copied together with that entity names its copy (group 340), which lists the copy as its only reactor; copied alone into another drawing it brings the entity, appended after it and not among those given back, and copied alone within this drawing it keeps naming its original's entity, which does not list it, as AutoCAD 2021's WblockCloneObjects and DeepCloneObjects leave them.

A rectangle of four LINEs with a HATCH that follows them, copied together into another drawing, comes out as four LINEs and a HATCH that follows those four, each LINE listing the HATCH among its reactors.

Exceptions

ArgumentNullException

Thrown when the entities or the block are null.

ArgumentException

Thrown when an entity is null, given twice, erased, of another drawing, or a record that follows another (a VERTEX or an ATTRIB); or when the block's drawing cannot hold a copy, as AppendEntity(DxfEntity) says; or when a block the copies bring would insert itself, or make the block insert itself, at any depth, which AutoCAD's AUDIT takes out. Nothing is added then.

InvalidOperationException

Thrown when the block is in no drawing.