ready2goriding Posted August 17, 2010 Posted August 17, 2010 It was quite the learning curve, but it seems to work now! This is a program that I have wanted to do as a means to teach me more about lisping. It is used to extend a cabinet and refill the missing spaces. Now I want to learn even more- layers, list manipulation, etc. I thought that I would post it here in case the more experienced eyes have any advice... As always, I welcome anything from better ideas to outright laughter! Thanks again to this site for sparking my interest! ;;------------------=={qq.lsp}==-------------------;; ;; ;; ;; Used to extend cabinet & clean up dwg. ;; ;;-------------------------------------------------;; ;; ;; ;; Can be used on plan view also. ;; ;;-------------------------------------------------;; ;; ;; ;; Many thanks to CADtutor.net & Afralisp.net! ;; ;;-------------------------------------------------;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:qq (/ a tp bt es odir es1 odir1 trm trmz erst m1 m2 m3 ex1 ex2 cdl cdl1 e1 dim1 dim2 dim3 wp1 wp2 wp3 wp4 wp5 wp6 ma1 ma2 ma3 ma4) ; define function ;erase 3 unneeded dims (prompt "Select 3 dimensions to erase & inside window swing lines") (setq a (ssget)) (command "._erase" a "") ;draw center line (setq tp (getpoint "\nSelect top center point :")) (setq bt (getpoint "\nSelect bottom center point :")) (command "._line" "_non" tp "_non" bt "") ;offset trim lines (prompt "Offset center line on both sides :") (setq es (entsel)) (repeat 2 (setq odir (getpoint "\nDirection of offset? :")) (command "._offset" 4.5 es odir "") ) : end of repeat ;offset outside trim lines (prompt "Offset outer trim lines toward the outside of cabinet :") (repeat 2 (setq es1 (entsel)) (setq odir1 (getpoint "\nDirection of offset? :")) (command "._offset" 5.0 es1 odir1 "") ) : end of repeat ; trim cabinet (repeat 2 (prompt "Select one set of trim lines :") (setq trm (ssget)) (prompt "Select trim objects :") (setq trmz (ssget)) (command "._trim" "_non" trm "" "_non" trmz "") ) ; end of repeat ; erase 3 inside lines & Cab. top (prompt "Erase 3 inside lines & cabinet top:") (setq erst (ssget)) (command "._erase" erst "") ; move cabinet pieces (repeat 2 (prompt "Select pieces to move") (setq m1 (ssget)) (setq m2 (getpoint "\nBasepoint or distance. :")) (setq m3 (getpoint "\nNext point. :" m2)) (command "._move" m1 "" m2 m3) ) ; end of repeat ; extend cabinet lines (prompt "Select 2 boundary edges to extend toward. :") (setq ex1 (ssget)) (Prompt "Select lines to extend. :") (while (setq ex2 (entsel)) (command "._extend" ex1 "" ex2 "") ) ; end of while loop ; extend cabinet top & upper dimension (prompt "Select ext. point for cab. top & dim. :") (setq cdl (entsel)) (prompt "Select objects to extend") (repeat 2 (setq cdl1 (entsel)) (command "._extend" cdl "" cdl1 "") ) ; end of repeat ; erase inside lines (prompt "Select inside lines to erase. :") (setq e1 (ssget)) (command "._erase" e1 "") ; add 3 new dimensions (prompt "Add 3 new dimension lines. :") (repeat 3 (setq dim1 (getpoint "\nFirst dim. point :")) (setq dim2 (getpoint "\nNext dim. point :")) (setq dim3 (getpoint "\n dim. Text location :")) (command "._dimlinear" "_non" dim1 "_non" dim2 "_non" dim3) ) ; end of repeat ; add window swing lines (Prompt "Add window swing lines. :") (setq wp1 (getpoint "\n1st point :")) (setq wp2 (getpoint "\n2nd point :")) (setq wp3 (getpoint "\n3rd point :")) (setq wp4 (getpoint "\n1st point :")) (setq wp5 (getpoint "\n2nd point :")) (setq wp6 (getpoint "\n3rd point :")) (command "._line" "_non" wp1 "_non" wp2 "_non" wp3 "") (command "._line" "_non" wp4 "_non" wp5 "_non" wp6 "") ; match inner swing line types (prompt "Match swingline properties to cabinet top. :") (setq ma1 (entsel "\nSelect source object")) (prompt "Select destination objects. :") (setq ma2 (ssget)) (command "._matchprop" "_non" ma1 "_non" ma2 "") ; match bottom dimension styles (prompt "Match bottom dimension styles. :") (setq ma3 (entsel "\nSelect source object")) (setq ma4 (entsel "\nSelect destination object. ")) (command "._matchprop" "_non" ma3 "_non" ma4 "") (alert "End of program! Do any needed cosmetic work now!") (princ) ) ;end of program Quote
Se7en Posted August 17, 2010 Posted August 17, 2010 Congratulations. Very nice. I highly recommend: "list manipulation" next; it is a big subject that will be the basis of what you can do with lisp. Quote
ready2goriding Posted August 17, 2010 Author Posted August 17, 2010 Thank you. I do not really even know where to start, but I will be researching soon to find out! Quote
Se7en Posted August 17, 2010 Posted August 17, 2010 I took a second to think of some task that will get you on the path of learning more about list manipulation. These should teach you a lot if you follow through with the research and learning. List manipulation: Given a list: (0 1 2 3 4 5 6 7 8 9) Tasks: 1. Give me two methods (use two different functions or methods for iterating) for adding one to each item in that list. 2. Double the size of it. 3. Half the size of it. answers.txt Quote
ready2goriding Posted August 17, 2010 Author Posted August 17, 2010 Just what I needed! I won't cheat and look at the answers file. I think that we are discussing "mapcar & lambda." I was reading a little about them yesterday! I'll see if I can make the formula work! Thanks, Se7en! Quote
ready2goriding Posted August 17, 2010 Author Posted August 17, 2010 Congrats! It's fun isn't it? It's nearly too much fun! I can hardly believe that I get paid for this! Quote
Se7en Posted August 17, 2010 Posted August 17, 2010 Just what I needed! I won't cheat and look at the answers file. I think that we are discussing "mapcar & lambda." I was reading a little about them yesterday! I'll see if I can make the formula work! Thanks, Se7en! There are three `formula's' there and i suppose you can do the first one with the combined use of the MAPCAR function and the LAMBDA function but thats up for you to decide. There are many ways you can go about each of these tasks; im just leading you down a path. I want you to come up with a plan in your head and try and research it as best as you can. If you run into a wall, look at my methods and research it until you understand it. Once you understand it, see if you can change it. Whats cool about the answers ive given you is that i tried not to use the same method or function twice--to make you do that much more research and reading-. Quote
ready2goriding Posted August 17, 2010 Author Posted August 17, 2010 ...to make you do that much more research and reading-. It will take a lot of studying to get me going, but I really want to learn! Thanks for your help! I will get getting on the lessons ASAP! 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.