;;; terminal block R3.lsp ;;; copyright 2008 by allen peterson (alert "terminal block R3 .lsp - copyright 2007 by Allen Peterson II \ntype terminalr3 to start the program") ;;; start the program (defun c:terminalr3 ( ) ;;; drawing setup (setq osm (getvar "osmode") ) ; gets osnap settings and assigns to osm (setvar "osmode" 0) ; turns osnap settings off ;;; user input (setq sp (getpoint "\nPick the starting point ")) (setq lgt (getreal "\nWhat is the length? ")) ;;; do the math (setq x1 (car sp) x2 (+ x1 0.145) x3 (+ x1 0.158) x4 (+ x1 0.197) x5 (+ x1 0.210) x6 (+ x1 1.168) x7 (+ x1 1.181) x8 (+ x1 1.220) x9 (+ x1 1.233) x10 (+ x1 1.378) y1 (cadr sp) y2 (+ y1 0.039) y3 (+ y1 0.052) y4 (+ y1 0.235) y5 (+ y1 0.248) y6 (+ y1 0.287) ) ;;; point assignments (setq p1 (list x1 y2) p2 (list x1 y1) p3 (list x2 y1) p4 (list x4 y2) p5 (list x4 y4) p6 (list x5 y5) p7 (list x6 y5) p8 (list x7 y4) p9 (list x7 y3) p10 (list x9 y1) p11 (list x10 y1) p12 (list x10 y2) p13 (list x9 y2) p14 (list x8 y3) p15 (list x8 y4) p16 (list x6 y6) p17 (list x5 y6) p18 (list x3 y4) p19 (list x3 y3) p20 (list x2 y2) ) ;;; lets draw (command "line" p1 p2 "") (setq ss1 (ssget "L")) (command "line" p2 p3 "") (setq ss2 (ssget "L")) (command "line" p4 p5 "") (setq ss3 (ssget "L")) (command "line" p6 p7 "") (setq ss4 (ssget "L")) (command "line" p8 p9 "") (setq ss5 (ssget "L")) (command "line" p10 p11 "") (setq ss6 (ssget "L")) (command "line" p11 p12 "") (setq ss7 (ssget "L")) (command "line" p12 p13 "") (setq ss8 (ssget "L")) (command "line" p14 p15 "") (setq ss9 (ssget "L")) (command "line" p16 p17 "") (setq ss10 (ssget "L")) (command "line" p18 p19 "") (setq ss12 (ssget "L")) (command "line" p20 p1 "") (setq ss13 (ssget "L")) (command "arc" p3 "e" p4 "r" 0.052 ) (setq ss14 (ssget "L")) (command "arc" p6 "e" p5 "r" 0.013 ) (setq ss15 (ssget "L")) (command "arc" p8 "e" p7 "r" 0.013 ) (setq ss16 (ssget "L")) (command "arc" p9 "e" p10 "r" 0.052 ) (setq ss17 (ssget "L")) (command "arc" p14 "e" p13 "r" 0.013 ) (setq ss18 (ssget "L")) (command "arc" p15 "e" p16 "r" 0.052 ) (setq ss19 (ssget "L")) (command "arc" p17 "e" p18 "r" 0.052 ) (setq ss20 (ssget "L")) (command "arc" p20 "e" p19 "r" 0.013 ) (setq ss21 (ssget "L")) ;;; Extrude 3D (command "pedit" ss1 "" "j" ss2 ss3 ss4 ss5 ss6 ss7 ss8 ss9 ss10 ss11 ss12 ss13 ss14 ss15 ss16 ss17 ss18 ss19 ss20 ss21 "" "" ) (princ "select the DIN rail ") (setq ss22 (ssget)) (command "extrude" ss22 "" lgt "") (setq ss23 (ssget "L")) (command "rotate3d" ss23 "" "x" sp "180" ) ;;; end the program (setvar "osmode" osm) ; turns osnap settings back on (princ) )