I Want to Create a leader object with the following method,but it doen't work fine.why?
public static ObjectId DrawLine(Point3d startPoint,Point3d endPoint)
{
ObjectId lineId = ObjectId.Null;// The return value for this function
Database db = HostApplicationServices.WorkingDatabase; using (Transaction trans = db.TransactionManager.StartTransaction())
{
BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
BlockTableRecord btr = bt[BlockTableRecord.ModelSpace].GetObject(OpenMode.ForWrite) as BlockTableRecord;
Leader leader = new Leader(); leader.AppendVertex(startPoint);
leader.AppendVertex(endPoint);
lineId = btr.AppendEntity(leader);
trans.AddNewlyCreatedDBObject(leader, true);
trans.Commit();
}
return lineId;
}