| Author |
Message |
Jon
Guest
|
Posted:
Sun Jul 10, 2005 4:10 pm Post subject:
lisp loads at startup?? |
|
|
About a week ago I was playing around trying to learn a little lisp and
wrote something to draw a rectangle which I was latter going to try to make
a 3D box. I must have use 3 setq expressions for the 2D corners and the
height and used "defun C:box".
Today I revisited the file and cut it down to :
(defun C:box (/ 1st)
(command
"rectang"
(setq 1st (getpoint "\nFirst corner"))
; setq used for rubberband in second getpoint
(getpoint 1st "\nSecond corner")
)
)
However if I type "box" from the autocad command line I get asked for the
height!!!
This must be from my previous attempt. Huh???
If I change "defun C:box" to "defun C:boxa" and load it then it runs fine
and just does the rectangle.
Where is the code that still has the height variable
Why does it load by itself (maybe I've forgotten what I did with it
originally)
How can I get rid of it?
Many thanks if you can help.
Jon
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
|
|
| Back to top |
|
 |
Dr Fleau
Guest
|
Posted:
Thu Jul 21, 2005 7:31 am Post subject:
Re: lisp loads at startup?? |
|
|
True to internet form and protocol, "Jon" <posidrive@hotmail.com>
said:
-->About a week ago I was playing around trying to learn a little lisp
and
-->wrote something to draw a rectangle which I was latter going to try
to make
-->a 3D box. I must have use 3 setq expressions for the 2D corners and
the
-->height and used "defun C:box".
-->
-->Today I revisited the file and cut it down to :
-->
-->(defun C:box (/ 1st)
--> (command
--> "rectang"
--> (setq 1st (getpoint "\nFirst corner"))
--> ; setq used for rubberband in second getpoint
--> (getpoint 1st "\nSecond corner")
--> )
-->
-->
-->)
-->
I'm guessing ACAD is not executing your BOX lisp, but the internal BOX
that does a 3D box. You should never name a lisp the same as an
existing command. There are even some variable names to be wary about,
like 'T', 'nil', 'pi', and of course, any and all LISP commands, like
'setq' or 'command'. This would explain why BOXA works, but not BOX.
Power to the peephole
Dr Fleau |
|
| Back to top |
|
 |
Adesu
Joined: 20 Jul 2005
Posts: 31
|
Posted:
Fri Jul 22, 2005 2:27 am Post subject:
Re: lisp loads at startup?? |
|
|
| Jon wrote: | About a week ago I was playing around trying to learn a little lisp and
wrote something to draw a rectangle which I was latter going to try to make
a 3D box. I must have use 3 setq expressions for the 2D corners and the
height and used "defun C:box".
Today I revisited the file and cut it down to :
(defun C:box (/ 1st)
(command
"rectang"
(setq 1st (getpoint "\nFirst corner"))
; setq used for rubberband in second getpoint
(getpoint 1st "\nSecond corner")
)
)
However if I type "box" from the autocad command line I get asked for the
height!!!
This must be from my previous attempt. Huh???
If I change "defun C:box" to "defun C:boxa" and load it then it runs fine
and just does the rectangle.
Where is the code that still has the height variable
Why does it load by itself (maybe I've forgotten what I did with it
originally)
How can I get rid of it?
Many thanks if you can help.
Jon
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =---- |
Hi Jon ,you wrong create a defun and would compleceted with autocad,because autocad had a command "box".
here this code for your tutorial,and good luck
| Code: |
(defun c:bx (/ 1st 2nd hei)
(setq 1st (getpoint "\nFisrt corner<0,0,0>: "))
(if (= 1st nil)(setq 1st '(0 0 0)))
(setq 2nd (getcorner 1st "\nSecond corner<10,10,0>: "))
(if (= 2st nil)(setq 2nd '(10 10 0)))
(setq hei (getint "\nEnter height of box <5>: "))
(if (= hei nil)(setq hei 5))
(command "rectang" 1st 2nd "")
(command "extrude" (entlast) "" hei "" "")
(princ)
)
|
|
|
| Back to top |
|
 |
|
|
|
|