PDA

View Full Version : error: too many arguments??


tedg
2008-07-24, 04:36 PM
Ok, this is stupid, simple routine I'm trying to write so I can quickly override a dimension style to change picked dimensions to a leader style with the text centered and then reset to the previous dimstyle settings.

It kind of works but I get; "error: too many arguments" so it doesn't reset the variables I've changed, I don't see the problem, I thought I followed the autolisp rules :p.

I tried two different ways but with the same results:

(defun c:dml (/ dt dm ss)
(setq dt (getvar "dimtad"))
(setq dm (getvar "dimtmove"))
(setq ss (ssget))
(setvar "dimtad" 0)
(setvar "dimtmove" 1)
(command "-dimstyle" "apply" ss "")
(setvar "dimtad" dt "")
(setvar "dimtmove" dm "")
(princ)
)
..Or..

(defun c:dmll (/ dt dm ss)
(setq dt (getvar "dimtad"))
(setq dm (getvar "dimtmove"))
(setq ss (ssget))
(setvar "dimtad" 0)
(setvar "dimtmove" 1)
(command "dim" "update" ss "" "exit")
(setvar "dimtad" dt "")
(setvar "dimtmove" dm "")
(princ)
)

So if someone can look at them and let me know where the issue is I'd appreciate it.
Also, if someone has a cleaner way to do this, let me know, I'm open to suggestions.

Thanks

miff
2008-07-24, 05:49 PM
(setvar "dimtad" dt "")
You are using the lisp function SETVAR, not the command, so no "" is needed...
(setvar "dimtad" dt)
Same with the next one, too.

tedg
2008-07-24, 05:52 PM
(setvar "dimtad" dt "")
You are using the lisp function SETVAR, not the command, so no "" is needed...
(setvar "dimtad" dt)
Same with the next one, too.
Thank You!!
Works great now.
:beer: