;;; terminialblockrail3d.lsp ;;; a program that draws a terminial block rail channel style ;;; Copyright 2007 by Brian Gibbs (alert "\n terminal block rail.lsp - Copyright 2007 by Brian Gibbs \n Type din1 to Start") ;;; start the program (defun c:din1 () ;;; drawing setup (setq osm (getvar "osmode")) (setvar "osmode" 0) ;;; user input (setq sp (getpoint "\npick the starting point ")) (setq ex1 (getreal "\nwhat is the length of the rail? ")) ;;; do the math (setq y9 (cadr sp) y1 (- y9 0.5910) y2 (+ y1 0.0590) y3 (+ y1 0.0787) y4 (+ y1 0.3353) y5 (+ y1 0.3550) y6 (+ y1 0.4140) y7 (+ y1 0.5123) y8 (+ y1 0.5320) x5 (car sp) x1 (- x5 0.8430) x2 (+ x1 0.0590) x3 (+ x1 0.0787) x4 (+ x1 0.1930) x6 (+ x1 1.1813) x7 (+ x1 1.2010) x8 (+ x1 1.2600) ) ;;; point assignnment (setq p1 (list x5 y9 ) p2 (list x6 y9 ) p3 (list x8 y8 ) p4 (list x8 y3 ) p5 (list x7 y1 ) p6 (list x3 y1 ) p7 (list x1 y3 ) p8 (list x1 y4 ) p9 (list x2 y6 ) p10 (list x4 y6 ) p11 (list x4 y5 ) p12 (list x3 y5 ) p13 (list x2 y4 ) p14 (list x2 y3 ) p15 (list x3 y2 ) p16 (list x6 y2 ) p17 (list x7 y3 ) p18 (list x7 y7 ) p19 (list x6 y8 ) p20 (list x5 y8 ) ) ;;; lets draw (command "line" p1 p2 "") (setq ss1 (ssget "L")) (command "arc" p3 "e" p2 "r" 0.0787) (setq ss2 (ssget "L")) (command "line" p3 p4 "") (setq ss3 (ssget "L")) (command "arc" p5 "e" p4 "r" 0.0787) (setq ss4 (ssget "L")) (command "line" p5 p6 "") (setq ss5 (ssget "L")) (command "arc" p7 "e" p6 "r"0.0787) (setq ss6 (ssget "L")) (command "line" p7 p8 "") (setq ss7 (ssget "L")) (command "arc" p9 "e" p8 "r" 0.0787) (setq ss8 (ssget "L")) (command "line" p9 p10 "") (setq ss9 (ssget "L")) (command "line" p10 p11 "") (setq ss10 (ssget "L")) (command "line" p11 p12 "") (setq ss11 (ssget "L")) (command "arc" p12 "e" p13 "r"0.0197) (setq ss12 (ssget "L")) (command "line" p13 p14 "") (setq ss13 (ssget "L")) (command "arc" p14 "e" p15 "r" 0.0197) (setq ss14 (ssget "L")) (command "line" p15 p16 "") (setq ss15 (ssget "L")) (command "arc" p16 "e" p17 "r" 0.0197) (setq ss16 (ssget "L")) (command "line" p17 p18 "") (setq ss17 (ssget "L")) (command "arc" p18 "e" p19 "r" 0.0197) (setq ss18 (ssget "L")) (command "line" p19 p20 "") (setq ss19 (ssget "L")) (command "line" p20 p1 "") (setq ss20 (ssget "L")) ;;; Extrude 3D ; ( command "z" "" "e" "") (command "pedit" ss1 "" "j" ss2 ss3 ss4 ss5 ss6 ss7 ss8 ss9 ss10 ss11 ss12 ss13 ss14 ss15 ss16 ss17 ss18 ss19 ss20 "" "") (princ "Select the DIN rail") (setq ss22 (ssget)) (command "extrude" ss22 "" ex1 "") (setq ss23 (ssget "L")) (command "rotate3d ss23 "" "x" "90") (command "rotate3d ss23 "" "y" "90") ;;; end the program (setvar "osmode" osm) (princ) )