Jump to content
teknomatika

entmake - why "too few arguments"

Recommended Posts

teknomatika

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)
)

Share this post


Link to post
Share on other sites
Tharwat

:)

(defun c:mci ([color=blue][b]/[/b][/color] cp)

Share this post


Link to post
Share on other sites
marko_ribar

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...

Share this post


Link to post
Share on other sites
MSasu

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)
...

Share this post


Link to post
Share on other sites
teknomatika

Thank you both. I appreciate your explanation.:)

Share this post


Link to post
Share on other sites
Lee Mac

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.

Share this post


Link to post
Share on other sites
teknomatika
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.

Share this post


Link to post
Share on other sites
Lee Mac

You're very welcome teknomatika.

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...