; error: AutoCAD command rejected:

; error: AutoCAD command rejected:

JTBWorld
Advisor Advisor
1,714 Views
6 Replies
Message 1 of 7

; error: AutoCAD command rejected:

JTBWorld
Advisor
Advisor

Any idea why any AutoLISP command call is not working with attached bundle placed in any of the ApplicationPlugins folders. 

Bundle code:

<Components>
<ComponentEntry AppName="test" Version="1.0.0" ModuleName="./Contents/test.lsp"
PerDocument="True">
</ComponentEntry>
</Components>

 

All enough to trigger this is (command "erase" "").
(command-s is not working either.

 

Regenerating model.
Before; error: AutoCAD command rejected: "erase"
Before; error: AutoCAD command rejected: "erase"
Before; error: AutoCAD command rejected: "erase"
Before; error: AutoCAD command rejected: "erase"
Before; error: AutoCAD command rejected: "erase"
AutoCAD menu utilities loaded.*Cancel*
Command:


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

0 Likes
Accepted solutions (2)
1,715 Views
6 Replies
Replies (6)
Message 2 of 7

Kent1Cooper
Consultant
Consultant

Might you have something that UNDEFINEs the native ERASE command, and makes a special (defun)'d new version?  If so, it should work if you put the period prefix on the command name, to force the use of the native command:

 

(command ".erase" ...

Kent Cooper, AIA
0 Likes
Message 3 of 7

JTBWorld
Advisor
Advisor

Unfortunately not. It doesn't matter what actual command is used.

I've got the same result in AutoCAD 2014 and AutoCAD 2022 on 2 completely different systems. 


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

0 Likes
Message 4 of 7

_Tharwat
Advisor
Advisor
Accepted solution

You may get it working if you replace the function command with vl-cmdf 

Message 5 of 7

JTBWorld
Advisor
Advisor

It does work as a workaround with vl-cmdf. But why is not (command) working? 


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

0 Likes
Message 6 of 7

_Tharwat
Advisor
Advisor

I guess, perhaps the autoload bundle suites being loaded before AutoCAD loads its built-in command names and that's why the error message indicated to the rejection of the command name itself.

0 Likes
Message 7 of 7

JTBWorld
Advisor
Advisor
Accepted solution

Synchronous commands are not supported. Therefore AutoCAD will cancel any inward command until the AutoCAD application becomes stable and active.

 

Workaround is vl-cmdf as an alternative to command.

 

Another way that worked is using s::startup

 

(defun mystartup ()

(princ "\nloaded")

(command "menubar" "1")

(princ "\nended")

)

(if s::startup

(setq s::startup (append s::startup (quote ((mystartup)))))

(defun s::startup () (mystartup))

)

(princ)

 

SendStringToExecute used in a DLL will also work. 


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