I've tried that and it results in an access violation. Code :
easiBaseOutline = Utility.AddCircleToDrawing(insertPoint, 600, LayerNames.TemporaryEntity);
//Ask for the output pipe
outputPipe = GetOutputPipe();
if (outputPipe == null)
{
//ESC pressed, so stop the command
return;
}
//Check that the outlet pipe intersects with the EasiBase outline
//Ask for the inlet pipes
//Open the EasiBase form
}
catch (Exception ex)
{
MessageBox.Show("EasiBase.Create" + ex.Message, MessageHeadings.ExceptionError);
}
finally
{
if (easiBaseOutline != null)
{
easiBaseOutline.Erase();
}
}
The circle to be deleted is created by :
public static Circle AddCircleToDrawing(Point3d InsertPoint, double Radius, string LayerName)
{
Document thisDrawing;
Circle newCircle = null;
BlockTable blockTable;
BlockTableRecord blockTableRecord;
try
{
thisDrawing = GetDocument();
if (thisDrawing == null)
{
return newCircle;
}
// Start a transaction
using (Transaction autoCADTransaction = thisDrawing.Database.TransactionManager.StartTransaction())
{
// Open the Block table for read
blockTable = autoCADTransaction.GetObject(thisDrawing.Database.BlockTableId, OpenMode.ForRead) as BlockTable;
// Open the Block table record Model space for write
blockTableRecord = autoCADTransaction.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
using (newCircle = new Circle())
{
// Create the circle entity
newCircle.Center = InsertPoint;
newCircle.Radius = Radius;
newCircle.Layer = LayerName;
newCircle.Visible = true;
// Add the new object to the block table record and the transaction
blockTableRecord.AppendEntity(newCircle);
autoCADTransaction.AddNewlyCreatedDBObject(newCircle, true);
}
// Save the new object to the database
autoCADTransaction.Commit();
}
}
catch (Exception ex)
{
MessageBox.Show("Utility.AddCircleToDrawing" + ex.Message, MessageHeadings.ExceptionError);
}
return newCircle;
}
Which is a copy of a pretty vanilla routine from the Autodesk help.
I had assumed that deleting this object would require a database transaction, as the create routine does.