Autodesk.AutoCAD.DatabaseServices Namespace > Entity Class > Entity Methods > JoinEntity Method
Entity.JoinEntity Method   
Description

This wraps AcDbJoinEntityPE::joinEntity, which when implemented for an Entity, it can be used to join two supported entities together. Some implementations might require the this and the secondary entity be of the same type, while other implementations might convert the data from the secondary entity to match the type of the this entity.

Visual Basic
Public Function JoinEntity(
    secondaryEntity As Entity
) As void
C#
public void JoinEntity(
    Entity secondaryEntity
);
Parameters
Parameters 
Description 
Entity secondaryEntity 
The secondary entity, which provides the data to be joined to the this entity. 
Exceptions
Exceptions 
Description 
Autodesk.AutoCAD.Runtime.Exception for ErrorStatus {InvalidInput} or {NotApplicable} 
_nt_ 
Example

<![CDATA[Database db = Application.DocumentManager.MdiActiveDocument.Database; Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager; 

using (Transaction t = tm.StartTransaction()) { try { Line pLine1 = new Line(new Point3d(0, 0, 0), new Point3d(1, 1, 0)); Line pLine2 = new Line(new Point3d(1, 1, 0), new Point3d(2, 2, 0)); 

// Join the second line to the first line pLine1.JoinEntity(pLine2); } catch (Autodesk.AutoCAD.Runtime.Exception e) { Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("nJoin error: "); Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(e.ErrorStatus.ToString()); } t.Commit(); }]]>

Links
   Comments?