Parallelism for reading drawing data using AccoreConsole

Parallelism for reading drawing data using AccoreConsole

Anonymous
Not applicable
1,912 Views
10 Replies
Message 1 of 11

Parallelism for reading drawing data using AccoreConsole

Anonymous
Not applicable

Hello All,

 

I want to process multiple drawings and read objects from each of the drawings.

I am using C#.NET as my programming language.

As there are 1000's of drawings, I am using Parallel for each loop.

Inside the loop I am invoking the AccoreConsole to do this.

 

But, I am getting the error message as shown below:

 

------------------------------------------------------------------------------------------------

Title: Licensing Error

------------------------------------------------------------------------------------------------

Unable to Initialize adlm:

 

Internal Error Message: <Error initializing the usage tracking component.>

Error Code: <-104>

------------------------------------------------------------------------------------------------

 

Any help would be greatly appreciated.

 

Thanks in Advance,

Adarsh Jain Jinadev

 

0 Likes
1,913 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable

Sample code which causes the issue is shown below for your reference:

 

string[] files = Directory.GetFiles(@"C:\FDM\TestDrawings\", "*.dwg");
Parallel.ForEach(
files,
file => {
{
Console.WriteLine("Processing started for : {0}", file);

using (Process process = new Process()) {
process.StartInfo.WorkingDirectory =
Path.GetDirectoryName(@"C:\Program Files\Autodesk\AutoCAD 2014\accoreconsole.exe");

process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.CreateNoWindow = true;

// parameters to execute the script file
process.StartInfo.FileName =
@"C:\Program Files\Autodesk\AutoCAD 2014\accoreconsole.exe";

process.StartInfo.Arguments = string.Empty;

// run it!
process.Start();
StreamReader outputStream = process.StandardOutput;
string output = outputStream.ReadToEnd();
output = output.Replace("\0", string.Empty);
outputStream.Close();
}
Console.WriteLine("Processing ended for : {0}", file);
}
});

 

 

Thanks and regards,

Adarsh Jain Jinadev

0 Likes
Message 3 of 11

SENL1362
Advisor
Advisor

To my knowledge you can start a max of 2 AutoCAD processes using one license.

 

 

http://www.cadforum.cz/cadforum_en/qaID.asp?tip=5327

On the same PC, you can run at same time (concurrently) up to 32 local AutoCAD licenses.

 

0 Likes
Message 4 of 11

Anonymous
Not applicable

Thanks for the answer. I am able to run 2 instances of AccoreConsole.exe in parallel.

 

I could execute more than 2 instances of acad.exe in parallel, winout any license issue.

 

Is the license limitation only for accoreconsole process?

0 Likes
Message 5 of 11

SENL1362
Advisor
Advisor
I don't know.
According to the CadForum limited to 32 instances of Acad presumable also for the Console version.
0 Likes
Message 6 of 11

dgorsman
Consultant
Consultant

I have to question the contents of that link, such as they are.  Nothing more than a single sentence, no references, no links, nothing to support or corroborate the statement.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 7 of 11

_gile
Consultant
Consultant

Hi,

 

It seems to me that without calling WaitForExit() on each started process, your code try to start simultaneously as many process as they're file in the fles collection (it will be the same with 'simple' foreach loop).



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 8 of 11

Anonymous
Not applicable

I have my original code with WaitForExit(5000); 

Still i get the license issue if i start more than 2 processes in parallel.

0 Likes
Message 9 of 11

_gile
Consultant
Consultant

One other thing, it looks like you start accoreconsole processes but do not run any command or script:

process.StartInfo.Arguments = string.Empty;


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 10 of 11

Anonymous
Not applicable

Could any body answer how to install 2 AutoCAD standalone licenses on the same computer?

0 Likes
Message 11 of 11

Anonymous
Not applicable

To avoid licence problems, why don't you just parallelize two (or more) tasks inside a single AcCoreConsole?

 

Something like:

 

Parallel.Invoke(() => { CheckDwg(filelist1); },
                () => { CheckDwg(filelist2); }
);

Inside CheskDwg() you can use Database.ReadDwgFile() function to read dwg content and do whatever you need.

You can make some tests and verify the speed gain you got with two, three or four parallel tasks...

 

0 Likes