31 lines
723 B
C#
31 lines
723 B
C#
using System;
|
|
using Autodesk.AutoCAD.ApplicationServices;
|
|
using Autodesk.AutoCAD.DatabaseServices;
|
|
|
|
namespace CadParamPluging.Cad
|
|
{
|
|
public class CadContext : IDisposable
|
|
{
|
|
public Document Document { get; }
|
|
public Database Database => Document.Database;
|
|
public Transaction Transaction { get; private set; }
|
|
|
|
public CadContext(Document document)
|
|
{
|
|
Document = document;
|
|
Transaction = Database.TransactionManager.StartTransaction();
|
|
}
|
|
|
|
public void Commit()
|
|
{
|
|
Transaction?.Commit();
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Transaction?.Dispose();
|
|
Transaction = null;
|
|
}
|
|
}
|
|
}
|