Tony, et al
Regarding autoDelete :
Under what circumstances would the autoDelete property be false ?
The constructors for (say) a line sets the property to true through the base class.
Just an aside.
It pleases me immensely to see the level of discussion on these subjects.
Thanks to all who are participating and attempting to clear up concepts that have been in dispute for years.
Regards,
Kerry
It depends on the managed wrapper type. For DBObject, AutoDelete will be false if there is no need to delete the underlying AcDbObject or call close() if the object is in a database.
In the case of the constructor, AutoDelete will always be true, because the underlying AcDbObject is owned by the managed wrapper and must be deleted or added to a database.
When you add a new DBObject to a database, and then call AddNewlyCreatedDbObject() to add it to a transaction, the transaction sets the DBObject's AutoDelete property to false:
public virtual unsafe void AddNewlyCreatedDBObject(DBObject obj, bool add)
{
AcDbTransactionManager* impObj = this.GetImpObj();
int num2 = *(((int*) impObj)) + 48;
int num = *num2[0](impObj, obj.GetImpObj(), add);
if (num != 0)
{
throw new Exception
((ErrorStatus
) num
); }
obj.AutoDelete = false; <--- no longer necessary to delete the AcDbObject
}
When you call Transaction.GetObject() to open an object, the resulting DBObjectt's AutoDelete property is always false. If you call ObjectId.Open() to open an object, its AutoDelete property is always true (because Close() or Cancel() must be called).
For other objects, it depends on whether the underlying unmanaged object should be deleted.