SendCommand with error "Unhandled Access violation Reading 0xffffffffff ......

SendCommand with error "Unhandled Access violation Reading 0xffffffffff ......

Anonymous
Not applicable
3,799 Views
21 Replies
Message 1 of 22

SendCommand with error "Unhandled Access violation Reading 0xffffffffff ......

Anonymous
Not applicable

I have   thousands of   dwg file  , i  wan't  open it  ,then  create a  closed line  , then  get  " maptrim"  command  , then  save it . I operate one by one.

I run my  code  ,   i  get  the  error "Unhandled Access violation Reading Oxffffffff  Exception at  e9e1460bh"  when  I  get about   the  fifith  file 

i use  the  AutoCAD Map 2015+ .net +  com

  using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.Gis.Map.Platform.Utils;
using AutoCAD;



AcadApplication app = Application.AcadApplication as AcadApplication; if (!System.IO.File.Exists(@"C:\template500.dwg")) { Util.PrintLn("\n template is not exsit : C:\\template500.dwg"); return "err"; } Document DOC = Application.DocumentManager.Open(@"C:\template500.dwg", false); List<string> LstFiles = new List<string>(); List<string> LstCode = GetTuFuNumber.GetTuFuNum(MapCode); for (int i = 0; i < LstCode.Count; i++) { if (System.IO.File.Exists(Path + "\\" + LstCode[i] + ".dwg")) { LstFiles.Add(Path + "\\" + LstCode[i] + ".dwg"); } } string s = ""; for (int k = 0; k < LstFiles.Count; k++) { s += LstFiles[k] + ","; } //********load the file and connected file Database destDb = DOC.Database; using (DocumentLock docLock1 = DOC.LockDocument()) { for (int i = 0; i < LstFiles.Count; i++) { Database sourceDb = new Database(false, true); sourceDb.ReadDwgFile(LstFiles[i], System.IO.FileShare.Read, false, null); var SourceObjectIds = new ObjectIdCollection(); Autodesk.AutoCAD.DatabaseServices.TransactionManager SourceTm = sourceDb.TransactionManager; using (Transaction trans = destDb.TransactionManager.StartTransaction()) { var blockTable = (BlockTable)trans.GetObject(destDb.BlockTableId, OpenMode.ForRead); using (Transaction extTrans = sourceDb.TransactionManager.StartTransaction()) { dynamic extBlockTable = (BlockTable)extTrans.GetObject(sourceDb.BlockTableId, OpenMode.ForRead); dynamic extModelSpace = (BlockTableRecord)extTrans.GetObject(extBlockTable[BlockTableRecord.ModelSpace], OpenMode.ForRead); foreach (ObjectId id in extModelSpace) { SourceObjectIds.Add(id); } } sourceDb.CloseInput(true); dynamic idmapping = new IdMapping(); // destDb.WblockCloneObjects(SourceObjectIds, destDb.BlockTableId, idmapping, DuplicateRecordCloning.Replace, false); destDb.WblockCloneObjects(SourceObjectIds, blockTable[BlockTableRecord.ModelSpace], idmapping, DuplicateRecordCloning.Replace, false); trans.Commit(); } } } CWriteLog.Msg(targetPath, "finish load file "); Util.PrintLn("create polyline......."); app.ActiveDocument.SendCommand("filedia 0 \n"); Polyline line = getLine(MapCode); //**** add the polyline to modespace using (DOC.LockDocument()) { ObjectId entityID; using (var tr = DOC.TransactionManager.StartTransaction()) { var modelspace = (BlockTableRecord)tr.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(DOC.Database), OpenMode.ForWrite); // Circle circ = new Circle(Point3d.Origin, Vector3d.ZAxis, 100.0); entityID = modelspace.AppendEntity(line); tr.AddNewlyCreatedDBObject(line, true); tr.Commit(); } //**************begion to maptrim Util.PrintLn("begion to maptrim "); CWriteLog.Msg(targetPath, "begin to maptrim "); app.ActiveDocument.SendCommand("_.MAPTRIM\nS\nlast\nN\nN\nO\nY\nN\nR\nY\n\n"); CWriteLog.Msg(targetPath, " finish maptrim "); Util.PrintLn("finish maptrim "); CWriteLog.Msg(targetPath, "delete polyline "); DeleleEnity(entityID); CWriteLog.Msg(targetPath, "save ......."); string saveFolder = targetPath + "\\" + "outPut"; if (!System.IO.Directory.Exists(saveFolder)) { System.IO.Directory.CreateDirectory(saveFolder); } string filename = saveFolder + "\\" + MapCode + ".dwg"; ; app.ActiveDocument.SendCommand("_.SAVEAS\n2004\n" + filename + "\nY\n\n");

everytime  I  get  the error  at  "

  app.ActiveDocument.SendCommand("_.MAPTRIM\nS\nlast\nN\nN\nO\nY\nN\nR\nY\n\n");

"

0 Likes
3,800 Views
21 Replies
Replies (21)
Message 2 of 22

ActivistInvestor
Mentor
Mentor

SendCommand() is asynchronous, which means that the commands that you pass it do not execute until after your code exits and returns control to AutoCAD.

 

You cannot do batch scripting this way. If you have 'thousands of dwg files', you will probably need to start and shutdown AutoCAD for each one, or every 10 or so files, but in order to execute commands your code must run in the document execution context, or you must find a way to wait until the command has finished (using an event possibly) before you resume processing the file.

 

Batch processing is best done by controlling the entire process from an out-of-process ActiveX client. You can write the code that processes each file in .NET, and then expose it as a command that would be started using SendCommand() from the out-of-process controller. It must then wait until the command has finished before closing the file and opening the next one.

 

 


@Anonymous wrote:

I have   thousands of   dwg file  , i  wan't  open it  ,then  create a  closed line  , then  get  " maptrim"  command  , then  save it . I operate one by one.

I run my  code  ,   i  get  the  error "Unhandled Access violation Reading Oxffffffff  Exception at  e9e1460bh"  when  I  get about   the  fifith  file 

i use  the  AutoCAD Map 2015+ .net +  com

  using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.Gis.Map.Platform.Utils;
using AutoCAD;



AcadApplication app = Application.AcadApplication as AcadApplication; if (!System.IO.File.Exists(@"C:\template500.dwg")) { Util.PrintLn("\n template is not exsit : C:\\template500.dwg"); return "err"; } Document DOC = Application.DocumentManager.Open(@"C:\template500.dwg", false); List<string> LstFiles = new List<string>(); List<string> LstCode = GetTuFuNumber.GetTuFuNum(MapCode); for (int i = 0; i < LstCode.Count; i++) { if (System.IO.File.Exists(Path + "\\" + LstCode[i] + ".dwg")) { LstFiles.Add(Path + "\\" + LstCode[i] + ".dwg"); } } string s = ""; for (int k = 0; k < LstFiles.Count; k++) { s += LstFiles[k] + ","; } //********load the file and connected file Database destDb = DOC.Database; using (DocumentLock docLock1 = DOC.LockDocument()) { for (int i = 0; i < LstFiles.Count; i++) { Database sourceDb = new Database(false, true); sourceDb.ReadDwgFile(LstFiles[i], System.IO.FileShare.Read, false, null); var SourceObjectIds = new ObjectIdCollection(); Autodesk.AutoCAD.DatabaseServices.TransactionManager SourceTm = sourceDb.TransactionManager; using (Transaction trans = destDb.TransactionManager.StartTransaction()) { var blockTable = (BlockTable)trans.GetObject(destDb.BlockTableId, OpenMode.ForRead); using (Transaction extTrans = sourceDb.TransactionManager.StartTransaction()) { dynamic extBlockTable = (BlockTable)extTrans.GetObject(sourceDb.BlockTableId, OpenMode.ForRead); dynamic extModelSpace = (BlockTableRecord)extTrans.GetObject(extBlockTable[BlockTableRecord.ModelSpace], OpenMode.ForRead); foreach (ObjectId id in extModelSpace) { SourceObjectIds.Add(id); } } sourceDb.CloseInput(true); dynamic idmapping = new IdMapping(); // destDb.WblockCloneObjects(SourceObjectIds, destDb.BlockTableId, idmapping, DuplicateRecordCloning.Replace, false); destDb.WblockCloneObjects(SourceObjectIds, blockTable[BlockTableRecord.ModelSpace], idmapping, DuplicateRecordCloning.Replace, false); trans.Commit(); } } } CWriteLog.Msg(targetPath, "finish load file "); Util.PrintLn("create polyline......."); app.ActiveDocument.SendCommand("filedia 0 \n"); Polyline line = getLine(MapCode); //**** add the polyline to modespace using (DOC.LockDocument()) { ObjectId entityID; using (var tr = DOC.TransactionManager.StartTransaction()) { var modelspace = (BlockTableRecord)tr.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(DOC.Database), OpenMode.ForWrite); // Circle circ = new Circle(Point3d.Origin, Vector3d.ZAxis, 100.0); entityID = modelspace.AppendEntity(line); tr.AddNewlyCreatedDBObject(line, true); tr.Commit(); } //**************begion to maptrim Util.PrintLn("begion to maptrim "); CWriteLog.Msg(targetPath, "begin to maptrim "); app.ActiveDocument.SendCommand("_.MAPTRIM\nS\nlast\nN\nN\nO\nY\nN\nR\nY\n\n"); CWriteLog.Msg(targetPath, " finish maptrim "); Util.PrintLn("finish maptrim "); CWriteLog.Msg(targetPath, "delete polyline "); DeleleEnity(entityID); CWriteLog.Msg(targetPath, "save ......."); string saveFolder = targetPath + "\\" + "outPut"; if (!System.IO.Directory.Exists(saveFolder)) { System.IO.Directory.CreateDirectory(saveFolder); } string filename = saveFolder + "\\" + MapCode + ".dwg"; ; app.ActiveDocument.SendCommand("_.SAVEAS\n2004\n" + filename + "\nY\n\n");

everytime  I  get  the error  at  "

  app.ActiveDocument.SendCommand("_.MAPTRIM\nS\nlast\nN\nN\nO\nY\nN\nR\nY\n\n");

"


 

0 Likes
Message 3 of 22

Juergen_Becker
Advocate
Advocate

Hi,

 

I'm using a DLLImport to define a method which calls internals.

 

[DllImport("accore.dll",
 CharSet = CharSet.Unicode,
 CallingConvention = CallingConvention.Cdecl,
 EntryPoint = "acedCmd")]
public static extern int acedCmd(IntPtr vlist);

[DllImport("accore.dll",
 CharSet = CharSet.Unicode,
 CallingConvention = CallingConvention.Cdecl,
 EntryPoint = "acedCmdS")]
public static extern int acedCmdS(System.IntPtr vlist);

This is an example:

m_ResultBuffer = new ResultBuffer();
m_ResultBuffer.Add(new TypedValue(5005, "_.SAVEAS"));
m_ResultBuffer.Add(new TypedValue(5005, m_ResultBuffer.Add(new TypedValue(5005, m_FileName));

if (System.IO.File.Exists(m_FileName) == true)
{
     m_ResultBuffer.Add(new TypedValue(5005, "_YES"));
}
if (m_ACADVersionDouble >= 21)
{
     acedCmdS(m_ResultBuffer.UnmanagedObject);
}
else if (m_ACADVersionDouble >= 19 && m_ACADVersionDouble <= 19.1)
{
     acedCmd(m_ResultBuffer.UnmanagedObject);
}

This works fine in a command, you don't have to wait or something like that.

 

Regards Jürgen

I hope my tip helps. If so then give me kudos and mark the tip as a solution.
Thanks.

Jürgen A. Becker
Building Services

Development and Support
Autodesk Forge Spezialist


CAD-Becker.de
https://www.CAD-Becker.de

0 Likes
Message 4 of 22

ActivistInvestor
Mentor
Mentor

There is no need to call directly to acedCmd() or acedCmdS() because they are called by the Editor.Command() method.

 

The Editor.Command() method is a managed wrapper for acedCmdS():

 

Here is the source code of Editor.Command():

 

// Autodesk.AutoCAD.EditorInput.Editor
public unsafe void Command(params object[] parameter)
{
   resbuf* ptr = null;
   try
   {
      ptr = (resbuf*)Marshaler.ObjectsToResbuf(parameter).ToPointer();
      Interop.CheckAds(<Module>.acedCmdS((resbuf*)ptr, false, null));
   }
   finally
   {
      if (ptr != null)
      {
         <Module>.acutRelRb(ptr);
      }
   }
}

 

 


@Juergen_Becker wrote:

Hi,

 

I'm using a DLLImport to define a method which calls internals.

 

[DllImport("accore.dll",
 CharSet = CharSet.Unicode,
 CallingConvention = CallingConvention.Cdecl,
 EntryPoint = "acedCmd")]
public static extern int acedCmd(IntPtr vlist);

[DllImport("accore.dll",
 CharSet = CharSet.Unicode,
 CallingConvention = CallingConvention.Cdecl,
 EntryPoint = "acedCmdS")]
public static extern int acedCmdS(System.IntPtr vlist);

This is an example:

m_ResultBuffer = new ResultBuffer();
m_ResultBuffer.Add(new TypedValue(5005, "_.SAVEAS"));
m_ResultBuffer.Add(new TypedValue(5005, m_ResultBuffer.Add(new TypedValue(5005, m_FileName));

if (System.IO.File.Exists(m_FileName) == true)
{
     m_ResultBuffer.Add(new TypedValue(5005, "_YES"));
}
if (m_ACADVersionDouble >= 21)
{
     acedCmdS(m_ResultBuffer.UnmanagedObject);
}
else if (m_ACADVersionDouble >= 19 && m_ACADVersionDouble <= 19.1)
{
     acedCmd(m_ResultBuffer.UnmanagedObject);
}

This works fine in a command, you don't have to wait or something like that.

 

Regards Jürgen




 

 

 

 

 

 

0 Likes
Message 5 of 22

Anonymous
Not applicable

thank you for your reply!

i simply my processing,i open template ,then  add a  circle  ,then  save  and close, one by one 

my code like  this,but is run  wrong 

how to modify ?

        [CommandMethod("MyOF")]
        public void op()
        {
            string filedia = Application.GetSystemVariable("filedia").ToString();
            DocumentCollection docsMgr = Application.DocumentManager;
            for (int i = 0; i < 100; i++)
            {
                try
                {
                    Document doc = docsMgr.Open("C:\\template2000.dwg", false);
                    docsMgr.MdiActiveDocument = doc;
                    using (doc.LockDocument())
                    {
                        ObjectId entityID;
                        using (var tr = doc.TransactionManager.StartTransaction())
                        {
                            var modelspace = (BlockTableRecord)tr.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(doc.Database), OpenMode.ForWrite);
                            Circle circ = new Circle(Point3d.Origin, Vector3d.ZAxis, 100.0);
                            entityID = modelspace.AppendEntity(circ);

                            tr.AddNewlyCreatedDBObject(circ, true);
                            tr.Commit();
                            doc.UserData.Add("EntityId", entityID);

                        }
                      
                        doc.Editor.Command("_.ZOOM", "_object", doc.UserData["EntityId"], "");

                        doc.Editor.Command("_.SAVEAS", "2004", "C:\\ee" + i + ".dwg", "Y");


                       
                    }

               
                   doc.Editor.Command("_.CLOSE");

                }
                catch (System.Exception ee)
                {
                    Util.PrintLn("error" + ee.Message.ToString());
                }


            }

        }
0 Likes
Message 6 of 22

_gile
Consultant
Consultant

Hi,

 

To be able to switch between documents, you have to use the CommandFlags.Session, but this sets your command in the application context and you can only use Editor.Command() in the document context.

 

For batch scripting files, you should have a look at ScriptPro.

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 7 of 22

Anonymous
Not applicable

thank you for your reply!

I know if i use the  commandflag.session , ed.command  does't work.

how do i send command synchronous in commandflag.session,  so that  i can  operate  dwg  one by one!

 

0 Likes
Message 8 of 22

Anonymous
Not applicable

can you give me  a  whole example code?

0 Likes
Message 9 of 22

_gile
Consultant
Consultant

As far as I know there's no way to synchronously call commands in application context, but I may be wrong.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 10 of 22

Anonymous
Not applicable

is there no way  to solve my problem?

I just  want  to  do  that   open a  template dwg file  ,then  send a  command  to  add a  circle  ,then  save  and close, one by one 

0 Likes
Message 11 of 22

Juergen_Becker
Advocate
Advocate

 and save the Hi,

 

why do you open the drawin ginto the editor? Thats Needs time.

 

What about this?

m_DataBase = new Database(false, true);
m_DataBase.ReadDwgFile(m_DrawingPath + @"\" + m_Name + ".DWG",
      System.IO.FileShare.Read,
      true,
      string.Empty);
m_DataBase.CloseInput(true);

This does'nt open the drawing in the Editor and it's much faster. After that you can add your circle or what ever you want and save the drawing.

m_Name is the drawing Name put your drawing Name into a list (System.Collections.Generic.List<string>). 

 

BTW: You don't need any SendCommands or what ever.

 


yanasdf789 wrote:

is there no way  to solve my problem?

I just  want  to  do  that   open a  template dwg file  ,then  send a  command  to  add a  circle  ,then  save  and close, one by one 


Regards Jürgen

I hope my tip helps. If so then give me kudos and mark the tip as a solution.
Thanks.

Jürgen A. Becker
Building Services

Development and Support
Autodesk Forge Spezialist


CAD-Becker.de
https://www.CAD-Becker.de

0 Likes
Message 12 of 22

Anonymous
Not applicable

i have try this  method,

the problem is that  i have thousands of  dwg  file to do ,the  memory  of  ACAD.EXE   will  increase  quickly!

 

how to  free  the memory  when database close?

0 Likes
Message 13 of 22

_gile
Consultant
Consultant

If you only want to draw a circle (or anything else which can be done by a command), you can use SendStringtoExecute.

 

        [CommandMethod("MyOF", CommandFlags.Session)]
        public void op()
        {
            string filedia = Application.GetSystemVariable("FILEDIA").ToString();
            DocumentCollection docsMgr = Application.DocumentManager;
            for (int i = 0; i < 100; i++)
            {
                try
                {
                    Document doc = docsMgr.Open("C:\\template2000.dwg", false);
                    docsMgr.MdiActiveDocument = doc;
                    string filename = "C:\\ee" + i + ".dwg";
                    if (System.IO.File.Exists(filename))
                        System.IO.File.Delete(filename);
                    doc.SendStringToExecute("FILEDIA 0 ", false, false, false);
                    doc.SendStringToExecute("_.CIRCLE 0,0 100.0 ", false, false, false);
                    doc.SendStringToExecute("_.ZOOM _object _last  ", false, false, false);
                    doc.SendStringToExecute("_.SAVEAS 2004 " + filename + "\n", false, false, false);
                    doc.SendStringToExecute("_.CLOSE ", false, false, false);
                    doc.SendStringToExecute("FILEDIA " + filedia + " ", false, false, false);
                }
                catch (System.Exception ee)
                {
                    Util.PrintLn("error" + ee.Message.ToString());
                }
            }
        }

But, IMO, for this kind of scripting, you should have a look at the accoreconsole.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 14 of 22

_gile
Consultant
Consultant

@Anonymous wrote:

i have try this  method,

the problem is that  i have thousands of  dwg  file to do ,the  memory  of  ACAD.EXE   will  increase  quickly!

 

how to  free  the memory  when database close?


As @ActivistInvestor said, if you have thousands of files to do, you should stop and restart AutoCAD from time to time.

 

It seems to me that ScriptPro handles this.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 15 of 22

Juergen_Becker
Advocate
Advocate

What I don't understand is that you necessarily loaded the document into the Editor. 

 
It is not necessary for such a task.
Use ReadDwgFile to open the darwing into the Memory. Close the Input. Do what you want with the drawing database, save it and Close the drawing.
 
I did that with 6000 drawings without any problems.
 
You can use AutoCAD to that or mentionied above with the AutoCAD Core Console and forget all the SendCommands.
I hope my tip helps. If so then give me kudos and mark the tip as a solution.
Thanks.

Jürgen A. Becker
Building Services

Development and Support
Autodesk Forge Spezialist


CAD-Becker.de
https://www.CAD-Becker.de

0 Likes
Message 16 of 22

_gile
Consultant
Consultant

Here's a simple Console Application which uses the Core Console.

Change the core console path as needed.

 

using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;

namespace AcCoreConsoleSample
{
    class Program
    {
        static void Main(string[] args)
        {
            Run();
        }

        const string coreConsolePath = @"C:\Program Files\Autodesk\AutoCAD 2013\accoreconsole.exe";
        cons string scriptPath = @"C:\Temp\CoreConsoleScript.scr";
static void Run() { for (int i = 0; i < 10; i++) { string filename = "C:\\Temp\\ee" + i + ".dwg"; if (File.Exists(filename)) File.Delete(filename); using (var writer = new StreamWriter(scriptPath, false)) { writer.WriteLine("_.CIRCLE 0,0 100.0"); writer.WriteLine("_.ZOOM _object _last\n"); writer.WriteLine("_.SAVEAS 2004"); writer.WriteLine(filename); } string args = "/s " + scriptPath; var startInfo = new ProcessStartInfo(coreConsolePath, args); startInfo.WindowStyle = ProcessWindowStyle.Normal; var process = Process.Start(startInfo); process.WaitForExit(); } File.Delete(scriptPath); } } }


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 17 of 22

_gile
Consultant
Consultant

You can also easily parallelize the process to run in parallel as many consoles as available cores.

 

using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;

namespace AcCoreConsoleSample
{
    class Program
    {
        static void Main(string[] args)
        {
            RunParallel();
        }

        const string coreConsolePath = @"C:\Program Files\Autodesk\AutoCAD 2013\accoreconsole.exe";

        static void RunParallel()
        {
            Parallel.For(0, 10, i =>
            {
                string filename = "C:\\Temp\\ee" + i + ".dwg";
                if (File.Exists(filename))
                    File.Delete(filename);
                string scriptPath = @"C:\Temp\CoreConsoleScript_" + i + ".scr";
                using (var writer = new StreamWriter(scriptPath, false))
                {
                    writer.WriteLine("_.CIRCLE 0,0 100.0");
                    writer.WriteLine("_.ZOOM _object _last\n");
                    writer.WriteLine("_.SAVEAS 2004");
                    writer.WriteLine(filename);
                }
                string args = "/s " + scriptPath;
                var startInfo = new ProcessStartInfo(coreConsolePath, args);
                startInfo.WindowStyle = ProcessWindowStyle.Normal;
                var process = Process.Start(startInfo);
                process.WaitForExit();
                File.Delete(scriptPath);
            });
        }
    }
}


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 18 of 22

_gile
Consultant
Consultant

@Juergen_Becker wrote:

What I don't understand is that you necessarily loaded the document into the Editor.


Because the OP wants to be able to run commands (he talked about the MAPTRIM command in the first post).



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 19 of 22

ActivistInvestor
Mentor
Mentor

@Juergen_Becker wrote:

What I don't understand is that you necessarily loaded the document into the Editor. 

 
It is not necessary for such a task.
Use ReadDwgFile .....

The ZOOM command cannot be used on a drawing that's not open in the Editor. 

 

Look at the code again. Do you see "Command("._ZOOM, ...) ????

 

If you are going to make such statements, then you should also show how to zoom to an object in a drawing that's not open in the editor.

 

While it's not impossible, it's not so simple a task, so before you tell others to use ReadDwgFile(), you have to show them how to do the task that you say doesn't require the drawing to be open in the editor.

 

So please show the OP how to zoom to an object without opening the drawing in the editor, and while you're at it, also show how to generate a correct thumbnail preview for the DWG file without opening it in the editor.

 

 

0 Likes
Message 20 of 22

Anonymous
Not applicable

hi 

you said "Use ReadDwgFile to open the darwing into the Memory.... did that with 6000 drawings without any problems.", 

if  you  read  6000 drawings  into  memory , how  large    memory  occupy with  acad.exe  at last  ? 

do  you done  some thing to  free  memory?

 

can you  solve the  problem  in   another topic? https://forums.autodesk.com/t5/net/database-free-the-memory/m-p/7623187#M56334

0 Likes