entmake - why "too few argumen
Why "too few arguments"?(defun c:mci (cp)(setq cp (getpoint "\nCenter point:"))(entmake (list(cons 0 "CIRCLE");;Entity(cons 62 5);;Color(cons 10 cp);;Center point(cons 40 2);;Radius))(princ)) (defun c:mci (/ cp) You defined function as it requires argument (cp) and c:mci is defined as command function so you can't supply that argument, for as soon as you execute it in standard way like any other command with Command: mci, no argument is passed to function... So change line (defun c:mci (cp) to (defun c:mci ( / cp ) as like you've written later in function parameter cp is variable user supplies while function runs... So cp isn't argument but variable that needs to be localized... I believe you were looking to localize the variables, not to have an argument (also, not valid for commands, only for functions):
(defun c:mci ( / cp)... Thank you both. I appreciate your explanation. In addition to the above suggestions, you can also marginally improve the efficiency of your code by quoting expressions which need not be evaluated, e.g.:
(defun c:mci ( / cp zv ) (setq zv (trans '(0.0 0.0 1.0) 1 0 t)) ;; WCS Extrusion vector of UCS plane (if (setq cp (getpoint "\nCenter: ")) ;; Center point in UCS (entmake (list '(00 . "CIRCLE") ;; Entity Type '(62 . 5) ;; Colour (cons 10 (trans cp 1 zv)) ;; Center point in OCS '(40 . 2.0) ;; Radius (cons 210 zv) ;; Extrusion Vector in WCS ) ) ) (princ))I have also ensured the program will perform correctly in all UCS construction planes.
Lee, as always, efficient and master.
I appreciate that. You're very welcome teknomatika.
页:
[1]