Method Insert
Insert(DxfEntity, string)
Queues an object to be added to the drawing. The entity is copied now, so changing it afterwards changes nothing;
it can be one made in code (new DxfLine(...)), or one read from this or another drawing of the same app,
which is copied with the layers, styles and blocks it needs. A layer the drawing has not is made. An INSERT of a
block the drawing has not brings the block's definition when the INSERT was made from a block of your own that holds
objects (new DxfBlockReference(point, record) with record in a DxfDatabase of yours); a block the
drawing has already is the drawing's own, whatever yours holds. An INSERT of a block that is neither in the
drawing nor defined with objects is refused at the commit. A dimension made in code is drawn by the app, with the
drawing's current dimension style unless it names one. A text or MTEXT (or an attribute of an INSERT) that names a
text style, or any object that names a linetype, is one the drawing has (the app's own record is kept) or
AddRecords(DxfDatabase) adds in the same commit; one nobody has is refused at once, as the library refuses an
object that names a style its drawing has not.
public string Insert(DxfEntity entity, string layout = null)
Parameters
entityDxfEntityThe object.
layoutstringThe name of the layout to put it in; null for model space.
Returns
- string
A ticket for the object, such as
~1, which stands for its handle once CommitChanges() is done.
Exceptions
- ArgumentNullException
Thrown when the entity is null.
- ArgumentException
Thrown when the entity is in a drawing of the caller's own, not made in code or read from the app, or names a text style or a linetype that neither the drawing nor AddRecords(DxfDatabase) has.