-PLOT does not work in Core Console 2021 accoreconsole.exe

-PLOT does not work in Core Console 2021 accoreconsole.exe

ODO18
Advocate Advocate
2,287 Views
12 Replies
Message 1 of 13

-PLOT does not work in Core Console 2021 accoreconsole.exe

ODO18
Advocate
Advocate

I have a bunch of files I am trying to reset their plot settings because I get an error "unrecognized version and cannot be read" upon startup because there is an error in the code.  To "solve" this I just need to batch script all the files to change the plot settings to not be none, specifically the plot styles.  However I cannot run the script, in ScriptPro 2.0, with the acad.exe because it will open the file and require me to click OK to the error first before running the script.  So running it in accoreconsole.exe allows me to bypass the error prompt.  The issue is -PLOT does not seem to be recognized as I get a  "U n k n o w n c o m m a n d " - _ P L O T " . P r e s s F 1 f o r h e l p . " in the file report and the script is not completed.  Below is the script I am using along with a DXF export because I am also trying to clean the files:

 

_.FILEDIA 0
-_PLOT
_Y
MODEL
DWG TO PDF
ANSI A (11.00 X 8.50 INCHES)
_INCHES
_PORTRAIT
_NO
_DISPLAY
_1:1
_0.00,0.00
_YES
BALZER SHADE
_YES
_A

_Y
_N
_.DXFOUT

_VERSION
_2010
16
_.FILEDIA 1
_.QUIT

 

Doing the batch scripting in ScriptPro 2.0 and ACAD is version R.118.0.0 AutoCAD 2021.1

Attached is the _cl.dwg error file.

 

In this link, https://www.keanw.com/2012/03/commands-that-work-in-the-autocad-2013-core-console.html,they say -PLOT is recognized in the console, so I do not know why this is not working.

 

NOTE: For those interested.  I put "solve" in quotation marks because it is not a true solution because if I go back in the file and change the plot settings to none then I will get the error again.  I am not sure if this is the root of the error but if I look at a non-error and error file side by side in notepad (after converting to dxf) then I get different ACAD_PLOTSETTINGS.  The non-error file has 350; 39; and 3 whereas the error one has 350; 3C; and 3.  However if I change the error one from 3C to 39 and try to open it I get an error.

0 Likes
Accepted solutions (4)
2,288 Views
12 Replies
Replies (12)
Message 2 of 13

JTBWorld
Advisor
Advisor
Accepted solution

Can you try run accoreconsole.exe manually and run the commands in the script to see what happens? 

 

As you want to set plot settings you might find use of the code here

 


Jimmy Bergmark
JTB World - Software development and consulting for CAD and license usage reports
https://jtbworld.com

0 Likes
Message 3 of 13

JTBWorld
Advisor
Advisor

You can't use -_PLOT, use _-PLOT. 


Jimmy Bergmark
JTB World - Software development and consulting for CAD and license usage reports
https://jtbworld.com

0 Likes
Message 4 of 13

ODO18
Advocate
Advocate

either one works in autocad or the core console.  but yes apparently I have dyslexia.

0 Likes
Message 5 of 13

ODO18
Advocate
Advocate

Thank you did not realize I could run it separately.  That is very useful for testing.  Unfortunately the code works perfectly if I open the .exe and run it.  It seems to just not work in the ScriptPro.exe.

0 Likes
Message 6 of 13

Sea-Haven
Mentor
Mentor
Accepted solution

Like Jtbworld look up about using _ - and . in commands may help in future.

0 Likes
Message 7 of 13

ODO18
Advocate
Advocate

Thank you all for the suggestions as it has helped me better understand what I am doing.  I am spinning my wheels on this one (I have not added the -Plot part back in yet).  This works fine when I run accoreconsole 2021 manually, but fails in ScriptPro.  Should I maybe be using something other than ScriptPro?  Are batch files better?

 

What this script is doing is running -purge, audit, and -exportoautocad on proxy files and saving them back to the original file location and name.  The setq in the beginning captures the file name in a .txt file that is later referenced for the -exporttoautocad command.  I +saveas the file to dxf so that there are no write issues due to the .dwg being open, and then I copy the contents of the file to a clean template file to ensure the smallest file size.  I then CLOSEALL which the Core Console (manually) prompts me that it resaves the open .dxf but it does not seem to actually do that and then the new drawing does not even prompt that it closed. 

 

Script is (I got rid of all "_" and "." to ensure best chance of no error):

FILEDIA 0
(setq ftkeepname (open "c:\\users\\*userprofile*\\Documents\\ScriptPro\\Filename.txt" "w"))
(write-line (strcat (getvar "dwgprefix") (getvar "dwgname")) ftkeepname)
(close ftkeepname)
+SAVEAS
DXF
2018

16

COPYBASE 0,0,0 ALL

QNEW
PASTECLIP 0,0
ZOOM EXTENTS
-PURGE
A * N

Z

E

R * N

O
AUDIT YES
(setq ftkeepname (open "c:\\users\\*userprofile*\\Documents\\ScriptPro\\Filename.txt" "r"))
(command "-EXPORTTOAUTOCAD" "FORMAT" "2018" "BIND" "YES" "TYPE" "INSERT" "MAINTAIN" "YES" "PREFIX" "." "SUFFIX" "." "" (read-line ftkeepname) "YES")
(close ftkeepname)
FILEDIA 1
CLOSEALL

 

The error I get is this


------------------------------------------------------------------------------
------------------------------------------------------------------------------
Project file: C:\Users\*userprofile*\Documents\ScriptPro\Settings.bpl
Drawing file: C:\Users\*userprofile*\Desktop\COGO\_cl.dwg

Processed by Computer: *computername*

User name : *userprofile*

[ Status summary ]
Failed


Error while reading log file for C:\Users\*userprofile*\Desktop\COGO\_cl.dwg

 

Also if you have any idea why %userprofile%\\documents... will not work in replace of c:\\users\\*userprofile* (insert your actual *username* here) then please let me know.  I tried many different ways recommended online but nothing seems to work.

0 Likes
Message 8 of 13

JTBWorld
Advisor
Advisor
Accepted solution

You need to use (getvar "LOGINNAME") like this:

(strcat "c:\\users\\" (getvar "LOGINNAME") "\\Documents\\ScriptPro\\Filename.txt")

 

You can also use our scripting app JTB SmartBatch if you like. 


Jimmy Bergmark
JTB World - Software development and consulting for CAD and license usage reports
https://jtbworld.com

0 Likes
Message 9 of 13

maratovich
Advisor
Advisor

@ODO18  написал (-а):

 Should I maybe be using something other than ScriptPro?  Are batch files better?

Maybe this will help you - AutoRunLisp 

 

 

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
0 Likes
Message 10 of 13

ODO18
Advocate
Advocate
Accepted solution

All of these solutions helped me greatly in dissecting my script. What I will say is I found running a batch file to run the script the most helpful. The script I finished with still will not run in ScriptPro, but runs in batch just fine. But what I liked about batch (using the Core Console .exe) is that it will stop when it runs into an issue and then you can read it to see where the hang up is.

Depending on how severe the issue may be, it may run the whole way through and not give you an option to see it because it will not stop. In these situations I just print screened or clipped the script when it was running and could catch the error.

I should also mention my initial post was about -Plot and I still have not resolved that one, but do not need it now so I will post my solution if I go back to that one. What I can say is when adding it to a batch I find the error in the script is when it gets to the .pc3 file input. It reads the input as "DWG TO PDF ANSI A (11.00 X 8.50 INCHES)" and not just "dwg to pdf". I tried quotes, adding .pc3 at end, but neither worked.
-_PLOT
_Y
MODEL
DWG TO PDF
ANSI A (11.00 X 8.50 INCHES)

0 Likes
Message 11 of 13

JTBWorld
Advisor
Advisor

You still use -_PLOT. 

You can't use -_PLOT, use _-PLOT. 


Jimmy Bergmark
JTB World - Software development and consulting for CAD and license usage reports
https://jtbworld.com

0 Likes
Message 12 of 13

ODO18
Advocate
Advocate
Yes sorry that was old script. I took the underscore out completely on the last test I ran. In the test -Plot ran just fine but when it got to the .pc3 input instead of reading DWG TO PDF and then enter it read DWG TO PDF ANSI... and all of the rest of the command inputs as one long .pc3 file name. I even tried "DWG TO PDF" and "DWG TO PDF.pc3" and neither worked. It just would not execute the enter space after the input.
0 Likes
Message 13 of 13

ODO18
Advocate
Advocate

I should also mention that I gave up on the code above where I would do a .QNEW and paste the contents of the old file into a new template file.  QNEW would not work in CoreConsole at all.  It would fail every time.  If I ran the script manually in CoreConsole it would work just fine.  But running through batch (and ScriptPro) it would fail.  And the QNEW script works just fine running batch to acad.exe.

0 Likes