Jump to content

Recommended Posts

Posted

Hi all,

 

Not logged on to here for a while, but hoping someone can help. My lisp knowledge is very small.

 

I have to draw alot of SLOPE arrows for land surveys. Like below (dashed lines are the bank , but it is the POLYLINE indicating the slope that I am interested in).

 

PLINEslope1.jpg

I would ulimtaely like to pick a START POINT on the bank (using nearest snap) and pick a point on the bottom of the bank END POINT.

A 3 point polyline would be produced where the width at the START POINT would be one sixth (16.66%) of the total length of the polyline.

 

If it was a LISP, I could right click and do another & another and so on.

 

See image below.

PLINEslope.jpg

At the moment I do a 3 point line and edit after using PROPERTIES. It takes ages.

 

Please help a rookie.

 

Kind regards

Al.:)

Posted

This?

 

(defun c:rookie (/ p1 p2 d)

 (while (and (setq p1 (getpoint "\nPick Start Point: "))
             (setq p2 (getpoint p1 "\nPick End Point: ")))
   
   (setq d (distance p1 p2))
   
   (entmake
     (list
       (cons 0 "LWPOLYLINE")
       (cons 100 "AcDbEntity")
       (cons 100 "AcDbPolyline")
       (cons 90 3)
       (cons 10 p1)
       (cons 40 (/ d 6.))
       (cons 41 0.)
       (cons 10 (polar p1 (angle p1 p2) (/ d 2.)))
       (cons 10 p2))))

 (princ))

Posted

OMG Lee Mac, thats amazing. :shock:

 

It works perfectly.

 

Not the first time youv'e helped me.

 

I just need to sort layer and default to nearest OSNAP, but thats just within my abilities.

 

Ta mate.

 

PS: Dont suppose you know of any good LISP tutorials / learning resources?

Posted

Hey Coombsie, Glad its what you wanted :)

 

As for LISP learning resources...

 

I always think the best way to learn is to look at other peoples examples and dissect them until you understand exactly what each line is doing and why each line is needed (just make sure you dissect some "correct" code!) :)

 

As for tutorials, here is my link collection:

 

Starting LISP:

 

http://www.cadtutor.net/forum/showthread.php?t=38760

 

http://www.cadtutor.net/forum/showthread.php?t=38734

 

http://www.afralisp.net/

 

http://www.jefferypsanders.com/autolisptut.html

 

http://ronleigh.info/autolisp/index.htm

 

 

More Advanced LISP Tutorials:

 

http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-4.html

 

http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/clm/node1.html

Posted

One more:

 

Explanation of a LISP function (Text replacement):

 

http://www.cadtutor.net/forum/showpost.php?p=264546&postcount=15

Posted

Once again - many thanks..:star:

 

Will check out the links and hopefully climb the membership ladder..

Posted

Your welcome :)

 

If you have any further questions about what I have posted, just ask :)

 

Lee

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