Set FileDia doesn't work in accoreconsole ( with specific argument)

Set FileDia doesn't work in accoreconsole ( with specific argument)

soonhui
Advisor Advisor
933 Views
14 Replies
Message 1 of 15

Set FileDia doesn't work in accoreconsole ( with specific argument)

soonhui
Advisor
Advisor

This is my bat file

 

call "%acadDir%\accoreconsole.exe" /ld "%acadDir%\AecBase.dbx" /p "<<C3D_Metric>>" /product C3D /s "%acadScriptDir%\SetFileDia.scr"

 

As you note, I am using accoreconsole, and I don't pass in an ACAD drawing in the command line argument, and this is my .scr file content

 

(setvar "filedia" 1)

I just set FileDia to 1. Because accoreconsole will always set FileDIa=0 at the beginning of the run, so I need to set it back.

 

However, the above script doesn't work. FileDia is still 0 when I check in ACAD.exe ( the UI).

 

Maybe it will work if I pass in a drawing( even a dummy one will do?), but this is definitely not expected because I don't usually have a drawing to begin with when using accoreconsole.

##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
0 Likes
Accepted solutions (2)
934 Views
14 Replies
Replies (14)
Message 2 of 15

khodulieucuong
Contributor
Contributor

accoreconsole.exe has no GUI engine (no window, no message pump). All dialog-creating functions (StartDialog, FileDialog, etc.) are completely disabled.

0 Likes
Message 3 of 15

soonhui
Advisor
Advisor

But filedia has no dialog box; it's just a system variable

##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
0 Likes
Message 4 of 15

ActivistInvestor
Mentor
Mentor

If it's being set to 0, then it's most-likely because there is no file dialog available.

 

Additionally, core console was intended to be driven by scripting, not used interactively, but trying to mix both interactive and scripted use is probably not going to work out well. You can try using .NET file selection dialogs, and I can't say if that'll work as I've never tried it.

0 Likes
Message 5 of 15

norman.yuan
Mentor
Mentor

@soonhui 

It is not very clear to me why you need to worry about FILEDIA when using core console. Are you saying that after running core console in your computer and then start AutoCAD desktop, the FILEDIA of that AutoCAD session becomes 0? In my experience that does not happen. There is simply no need to worry about FILEDIA in the core console at all. FILEDIA is stored in Windows registry (HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\Rxxx\ACAD-xxxx.xxx\FixedProfile\General Configuration\FileDialog), you can check this key's value right before and after you use the core console, to see if it gets changed.

 

Is there particular reasons that you have to open a drawing or drawings with code that runs with core console, as opposed to open the drawing as core console's startup argument? if you try to let single core console session process multiple drawings (batch processing), then that is wrong way to do the work. It should be one drawing per core console instance; that is, start a core console instance with one drawing, do the work, and then quit the core console. This way, if you need to do batch drawing processing, you can spawn multiple core console instances in parallel, taking advantage of modern computer's multi-core CPUs power to get the batch work done much faster.

Norman Yuan

Drive CAD With Code

EESignature

Message 6 of 15

soonhui
Advisor
Advisor

Are you saying that after running core console in your computer and then start AutoCAD desktop, the FILEDIA of that AutoCAD session becomes 0? In my experience that does not happen

 

Exactly, this is precisely what happened. The registry HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\Rxxx\ACAD-xxxx.xxx\FixedProfile\General Configuration\FileDialog is still 0 when I finish running accoreconsole. 

 

As for opening drawing thingy in accoreconsole, it's not that I want to open a drawing in accoreconsole ( in fact, I don't), it's just that I read somewhere somehow the FileDia system variable will change to 1 if accoreconsole is paired with a drawing path command ( not sure how true it is). But this is really besides the point.

 

The real point is, the (set FileDia 1) won't work when I call it from accoreconsole as per the above. 

##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
0 Likes
Message 7 of 15

norman.yuan
Mentor
Mentor

Well, as I said, from my experience, core console setting FILEDIA to 0 does not affect the FILEDIA value in the desktop session. See the video clip here that recorded my quick test:

1. Verify the FILEDIA in registry is 1;

2. Start core console instance, and then check the value in registry: it becomes 0;

3. Do something (or not do anything) in the core console; then quit the core console;

4. Check the FILEDIA value in the registry: it turns back to its original value (1).

 

(view in My Videos)

 

In your case, if the FILEDIA in the registry is not restored, are you sure you close the core console correctly (i.e. execute command "QUIT", assuming you did not call Process.Kill() to end the core console process)?

 

 

 

 

 

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 8 of 15

soonhui
Advisor
Advisor

@norman.yuan  now I see where you are coming from; essentially you are still interacting with ACAD, but via accoreconsole.

 

But in my case it's different, I'm just passing in a scr file to accoreconsole for it to run oneshot (no user interaction at all, be it at command line or the UI) and despite that I do set the filedia to 1 in the scr script, the setting simply isn't effective.

 

I've stripped down everything to the very minimum, this is my batch file ( .bat) 

 

call "%acadDir%\accoreconsole.exe" /ld "%acadDir%\AecBase.dbx" /p "<<C3D_Metric>>" /product C3D /s "%acadScriptDir%\SetFileDia.scr"

 

and the content of SetFileDia.scr file

 

(setvar "filedia" 1)

 

You may want to try my above reproduction steps and see?

##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
0 Likes
Message 9 of 15

norman.yuan
Mentor
Mentor

The core console being started manually (as showed in my video clip), or started by code/BAT command would not make difference, I'd say. You may want to verify it with your scrip, in which you DO NOT try to set FILEDIA, and somehow pause the core console. Then, you can examine the registry for the FILEDIA value; then let your script go ahead and quit core console properly; examine the registry again to see if it is restored (of course, you want to make sure the original value is 1.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 10 of 15

soonhui
Advisor
Advisor
Accepted solution

Interesting; putting a QUIT statement after the setvar seem to solve the issue

 

(setvar "filedia" 1)
QUIT
##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
0 Likes
Message 11 of 15

norman.yuan
Mentor
Mentor
Accepted solution

That was I suspected: the core console instance may not be ended properly for it to have chance to reset the FILEDIA. I mean, there is no need to set FILEDIA in the script. See the end of my reply in message 7.

 

 

Norman Yuan

Drive CAD With Code

EESignature

Message 12 of 15

moogalm
Autodesk Support
Autodesk Support

Another idea is to use a separate profile for your automation workloads so it doesn’t interfere with your other profiles.
You can start from C3D_METRIC, save it as "Automation", and then import that profile.

D:\Dev\29756>"D:\Acad\AutoCAD 2025\accoreconsole.exe" /p Automation /s D:\Dev\29756\run.scr
Redirect stdout (file: C:\Users\moogalm\AppData\Local\Temp\accc398442).
AcCoreConsole: StdOutConsoleMode: processed-output: enabled,auto
AutoCAD Core Engine Console - Copyright 2024 Autodesk, Inc.  All rights reserved. (V.171.0.0)

Execution Path:
D:\Acad\AutoCAD 2025\accoreconsole.exe
Current Directory: D:\Dev\29756

Version Number: V.171.0.0 (UNICODE)
LogFilePath has been set to the working folder.
Regenerating model.

**** System Variable Changed ****
1 of the monitored system variables has changed from the preferred value. Use SYSVARMONITOR command to view changes.


AutoCAD menu utilities loaded.
Command:
Command:

Command:
Command: (getvar "CPROFILE")
"Automation"

Command: (print "Hello World")

"Hello World" "Hello World"

Command: (setvar "FILEDIA" 1)
1

Command: QUIT
**** No System Variable Changed ****QUIT
QUIT



0 Likes
Message 13 of 15

soonhui
Advisor
Advisor

@moogalm , but using a separate profile requires me to create and store separate profiles which will eat up a few Giga byte of space, right?

##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
0 Likes
Message 14 of 15

JamesMaeding
Advisor
Advisor

@soonhui 

No, profiles are likely 10 mb or less. Its some registry entries, and a small .aws text file.

As a rule, I use a different profile for coreconsole runs, as you cannot use lisp code with com calls in it, and my normal profile has all kinds of that in its acaddoc.lsp.

You could add conditional statements to your startup to avoid that, but there are other things I do different for cc runs like excluding the company toolset paths.

I kind of strip it down, but still leave in resources like fonts and pc3 folders.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 15 of 15

soonhui
Advisor
Advisor

@JamesMaeding , can you point me to where I can do the setup new profile thing? 

Or is it just as simple as duplicating the related registry key ( such as <<C3D_Metric>>?

##########

Ngu Soon Hui

##########

I'm the Benevolent Dictator for Life for MiTS Software. Read more here


I also setup Civil WHIZ in order to share what I learnt about Civil 3D
0 Likes