Method Insert
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
Insert(GeoTransform3, DxfDatabase, bool)
Inserts another drawing into this one's model space, as AutoCAD's Insert(transform, dataBase,
preserveSourceDatabase): every entity of its model space copied into this model space and moved by the
transformation, as WblockCloneObjects(IEnumerable<DxfEntity>, DxfBlockTableRecord) copies entities together, and its groups with them, each group
all of whose entities come under its name, or that name and _1 where this drawing has it; and the records
of its tables and its named blocks that this drawing has none of the name of, merged by name, this drawing's own kept
where it has one: its text styles, linetypes, layers, blocks and dimension styles. Its paper space is not inserted.
public void Insert(GeoTransform3 transform, DxfDatabase dataBase, bool preserveSourceDatabase)
Parameters
transformGeoTransform3The transformation the entities are moved by.
dataBaseDxfDatabaseThe drawing to insert, another than this one.
preserveSourceDatabaseboolWhether the other drawing is to be kept as it was, as AutoCAD may take objects out of it otherwise: here it is always kept, so either gives the same.
Remarks
A drawing of a line from (0, 0, 0) to (10, 0, 0) on the layer steel, inserted by
GeoTransform3.Translation(new GeoVector3(100, 0, 0)) into one that has no layer steel, gives this drawing the
line from (100, 0, 0) to (110, 0, 0) and the layer steel as the other drawing has it. A block AutoCAD names itself, a
dimension's *D, comes under a name of its own, as AppendEntity(DxfEntity) says, once
however many entities draw by it: two INSERTs of one *U come as two INSERTs of one copy, as AutoCAD's own
insert keeps one for both; the
external references of the other drawing and what they brought (a name with a | in it) are not merged, but one an
INSERT of its model space places comes with the INSERT, an external reference still: its BLOCK flagged 4, or 12
overlaid, naming its drawing in its 1, with no entities. An INSERT of the other drawing that names a block it has not,
as a drawing read from a file may hold, is copied as it is, naming that block, wherever it stands, in its model space
or in a block merged or brought, as AutoCAD 2021's Insert copies one, placing nothing; where this drawing has
a block of the name, the copy places it. One Debug line of GeometryHelperLog says how many there were.
The other's M holding a line and an INSERT of Z, which it has not, gives this drawing M with its INSERT of Z.
A dynamic block stays dynamic, as AutoCAD's own insert keeps it: its record's extended data
(AcDbDynamicBlockTrueName, AcDbDynamicBlockGUID, AcDbBlockRepETag) and the evaluation graph and
purge preventer of its extension dictionary come with it, each anonymous block standing for it keeps its
AcDbBlockRepBTag, and each INSERT its representation data and the values it keeps, every object copied under a
handle of its own here and every handle among them naming the copies; the classes of the objects are listed. A block
GH_PANEL of a Width of 100 with an INSERT of it set to 200 comes as GH_PANEL, dynamic, with an INSERT that reads
Width 200 and is set again as the one it was copied from. A dynamic block of a name this drawing has is this
drawing's own: the INSERTs copied stand for it where it is dynamic, and are static copies otherwise; and a drawing
older than R2010 (AC1024), which the library writes no dynamic block into, takes them all static.
Every entity is checked before anything is written, its copy and its copy moved, so that a drawing this one cannot hold, a SPLINE into one of R12 or an INSERT the transformation would shear, changes nothing; nor does a drawing whose model space holds an entity of a type the library has no class for (DxfUnknownEntity, as a SHAPE or a REGION), by any transformation but the identity, nor one holding an OLE2FRAME by one that would turn it. The extents of the header grow by the entities where they are moved to. The other drawing is left as it is.
Exceptions
- ArgumentNullException
Thrown when the transformation or the drawing is null.
- ArgumentException
Thrown when the drawing is this one, or this drawing cannot hold an entity of it, or an entity of it refuses the transformation, or a block of it inserts itself, at any depth (X holding an INSERT of X, or Y one of Z and Z one of Y), which AutoCAD's AUDIT takes out; nothing is written then. A block of it that would come to insert itself through an INSERT of this drawing of a block it has not is refused too, as WblockCloneObjects(IEnumerable<DxfEntity>, DxfBlockTableRecord) refuses it, the blocks to be merged and those the copies bring walked together before anything is written: this drawing's P holding an INSERT of M, the other's A a line and M an INSERT of P, neither A nor M is merged.
- NotSupportedException
Thrown when the transformation is not the identity and model space holds an entity of a type the library has no class for; nothing is written then.
Insert(string, DxfDatabase, bool)
Makes a block of another drawing's model space, as AutoCAD's Insert(blockName, dataBase,
preserveSourceDatabase): a new block of the name given, its origin the other drawing's base point
($INSBASE) and its units the other drawing's ($INSUNITS, from R2007), holding a copy of every entity of
that model space, as WblockCloneObjects(IEnumerable<DxfEntity>, DxfBlockTableRecord) copies entities together; and the records of the tables and the
named blocks merged by name as Insert(GeoTransform3, DxfDatabase, bool) merges them. An INSERT of the
block then places the drawing, as AutoCAD's INSERT of a drawing file does.
public DxfBlockTableRecord Insert(string blockName, DxfDatabase dataBase, bool preserveSourceDatabase)
Parameters
blockNamestringThe name of the new block.
dataBaseDxfDatabaseThe drawing to insert, another than this one.
preserveSourceDatabaseboolWhether the other drawing is to be kept as it was: here it always is.
Returns
- DxfBlockTableRecord
The new block.
Remarks
A drawing of a circle of radius 5 about (20, 0), its base point (20, 0, 0), made the block PLATE, gives this drawing
the block PLATE drawn about (20, 0, 0) with the circle in it; nothing is added to model space. Every entity is checked
before anything is written, as the other Insert checks it, and external references, dynamic blocks and INSERTs
of blocks the other drawing has not come as that one says; an INSERT of the other's that names the new block, which it
has not, would place that block inside itself, and is refused so.
Exceptions
- ArgumentNullException
Thrown when the name or the drawing is null.
- ArgumentException
Thrown when the name is one AutoCAD does not take or that of a block of this drawing already, or of one of the other drawing (an OUTER of its own would come under the name of the new block), the drawing is this one, this drawing cannot hold an entity of it, or a block of it inserts itself, at any depth; nothing is written then. A block of it that would come to insert itself through an INSERT of this drawing of a block it has not is refused too, as the other
Insertrefuses it, before anything is written; and so is the new block where an INSERT of this drawing gives its name and it would come to insert itself through that INSERT: this drawing's P holding an INSERT of NEWB and the other's model space an INSERT of P, NEWB is not made.