IsEMR

IsEMR

Anonymous
Not applicable
1,030 Views
4 Replies
Message 1 of 5

IsEMR

Anonymous
Not applicable

I'm trying to test if a dwg is created by Educational version.

 

This is my code so far

 

using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;

namespace ExtractEMR
{
    public class Commands
    {
        [CommandMethod("EMR")]
        static public void ExtractEMRFromFile()
        {
            Document doc =
              Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;

            // Ask the user to select a file
            PromptResult res =
              ed.GetString(
                "\nEnter the path of a DWG or DXF file: "
              );

            if (res.Status == PromptStatus.OK)
            {
                // Create a database and try to load the file
                Database db = new Database(false, true);
                using (db)
                {
                    try
                    {
                        db.ReadDwgFile(
                          res.StringResult,
                          System.IO.FileShare.Read,
                          false,
                          ""
                        );
                    }
                    catch (System.Exception)
                    {
                        ed.WriteMessage(
                          "\nUnable to read drawing file."
                        );
                        return;
                    }

                    Transaction tr =
                      db.TransactionManager.StartTransaction();
                    using (tr)
                    {
                        string str = db.IsEMR();
                        ed.WriteMessage(str);
                    }
                }
            }
        }
    }
}

 

but its saying there is no definition for IsEMR.

0 Likes
Accepted solutions (1)
1,031 Views
4 Replies
Replies (4)
Message 2 of 5

OysteinW
Advocate
Advocate

IsEMR() is removed from the API in AutoCAD 2015

0 Likes
Message 3 of 5

Anonymous
Not applicable

Try this instead:

 

object oSerial = Application.GetSystemVariable("_PKSER");
bool IsEducational = oSerial.ToString().StartsWith("900-");

 

0 Likes
Message 4 of 5

Anonymous
Not applicable

Thanks for your reply,

 

I'm using ACAD 2013.

 

I'm trying to get if the drawing is created from Educational, not if using AutoCAD educational.

 

 

Thanks again,

0 Likes
Message 5 of 5

Anonymous
Not applicable
Accepted solution

I just did it in ARX

 

Thanks everyone.

0 Likes