teknomatika Posted May 15, 2013 Posted May 15, 2013 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) ) Quote
marko_ribar Posted May 15, 2013 Posted May 15, 2013 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... Quote
MSasu Posted May 15, 2013 Posted May 15, 2013 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 ( [color=red]/[/color] cp) ... Quote
teknomatika Posted May 15, 2013 Author Posted May 15, 2013 Thank you both. I appreciate your explanation. Quote
Lee Mac Posted May 15, 2013 Posted May 15, 2013 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.: ([color=BLUE]defun[/color] c:mci ( [color=BLUE]/[/color] cp zv ) ([color=BLUE]setq[/color] zv ([color=BLUE]trans[/color] '(0.0 0.0 1.0) 1 0 [color=BLUE]t[/color])) [color=GREEN];; WCS Extrusion vector of UCS plane[/color] ([color=BLUE]if[/color] ([color=BLUE]setq[/color] cp ([color=BLUE]getpoint[/color] [color=MAROON]"\nCenter: "[/color])) [color=GREEN];; Center point in UCS[/color] ([color=BLUE]entmake[/color] ([color=BLUE]list[/color] '(00 . [color=MAROON]"CIRCLE"[/color]) [color=GREEN];; Entity Type[/color] '(62 . 5) [color=GREEN];; Colour[/color] ([color=BLUE]cons[/color] 10 ([color=BLUE]trans[/color] cp 1 zv)) [color=GREEN];; Center point in OCS[/color] '(40 . 2.0) [color=GREEN];; Radius[/color] ([color=BLUE]cons[/color] 210 zv) [color=GREEN];; Extrusion Vector in WCS[/color] ) ) ) ([color=BLUE]princ[/color]) ) I have also ensured the program will perform correctly in all UCS construction planes. Quote
teknomatika Posted May 15, 2013 Author Posted May 15, 2013 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.: ([color=BLUE]defun[/color] c:mci ( [color=BLUE]/[/color] cp zv ) ([color=BLUE]setq[/color] zv ([color=BLUE]trans[/color] '(0.0 0.0 1.0) 1 0 [color=BLUE]t[/color])) [color=GREEN];; WCS Extrusion vector of UCS plane[/color] ([color=BLUE]if[/color] ([color=BLUE]setq[/color] cp ([color=BLUE]getpoint[/color] [color=MAROON]"\nCenter: "[/color])) [color=GREEN];; Center point in UCS[/color] ([color=BLUE]entmake[/color] ([color=BLUE]list[/color] '(00 . [color=MAROON]"CIRCLE"[/color]) [color=GREEN];; Entity Type[/color] '(62 . 5) [color=GREEN];; Colour[/color] ([color=BLUE]cons[/color] 10 ([color=BLUE]trans[/color] cp 1 zv)) [color=GREEN];; Center point in OCS[/color] '(40 . 2.0) [color=GREEN];; Radius[/color] ([color=BLUE]cons[/color] 210 zv) [color=GREEN];; Extrusion Vector in WCS[/color] ) ) ) ([color=BLUE]princ[/color]) ) I have also ensured the program will perform correctly in all UCS construction planes. Lee, as always, efficient and master. I appreciate that. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.