- var doc = Application.DocumentManager.MdiActiveDocument;
- var db = doc.Database;
- var ed = doc.Editor;
- ObjectId id1,id2;
- using (Transaction tr = db.TransactionManager.StartTransaction())
- {
- BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
- BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
- Line l1 = new Line(new Point3d(1, 1, 0), Point3d.Origin);
- Line l2 = new Line(Point3d.Origin,new Point3d(-1,-1,0));
- id1 = btr.AppendEntity(l1);
- tr.AddNewlyCreatedDBObject(l1,true);
- id2 = btr.AppendEntity(l2);
- tr.AddNewlyCreatedDBObject(l2,true);
- tr.Commit();
- }
- EdEx.Command(
- false,
- "._join",
- id1,
- SelectionSet.FromObjectIds(new ObjectId[] { id2 }),
- null);