How to Find if Drawing is a TrustedDWG

<?xml encoding=”UTF-8″>By Madhukar Moogala

TrustedDWG is a key function of AutoCAD and AutoCAD LT that analyses DWG files as they are being opened. The function checks to see if the DWG file was last saved with an Autodesk product or by a software developer who is licensed to use the RealDWG toolkit. If the file does not pass the TrustedDWG analysis, it will inform you in various ways that the DWG file may not be compatible, nor guarantee its integrity when used with AutoCAD or AutoCAD LT.

The visibility of these warnings is controlled by the DWGCHECK system variable. DWGCHECK is an integer variable, and is saved in the registry

When a drawing is not a TrustedDWG, and you open the drawing in AutoCAD or LT, you get this message or pop dialog.

Non Autodesk DWG. This DWG file was saved by a software application that was not developed or licensed by Autodesk. Autodesk cannot guarantee the application compatibility or integrity of this file.


image

Using API DwgFileWasSavedByAutodeskSoftware

        public void IsTrustedDWG()
{
Document doc = CoreApp.DocumentManager.MdiActiveDocument;
if (doc == null) return;
Editor ed = doc.Editor;
var presult = ed.GetString(new PromptStringOptions("Enter Drawing File Path"));
if (presult.Status != PromptStatus.OK) return;
var db = HostApplicationServices.WorkingDatabase;
Database sideDb = new Database(false, true);
sideDb.ReadDwgFile(presult.StringResult, System.IO.FileShare.Read, true, null);
HostApplicationServices.WorkingDatabase = sideDb;
bool isTrustedDWG = sideDb.DwgFileWasSavedByAutodeskSoftware;
if (isTrustedDWG)
{
ed.WriteMessage("Is Trusted DWGn");
}
HostApplicationServices.WorkingDatabase = db;
}

Comments

8 responses to “How to Find if Drawing is a TrustedDWG”

  1. Thanks for the article on how to find out if a Drawing is TrustedDWG or not

  2. Hanfding Avatar
    Hanfding

    This topic is very interesting Sonic exe. It includes functions I’m getting a few minor errors here.

  3. Pretty good article. I just stumbled across your blog and enjoyed reading your blog posts. I am looking for new articles to get more valuable information. Big thanks for this.

  4. JamesOneil Avatar
    JamesOneil

    I just stumbled across your blog and enjoyed shell gas station near me
    reading your blog posts. I am looking for new articles to ge.

  5. Excellent article. I recently discovered your blog and have relished reading your blog posts. I’m searching for new articles to increase my knowledge.

  6. Thank you for providing this information. I am delighted to come on this fantastic article.

  7. Ensuring the integrity of DWG files is crucial for smooth workflow in AutoCAD and AutoCAD LT. TrustedDWG feature acts as a gatekeeper, verifying if the file meets Autodesk standards. Understanding DWGCHECK and being aware of warnings like “Non Autodesk DWG” can help maintain compatibility and file integrity.

  8. If it was saved by Autodesk software, it is considered a TrustedDWG, and the function will output “Trusted DWG”.

Leave a Reply

Discover more from Autodesk Developer Blog

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

Continue reading