Jump to content

Self thought newbie


_Ricardo

Recommended Posts

Hi,

As you see I'm new here. please bear with me.

I'm a self thought AutoCAD user and been working with it for a little while but never got the LISP part of it. Can anyone recommend me a good book or tutorial to get start on it please?

Thanks!

:)

 

PS. I've been browsing around this forums... and I love them!

Link to comment
Share on other sites

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    9

  • dawn

    4

  • Se7en

    3

  • _Ricardo

    2

Top Posters In This Topic

Welcome to the forums, _Ricardo.

 

I'm going to assume you meant you are self-taught with AutoCAD, but I can understand why Lisps might seem confusing at first go (it's a whole 'nother language after all!). There's quite a few around here who'll be happy to critique your work and offer some pointers, but for tutorials I think most here would point you towards AfraLisp.

Link to comment
Share on other sites

Hi _Ricardo,

 

I would also suggest setting yourself an objective, maybe a routine that you can work towards creating. There is a great sense of achievement when you first create a program from start to finish

 

In my opinion this forum is one of the best resources for programming. I find it very helpful reading and trying to understand code that other members post. You will be surprised by how much you can pick up that way

 

I found the world of LISP programming a little daunting to start off with but a bit of perseverance is well worth it

 

Regards,

 

Jammie

Link to comment
Share on other sites

I would echo all of the above posts and maybe add a little extra advice :)

 

I started not too long ago, and, at first it was pretty daunting work - but you can learn a great deal just from dissecting existing LISP routines, and learning from the methods used.

 

As others have said, I would start with websites like:

 

as a starting tutorial, so that you can learn the basics to putting together a good LISP program.

 

In the actual creation of the LISP programs, I would recommend that you use the Visual LISP Editor provided with ACAD (just type VLIDE at the command line), as this not only provides essential colour coding, but also a great developer's guide help manual - well worth a read!

 

On top of all this, I normally keep a few "reference" websites at hand:

 

These come in handy for quickly looking things up!

 

 

As a starter, depending on how competent you already are, I would definitely recommend working through the "Hello World!" Tutorial that is provided in most tutorial sites - it may be basic, but it gives you a great starter.

 

If you ever have any questions regarding the programming, no matter how stupid the question may seem, just post it on here, and no doubt you'll get an answer in minutes - there's normally someone on here with nothing else to do... :P

 

 

Hope all this helps,

 

Cheers

 

Lee

Link to comment
Share on other sites

I'm being dead serious so bear with me; this is a link to a general programing 101 book you should read if you want to learn, really learn AutoLisp. This book uses a language called Scheme but AutoLisp is a cousin of Scheme so you will be able to jump right into AutoLisp with no problems.

 

[ http://mitpress.mit.edu/sicp/full-text/book/book.html ]

 

I'm all for going to places like Afralisp to get your feet wet so to speak but you need to know that those places will not TEACH you AutoLisp.

 

Dont get me wrong; I knew Kenny when i was on `VBDesign' and he was a hilarious, nice, great guy and too i started out by reading and studding Afralisp but i also took it upon myself to stop and take the time to read and study that book. It is my desk reference for almost all the programing i do in AutoLisp.

 

Read that book and come play with the big boys.

 

To drive my point home:

I too dissect code and study every aspect i dont understand. I started doing this right away and in the beginning i had to look at every line, every process. However after i read that book i can look at chunks of code and KNOW how to make it better, faster, and more efficient. ...I KNOW what the differences are for using `MAPCAR' and `MAPCAR - LAMBDA' is and what it would do to your computer's memory without running any benchmarks or writing any code.

 

Ok, I think I made my point. Go get the book save yourself a huge amount of time. I know it may not seem like it (reading a book), but I guarantee that if you dont, a year from now you will be asking us what `MAPCAR-LAMBDA' means or how to use it--I know you will because every explanation I see of `MAPCAR-LAMBDA' is technically wrong or just incomplete-. So take a month or two and read the book and you will be telling US what `MAPCAR-LAMBDA' is.

Link to comment
Share on other sites

So true - mapcar, lambda flumoxed me until a few months ago :P

 

*lol*

 

And now that you do know, the "what is mapcar-lambda" discussions seem absurd dont they?

 

And then, if we were to go on to discuss what MAPCAR is -i.e.:

(defun map-car ( process aList )
 (if (null aList)
   nil
   (cons (process (car aList))
         (map-car process (cdr aList)))) )

 

The discussion would seem all that more crazy wouldn't it?

 

Anyways, i'll stop my ranting now. Next time i start ranting like this, just tell me to shut it. *lol*

Link to comment
Share on other sites

Se7en, sorry to critisize, but wouldn't your posted code for map-car just make a list of the process involved with a length equal to the length of the list supplied?

Link to comment
Share on other sites

No need to appoligise, i enjoy academic discussions!

At first but the list get evaluated during the backtrace. There is quite a bit more to this discussion then i care to in this thread (we are kinda off topic). I'll send ya a PM.

Link to comment
Share on other sites

Hi all,

I am new to the forums and am looking for a LISP routine that will draw POINTS from a .txt or .csv file. Seems simple enough although the lisp that I learned in school years ago is not coming back to me know as I havent used it since.

I checked out some of the sites mentioned above and all ringing bells but just wondering if I can take the lazy way and ask the experts here.

 

I am using Map 3D and Civil 3D - Beginning with a .dwg with text objects that I want as ACAD POINT objects at the text insert x,y,z. After some manipulation, I have the information I need extracted from the text objects but have run into problems getting that z value input back in the the basic ACAD POINT. The AECC_COGO_POINTS don't seem to be helping for what I need.

 

Any help and suggestions?

 

Thanks

:(

Link to comment
Share on other sites

Sounds like you have two requests there -

 

How I understand it (correct me if I am wrong!):

 

  1. Create ACAD Points from a txt file.
  2. Create ACAD Points from the insertion point of text objects.

Both tasks seem reasonable and shouldn't be a problem with LISP

 

Correct me if I have any information that is wrong, and I shall see what I can do :)

 

Lee

Link to comment
Share on other sites

Perhaps this? (written quickly and untested though!)

 

(defun c:pts (/ *error* vlst ovar chdef ans file ofile pt ss elst)
 (defun *error* (msg)
   (if ovar (mapcar 'setvar vlst ovar))
   (princ (strcat "\n<!> Error: " (strcase msg) " <!>")) (princ))
 (setq vlst '("CMDECHO") ovar (mapcar 'getvar vlst))
 (setvar "CMDECHO" 0)
 (or chdef (setq chdef "File")) (initget "File Text")
 (setq ans (getkword (strcat "\nGet Point from File or Text? <" chdef "> : ")))
 (if ans (setq chdef ans) (setq ans chdef))
 (if (and (eq ans "File")
      (setq file (getfiled "Select a Text File" "" "txt" ))
   (progn
     (setq ofile (open file "R"))
     (while (setq pt (read-line ofile))
   (command "_POINT" pt))
     (close ofile))
   (progn
     (if (setq ss (ssget "X" (list (cons 0 "*TEXT")
       (if (getvar "CTAB")(cons 410 (getvar "CTAB"))
             (cons 67 (- 1 (getvar "TILEMODE")))))))
   (progn
     (setq elst (mapcar '(lambda (x) (cdr (assoc 10 x)))
                (mapcar 'entget (mapcar 'cadr (ssnamex ss)))))
     (foreach pt elst (command "_POINT" pt)))
   (princ "\n<!> No Text Found or no File Selected <!>"))))
 (mapcar 'setvar vlst ovar)
 (princ))

 

PS, might want to get a mod to move this part of the thread into a new thread instead of hi-jacking this thread. :)

Link to comment
Share on other sites

Thanks for the response Lee.

I couldn't figure out how to post the new thread - sorry not hi-jacking on purpose.

 

I have a txt file with the x,y,z lines that I would like to insert as ACAD POINTS. I tried the code you posted and am coming up with an error and have not the ability to troubleshoot that.

 

The values in the .txt file I have I extracted from the ACAD TEXT objects that I would like to be points...... if that helps?

 

Thanks for your help!

Dawn

Link to comment
Share on other sites

I think I may have mis-interpreted your requests - I have made the LISP so that it will either ask for a text file, in which the points are listed as:

 

12,1,31 etc etc

 

OR, look for text objects for which the insertion point is to be used as the ACAD point.

 

What error is appearing?

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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