AcCoreConsole gives "command not found" error in a script that runs in AutoCAD

AcCoreConsole gives "command not found" error in a script that runs in AutoCAD

Anonymous
Not applicable
3,212 Views
15 Replies
Message 1 of 16

AcCoreConsole gives "command not found" error in a script that runs in AutoCAD

Anonymous
Not applicable

I need to process a whole bunch of DWG drawings. First, i need to BURST all the blocks that are on them, and then export it to DXF format.

 

So, what I did is, I wrote a very small script:

(load "BURST")
BURST
ALL

_dxfout
16

and also found and modified a BAT file that some kind soul wrote here on the forum to run this script on the drawings folder:

FOR %%f IN ("C:\Users\plxru_user\Desktop\burst_test\*.dwg") DO "C:\Program Files\Autodesk\AutoCAD 2019\accoreconsole.exe" /i "%%f" /s "C:\Users\plxru_user\Desktop\burst_test\burst2dxf.scr" /l en-US

The script works perfectly in AutoCAD, but in ACC it throws an error message saying "Unknown command BURST. Press F1 for help."

Same thing happens when I try using custom PBURST from Lee Mac:

(load "C:\\Users\\plxru_user\\Desktop\\burst_test\\BurstUpgradedV1-7.lsp")
pburst
all

_dxfout

16

 I tried changing PBURST with (C:"BURST"), only to see another error "Unknown command ALL. Press F1 for help."

 

I have no idea about AutoLISP, scripts, etc., all I did was just slapping together the pieces that I found here on this forum.

Any advices are welcome!

0 Likes
3,213 Views
15 Replies
Replies (15)
Message 2 of 16

xuantientutungXUK6E
Advocate
Advocate

i have try some codes above before and it orcurr the same problem.

so i come up with a simple solution is add acad.lsp file.

the acad.lsp file contain  s::startup ()  code which made autocad run a dwg after it open.

so use the lisp file i attached and put your lisp in. add it on appload lisp and try open all bunch of your dwg.

after finished, you unload that lisp file if you don't need it run through every open file anymore.

0 Likes
Message 3 of 16

Anonymous
Not applicable

Thanks for your reply, but the whole idea is about modifying the drawings without actually opening the autocad, but rather running the script via ACC.

0 Likes
Message 4 of 16

_gile
Consultant
Consultant

Hi,

 

The Core Console works on the AutoCAD "Core" (accore.dll) so it only supports the commands which are defined with the AutoCAD Core (it does not support commands using features from acad.exe).

You can find a list of the commands thar work with the Core Console here.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 5 of 16

Anonymous
Not applicable

Oh wow. Thanks for the heads up.

Maybe you have any other ideas on how to effectively burst all the blocks on a set of drawings?

Right now I use script writer that creates a script to automatically open all the drawings in a given folder in AutoCAD and run whatever you need to run. It's not as effective, because you actually have to run AutoCAD to do that, but, oh well...

0 Likes
Message 6 of 16

ВeekeeCZ
Consultant
Consultant

@Anonymous wrote:
...

 I tried changing PBURST with (C:"BURST"), ...


 

I didn't try, but the correct syntax would be: (c:burst)

0 Likes
Message 7 of 16

Anonymous
Not applicable

Yup, my bad, I got it wrong in my message. But still, it gave me an error of "command not found for the "ALL" line.

0 Likes
Message 8 of 16

cadffm
Consultant
Consultant

_gile: "so it only supports the commands which are defined with the AutoCAD Core (it does not support commands using features from acad.exe).
Thats right, but you can load program extensions as well.
The statement sounded (for me as a reader) not so / knowing that I do not tell you anything new 😉

 

@Anonymous 
-

>"I have no idea about AutoLISP, scripts, etc., all I did was just slapping together the pieces that I found here on this forum."
No risc  No fun? Sorry, but then you shouldn't create batch jobs like that. my opinion

 

>"First, i need to BURST all the blocks that are on them, and then export it to DXF"
Whenever you use BURST, run a Purge command with all options first, specially for empty Texts, blocks,layers..all.


"The script works perfectly in AutoCAD, but in ACC it throws an error message saying "Unknown command BURST. "
Because the Burst program isn't loaded (Without checking it, I don't know if it can work or not).


>"I tried changing PBURST with (C:"BURST"), only to see another error "Unknown command ALL. Press F1 for help."
And thats right, "ALL" is not a valid command, or?
The command ist just NBURST / or PBURST - there are two commands defined in the *.lsp file.

What you try is ok, but the problem is: No of these two(three) commands are designed for running in accoreconsole, they can't.

You have to go another way or to find another program extension, which can load&run succesful in accoreconsole,
without the knowledge you have to test, try & error principle

Very difficult in your current situation / state of knowledge.

Sebastian

Message 9 of 16

Anonymous
Not applicable

Thanks for your detailed answer!

Well, I guess neither BURST, which i load with (LOAD "BURST"), nor PBURST are supported by ACC.

I don't really know how do I specify this ALL selection for (C:BURST) or (C:PBURST)...

0 Likes
Message 10 of 16

Anonymous
Not applicable

for most of the commands you can use "command" lisp function, like: (command "_.zoom" "_e")

0 Likes
Message 11 of 16

martti.halminen
Collaborator
Collaborator

I don't know about the BURST command specifically, but more generally, one nasty detail with AcCoreConsole (at least on 2017, I haven't tried it with newer versions): if you try to load Lisp code from a directory that is not defined in Trusted Locations in the Options dialog, ACC just quietly doesn't load it, giving no error reports about that.

 

-- 

 

0 Likes
Message 12 of 16

cadffm
Consultant
Consultant

@martti.halminen 

That is the nature of automation. The creator has to take care that all possible situations can be dealt with.

For your described case:

SecureLoad would be simply switched off for automation (to load stuff from none trustedpaths), see [F1]

 

See that logfile:

[ AutoCAD - Fri Feb 07 12:18:51 2020 ]----------------------------------------

Befehl: (getvar "TRUSTEDPATHS")
"D:\\..."

Befehl: SECURELOAD
Neuen Wert für SECURELOAD eingeben <1>: 0

Befehl: (load "Y:\\TEST.lsp")

Loaded from a path which is not incl. the trustedpaths! <- Thats my sample PRINC inside the loaded LSP file.

Befehl: _.quit

Befehl:

Sebastian

Message 13 of 16

stevenh0616
Collaborator
Collaborator

As I'm on the hunt for something else AcCoreConsole related - I decided while it's fresh in my mind I'd follow up on @cadffm's post, you absolutely should be able to use Express tools in AcCoreConsole. In your script file that you pass into AcCoreConsole, you just need to tell it to load up Express Tools as @_gile mentioned, AcCoreConsole only initially loads up the core software. Any Extensions / Add ons need to be loaded by the developer - even if it's a simple BAT file with a Script loading.

 

I'm not positive how to load up Express Tools - but I believe it would be one of the following three methods in your Script file passed into AcCoreConsole:

 

  1. Try simply calling EXPRESSTOOLS command.
  2. In the script, load the the following file (change product year as necessary)
    • "C:\Program Files\Autodesk\AutoCAD YEAR\Express\acettest.fas"
  3. In the script, load the above mentioned fas file and then call EXPRESSTOOLS command.

If none of the above work, then we aren't calling the proper file to load up Express Tools into AutoCAD. I'm going off of this AKN page:

https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/AutoC...

 

 

Further, if anyone wants to access Civil 3D, that can be done as well. I would assume the same for any of the vertical products if installed. For Civil 3D, we load the core CRX file like below - again from the Script file:

 

arx Load "C:\Program Files\Autodesk\AutoCAD 2020\C3D\AeccCoreBase.crx"

 

Once that is done, Civil 3D commands and objects can be accessed / read with AcCoreConsole.

 

 

 

Steve Hill, Civil Designer / .NET Developer / AutoCAD and AutoCAD Civil 3D Certified Professional
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

http://redtransitconsultants.com/
Autodesk Exchange Store
Twitter | LinkedIn | YouTube

0 Likes
Message 14 of 16

Sea-Haven
Mentor
Mentor

I dable at edges of acccoreconsole and there was something about no VL lisp, but you may have a way around it by loading the correct ARX for VL commands. Will try (atoms-family 0) see if can dump to file etc using acc.

0 Likes
Message 15 of 16

Sea-Haven
Mentor
Mentor

The more I tested the less I found I could do with accoreconsole, tried dumping the (atoms-family 1) to a file that did not seem to work, that would have exposed commands available. I tried creating text in a dwg for the list in normal acad that worked, but not in acc. If I remember correct vl-commands do not work which is why if can load a arx etc may help 

 

Hint Vl.arx vl.arc

 

 

Message 16 of 16

Sea-Haven
Mentor
Mentor

Ignore the other post did get commands list.

 

Bat

 

c:
cd\Program files\Autodesk\Autocad 2020
accoreconsole.exe /i  D:\Acadtemp\Drawing2.dwg  /s D:\alan\lisp\test2.scr /l en-us

 

Script

 

(setvar 'ctab "MODEL")
(load "commands.lsp")
zoom e
save 
d:\acadtemp\comms.dwg

 

lisp

 

 

(setq coms (atoms-family 1))
(setq y 100)
(foreach nam coms 
(command "text" (list 0 (setq y  (- y 3))) 2.0 0.0 nam)
)

I had the batch file wrong and as you do not see much it was hard to work out is it working, but when it does you will see lots of action.