-1

I am running Vanilla AutoCAD 2017 The accoreconsole.exe will start but and show the example Screen and will appears to run commands, although i am unaware of a way to open a file directly from core console so i cant really do anything with it.

Methods attempted 1. Script Pro 2.0: From https://knowledge.autodesk.com/support/autocad/downloads/caas/downloads/content/autodesk-customization-conversion-tools.html Script pro executes scripts successfully when using AutoCAd But then Fails when i switch to Core Console It generates a log file that reads: Error while reading log file for C:\Users\Documents\TEST\ARCH01_FIRST FLOOR PLAN - AREA C.dwg

2.Auto Lisp From AutoCAD using an Auto Lisp command i found on House of BIM. The command works and i tested several scripts which i first tested using the Run Script Button in AutoCad and they worked, but not when i used core console.

This generated a Temp file called accc34642 which reads m_kernelList still has 1 entry

/i core console flashes and then disappears /I core console opens a new file from the Qnew Template file path

This seems to happen no matter whats after that in the lisp statement.

Then OPEN command in core console doesn't return a prompt or an error, it just returns twice and does nothing. Typing in a file path generates an error

3.Widows batch files I have only used one of these in the past successfully but i checked the ones i found a couple different websites and still no luck on getting the scripts to execute. I also tried all this from different File Paths

Wed0
  • 21
  • 1
  • 2

4 Answers4

2

The main idea of AutoCAD Console is to process 1 file and exit. That's also important to avoid memory fragmentation and errors when you process multiple files in a single instance of accoreconsole.exe

So, as already mentioned, consider a workflow where each instance process a single file and then exit. You may even consider multiple instances of accoreconsole to process multiple files at once.

Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44
2

Wed0, to get started with working with accoreconsole, here are a couple links that will help you:

1) http://adndevblog.typepad.com/autocad/2012/04/getting-started-with-accoreconsole.html

2) http://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-console.html

for the second article, Kean goes into quite a bit of detail, but I don't especially like his approach with using .bat files. It is much nicer to use a programming language like C#.

As for opening files, it actually is possible! I recently discovered a VERY fast method of processing dwg files using accorconsole (or AutoCAD if that is what you prefer). For example, running a search and replace operation of dbtext and mtext on a batch of dwg files runs at around 15 drawings/second on a single process. Setting up 5 or 6 in parallel will process close to 5000 drawings/minute! I thought I would share this with the community as this discovery has been a game-changer for my company when it comes to processing large batches of dwg files.

For this you have to use the .NET API(or C++, etc). I did all the code for processing in C#, and the only 2 lines in the lisp script file is to NETLOAD my dll and call the command that does the processing.

Turns out, you can work on multiple dwg files in the same instance of accoreconsole. The idea here is to just load the dwg database without actually opening the drawing (takes ~70ms), manipulate the database, then save it. For the i/ switch, you can use any dummy drawing file as it will have no effect on your batch. Then in C# in your command method, you would do something like this:

string[] dwgFiles = Directory.GetFiles("C:\\MyDWGFiles");
foreach(string drawingFilePath in dwgFiles)
{
  using(Database database = new Database(false, true))
  {
    database.ReadDwgFile(drawingFilePath, FileShare.ReadWrite, 
                         true String.Empty);
    using(Transaction transaction = 
         database.TransactionManager.StartTransaction())
    {
      //DO STUFF HERE
      transaction.Commit();
      database.SaveAs(drawingFilePath, DwgVersion.Current);
    }
  }
}

Let me know if you have any questions or need more detail,

Nik
  • 1,780
  • 1
  • 14
  • 23
0

I don't believe it is possible to open files from within core console. I am relatively certain core console has to be initialized with the path as an argument of the drawing you wish it to open. Once it is open you can then do work with that file. So, you would essentially have to open a single instance of core console for each file you want to do work on.

Hope that helps.

0

The best way as drive AutoCAD commands as dwg files is use the concept mencioned by "Autodesk Knowledge Network": Out-of-Process .NET

a. https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-NET/files/GUID-C8C65D7A-EC3A-42D8-BF02-4B13C2EA1A4B-htm.html),

and this alternative is supported by Autodesk; the accoreconsole is not.

With this features, you may execute AutoCAD software, open Projects, batch iterates on files and manipulate data. Recently, I developed one plugin that has two requirements:

b. be executed without user-intervention and, c. interates on all Dwg files to execute a process per-file;

  1. Like link above, I instantiated AutoCAD and send commands like a lisp sintaxe to call the customized command (as "("CUSTOM_CMD", "PARAMS1", "PARAMS2" ...)" );

  2. My custom command was like this:

    [CommandMethod("CUSTOM_CMD")]
    public static void CustomCmd
    
    {
    
        //stuff iterate on DWGs
    
    }
    

3.Comments: It's importante to use Thread Safe Collection (for example ConcurrentBag) to memory Dwg Collection to ensure non interference between Next Moving contiguous Dwgs iteraction's running.

Antonio Leonardo
  • 1,805
  • 1
  • 8
  • 18