Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
lisp newbie - comments please
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: lisp newbie - comments please (Read 1746 times)
0 Members and 1 Guest are viewing this topic.
surveyor_randy
Guest
lisp newbie - comments please
«
on:
April 17, 2008, 10:35:57 AM »
I'm a VB programmer and never really paid much attention to lisp until I found this forum. It seems like a lot can be accomplished without having to anything other then lisp. Here is my first attempt at a program. It is very basic and just converts decimal degrees into DMS format. I'm trying to learn as much as possible as quickly as possible. Is there a better way to have written this piece of code? Thanks for any comments.
(defun c:dms (/ ddeg)
(setq ddeg(getreal "\nEnter angle in DDegrees:"))
(princ "\n")
(princ (fix ddeg))(princ "°")
(princ (fix (* 60 (- ddeg (fix ddeg)))))(princ "'")
(princ (* 60 (- (* 60 (- ddeg (fix ddeg))) (fix (* 60 (- ddeg (fix ddeg)))))))(princ "\"")(terpri)
(prin1)
)
Logged
T.Willey
Needs a day job
Posts: 5251
Re: lisp newbie - comments please
«
Reply #1 on:
April 17, 2008, 10:50:31 AM »
This will do the same thing, I think.
(angtos (getangle "\n Enter angle in Degrees: ") 1 4)
Logged
Tim
I don't want to ' end-up ', I want to ' become '. - Me
Please think about donating if this post helped you.
CAB
Global Moderator
Seagull
Posts: 10401
Re: lisp newbie - comments please
«
Reply #2 on:
April 17, 2008, 11:07:47 AM »
Glad you have taken an interest in LISP.
You can accomplish so much with very little code.
Look at Angtos, Rtos, Distof, they all use the MODE to determine the format of the return value.
Keep an eye on Tim's post you'll learn a lot.
Logged
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.
surveyor_randy
Guest
Re: lisp newbie - comments please
«
Reply #3 on:
April 17, 2008, 03:53:15 PM »
Thanks for the comments fellas... I had no idea that there was already a command built in for doing that particular conversion.
Should I be spending my time learning AutoLisp or VisualLisp? opinions please...
Logged
Keith™
Villiage Idiot
Seagull
Posts: 16899
Superior Stupidity at its best
WWW
Re: lisp newbie - comments please
«
Reply #4 on:
April 17, 2008, 03:59:48 PM »
yes and yes ... both have their strong points .. simply put you cannot do anything in VLisp without using some lisp ... lisp is simpler to use in many instances and given enough knowledge, you can quickly develop a solution for a nagging problem .. expand a menu item effectiveness or just do a simple calculation.
Logged
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal
Find me on
https://parler.com
@kblackie
CAB
Global Moderator
Seagull
Posts: 10401
Re: lisp newbie - comments please
«
Reply #5 on:
April 17, 2008, 04:29:00 PM »
Learn Plain Lisp first, it's easier IMO, and is a foundation for Visual Lisp.
Logged
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.
daron
Guest
Re: lisp newbie - comments please
«
Reply #6 on:
April 17, 2008, 06:34:55 PM »
Then Vlisp is mostly VBA in reverse and without the need to declare variables before you use them.
Logged
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
lisp newbie - comments please