;;; deep_din_rail.lsp ;;; a program that draws a 3D deep terminial block rail channel style ;;; Copyright 2007 by Charles Robbins (alert "Deep terminal block rail.lsp - Copyright 2008 by Charles Robbins \nType deepdin to start") ;;; start the program (defun c:deepdin () ;;; 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 x1 (car sp) x2 (+ x1 0.1960) x3 (+ x1 0.2160) x4 (+ x1 0.3070) x5 (+ x1 0.3373) x6 (+ x1 1.0407) x7 (+ x1 1.0710) x8 (+ x1 1.1620) x9 (+ x1 1.1820) x10 (+ x1 1.3780) y1 (cadr sp) y2 (- y1 0.0390) y3 (- y1 0.0910) y4 (- y1 0.1104) y5 (- y1 0.1389) y6 (- y1 0.4697) y7 (- y1 0.5000) y8 (- y1 0.5910) ) ;;; point assignnment (setq p1 (list x1 y1 ) p2 (list x1 y2 ) p3 (list x2 y4 ) p4 (list x3 y5 ) p5 (list x3 y6 ) p6 (list x5 y8 ) p7 (list x7 y8 ) p8 (list x8 y6 ) p9 (list x8 y5 ) p10 (list x9 y4 ) p11 (list x10 y2 ) p12 (list x10 y1 ) p13 (list x8 y1 ) p14 (list x7 y3 ) p15 (list x7 y6 ) p16 (list x6 y7 ) p17 (list x5 y7 ) p18 (list x4 y6 ) p19 (list x4 y3 ) p20 (list x3 y1 ) ) ;;; lets draw (command "line" p1 p2 "") (setq ss1 (ssget "L")) (command "line" p2 p3 "") (setq ss2 (ssget "L")) (command "arc" p4 "e" p3 "r" 0.0303) (setq ss3 (ssget "L")) (command "line" p4 p5 "") (setq ss4 (ssget "L")) (command "arc" p5 "e" p6 "r" 0.1213) (setq ss5 (ssget "L")) (command "line" p6 p7 "") (setq ss6 (ssget "L")) (command "arc" p7 "e" p8 "r" 0.1213) (setq ss7 (ssget "L")) (command "line" p8 p9 "") (setq ss8 (ssget "L")) (command "arc" p10 "e" p9 "r" 0.0303) (setq ss9 (ssget "L")) (command "line" p10 p11 "") (setq ss10 (ssget "L")) (command "line" p11 p12 "") (setq ss11 (ssget "L")) (command "line" p12 p13 "") (setq ss12 (ssget "L")) (command "arc" p13 "e" p14 "r" 0.0910) (setq ss13 (ssget "L")) (command "line" p14 p15 "") (setq ss14 (ssget "L")) (command "arc" p16 "e" p15 "r" 0.0303) (setq ss15 (ssget "L")) (command "line" p16 p17 "") (setq ss16 (ssget "L")) (command "arc" p18 "e" p17 "r" 0.0303) (setq ss17 (ssget "L")) (command "line" p18 p19 "") (setq ss18 (ssget "L")) (command "arc" p19 "e" p20 "r" 0.0910) (setq ss19 (ssget "L")) (command "line" p20 p1 "") (setq ss20 (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 "" "") (princ "Select the DIN rail") (setq ss22 (ssget)) (command "extrude" ss22 "" ex1 "") (setq ss23 (ssget "L")) (command "rotate3d" ss23 "" "x" sp "90") ;;; end the program (setvar "osmode" osm) (princ) )