coombsie11 Posted November 22, 2009 Posted November 22, 2009 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). 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. At the moment I do a 3 point line and edit after using PROPERTIES. It takes ages. Please help a rookie. Kind regards Al. Quote
Lee Mac Posted November 22, 2009 Posted November 22, 2009 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)) Quote
coombsie11 Posted November 22, 2009 Author Posted November 22, 2009 OMG Lee Mac, thats amazing. 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? Quote
Lee Mac Posted November 22, 2009 Posted November 22, 2009 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 Quote
Lee Mac Posted November 22, 2009 Posted November 22, 2009 One more: Explanation of a LISP function (Text replacement): http://www.cadtutor.net/forum/showpost.php?p=264546&postcount=15 Quote
coombsie11 Posted November 22, 2009 Author Posted November 22, 2009 Once again - many thanks.. Will check out the links and hopefully climb the membership ladder.. Quote
Lee Mac Posted November 22, 2009 Posted November 22, 2009 Your welcome If you have any further questions about what I have posted, just ask Lee Quote
Recommended Posts
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.