Audit API – New in AutoCAD 2015

By Virupaksha Aithal

From AutoCAD 2015, you can programmatically audit the drawing file using the new Database API “Audit” . You can also try fixing the issues in the drawing file using API’s argument. This API is present in ObjectARX and .NET.

In ObjectARX – use Acad::ErrorStatus acedAudit(AcDbDatabase* , bool , bool ) API.

[CommandMethod("AuditTest")] publicvoid AuditTest() // This method can have any name {     Document doc = Application.DocumentManager.MdiActiveDocument;     Editor ed = doc.Editor;      try     {         //to fix the error or not         bool bFixErrors = true;         //to show the message in commandline or not         bool becho = true;                         //call audit API         doc.Database.Audit(bFixErrors, becho);     }     catch     {         ed.WriteMessage("Unable to audit the drawingn");     }  }

Comments

4 responses to “Audit API – New in AutoCAD 2015”

  1. Jonathan Avatar
    Jonathan

    I can’t seem to find the database.Audit function.
    Could I be missing a dll reference, or using statement?
    I have Acad 2015 + the hotfix that came out this month
    Thanks

  2. Jonathan Avatar
    Jonathan

    Found it. Needs a reference to:
    Autodesk.AutoCAD.ApplicationServices.DatabaseExtension

  3. Curtis Linville Avatar
    Curtis Linville

    Sorry for the necropost. Is there a way to get back the number of items fixed/found? Essentially I want a way to programmatically call Audit and get all the same text as when I run Audit manually in AutoCAD for logging purposes.

  4. Hi,
    You can get the text outputted to command line using becho variable (second bool) but i do not think you can get back the number of error fixed in terms of count.
    regards
    Viru

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading