broncos15 发表于 2022-7-5 18:26:46

Command vs command-s for AutoC

I created a simple code for AutoCAD 2013, that is having some issues in 2015. It will run correctly, but if I press the space bar after running the command to invoke it again, I get the response "Unknown command "Dimaligned2". I can fix this issue by using the command-s function, which doesn't make sense to me because I thought command-s couldn't be used with the "pause" command token. My code is as follows:
(defun c:dimaligned2 ( / OLDECHO) (setq OLDECHO (getvar "cmdecho")) (setvar "cmdecho" 1) (command-s "._dimaligned" pause "_perp" pause "@" pause "") (setvar "cmdecho" OLDECHO))
 
 
My original code is:
(defun c:dimaligned2 ( / OLDECHO)(setq OLDECHO (getvar "cmdecho"))(setvar "cmdecho" 1)(command "._dimaligned" pause "_perp" pause "@" pause "")(setvar "cmdecho" OLDECHO))

hmsilva 发表于 2022-7-5 18:54:39

Hi broncos15,
you have an extra 'enter' in "._dimaligned" command, try the following

(defun c:dimaligned2 ( / OLDECHO)(setq OLDECHO (getvar "cmdecho"))(setvar "cmdecho" 1)(command "._dimaligned" pause "_perp" pause "@" pause)(setvar "cmdecho" OLDECHO) (princ))
It works as expected in AC2015?
I did test the code in AC2012/4/6, I don´t have AC2015...
 
Henrique

broncos15 发表于 2022-7-5 19:23:32

That works perfectly. Man that was a stupid error by me, thanks for catching it.

hmsilva 发表于 2022-7-5 19:45:02

You're welcome, broncos15
Glad you got it working.
 
Henrique
页: [1]
查看完整版本: Command vs command-s for AutoC