; titleblock_maker2.lsp - a program that draws a mechanical titleblock ; copyright 2007 by Charles Robbins (alert "titleblock_maker2.lsp - copyright 2007 by Charles Robbins. Type t_maker2 to start") ; start the program (defun c:t_maker2 () ; drawing setup (setq osm (getvar "osmode")) ; gets osnap settings and assigns them to osm (setvar "osmode" 0) ; turns osnap settings off ;;; setup layers (command "layer" "n" "border" "c" "white" "border" "") (command "layer" "n" "text" "c" "cyan" "text" "") ; user input (setq sp (getpoint "\nPick the starting point ")) (setq drawingname (getstring T "\nWhat is the drawing name? ")) (setq projectname (getstring T "\nWhat is the project name? ")) (setq drawnby (getstring T "\nDrawn by? ")) (setq datedrawn (getstring T "\nDate drawn? ")) (setq checkby (getstring T "\nCkecked by? ")) (setq datechecked (getstring T "\nDate checked? ")) (setq approvedby (getstring T "\nApproved by? ")) (setq dateapproved (getstring T "\nDate approved? ")) (setq drawingnumber (getstring T "\nDrawing number? ")) (setq sheetnumber (getstring T "\nSheet number? ")) (setq revisionletter (getstring T "\nRevision letter? ")) (if (= revisionletter "")(setq revisionletter "A")) (setq drawingscale (getstring T "\nDrawing scale? <1=1> ")) (if (= drawingscale "")(setq drawingscale "1=1")) ; do the math (setq x1 (- (car sp) 5.0) x2 (+ x1 0.126) x3 (+ x1 0.476) x4 (+ x1 0.738) x5 (+ x1 1.000) x6 (+ x1 2.000) x7 (+ x1 4.000) x8 (+ x1 4.500) x9 (+ x1 5.000) y1 (cadr sp) y2 (+ y1 0.080) y3 (+ y1 0.150) y4 (+ y1 0.250) y5 (+ y1 0.350) y6 (+ y1 0.420) y7 (+ y1 0.500) y8 (+ y1 0.750) y9 (+ y1 1.000) y10 (+ y1 1.250) y11 (+ y1 1.625) y12 (+ y1 2.000) ) ; point assignments (setq p1 (list x1 y1) p2 (list x5 y1) p3 (list x6 y1) p4 (list x7 y1) p5 (list x8 y1) p6 (list x9 y1) p7 (list x1 y7) p8 (list x5 y7) p9 (list x6 y7) p10 (list x7 y7) p11 (list x8 y7) p12 (list x9 y7) p13 (list x6 y8) p14 (list x7 y8) p15 (list x9 y8) p16 (list x6 y9) p17 (list x7 y9) p18 (list x9 y9) p19 (list x6 y10) p20 (list x7 y10) p21 (list x9 y10) p22 (list x6 y11) p23 (list x9 y11) p24 (list x1 y12) p25 (list x6 y12) p26 (list x9 y12) p27 (list x2 y2) p28 (list x3 y3) p29 (list x3 y5) p30 (list x2 y6) p31 (list x4 y4) ) ; lets draw (command "layer" "s" "border" "") (command "line" p1 p6 "") (command "line" p7 p12 "") (command "line" p13 p15 "") (command "line" p16 p18 "") (command "line" p19 p21 "") (command "line" p22 p23 "") (command "line" p24 p26 "") (command "line" p1 p24 "") (command "line" p2 p8 "") (command "line" p3 p25 "") (command "line" p4 p20 "") (command "line" p5 p11 "") (command "line" p6 p26 "") (command "line" p27 p28 p29 p30 "c") (command "circle" p31 "d" 0.200) (command "circle" p31 "d" 0.340) ; add the text (command "text" (list (+ (car p25) 0.03125) (- (cadr p25) 0.09375)) 0.0625 "0" "Drawing Name:" ) (command "text" (list (+ (car p22) 0.03125) (- (cadr p22) 0.09375)) 0.0625 "0" "Project:" ) (command "text" (list (+ (car p19) 0.03125) (- (cadr p19) 0.09375)) 0.0625 "0" "Drawn By:" ) (command "text" (list (+ (car p20) 0.03125) (- (cadr p20) 0.09375)) 0.0625 "0" "Date Drawn:" ) (command "text" (list (+ (car p16) 0.03125) (- (cadr p16) 0.09375)) 0.0625 "0" "Checked By:" ) (command "text" (list (+ (car p17) 0.03125) (- (cadr p17) 0.09375)) 0.0625 "0" "Date Checked:" ) (command "text" (list (+ (car p13) 0.03125) (- (cadr p13) 0.09375)) 0.0625 "0" "Approved By:" ) (command "text" (list (+ (car p14) 0.03125) (- (cadr p14) 0.09375)) 0.0625 "0" "Date Approved:") (command "text" (list (+ (car p8 ) 0.03125) (- (cadr p8 ) 0.09375)) 0.0625 "0" "Scale:" ) (command "text" (list (+ (car p9 ) 0.03125) (- (cadr p9 ) 0.09375)) 0.0625 "0" "Drawing No.:" ) (command "text" (list (+ (car p10) 0.03125) (- (cadr p10) 0.09375)) 0.0625 "0" "Sht:" ) (command "text" (list (+ (car p11) 0.03125) (- (cadr p11) 0.09375)) 0.0625 "0" "Rev:" ) ; organization name (command "text" "j" "c" (list (+ (car p1) 1.00000) (+ (cadr p1) 1.550)) 0.12500 "0" "Technology Education" ) (command "text" "j" "c" (list (+ (car p1) 1.00000) (+ (cadr p1) 1.339)) 0.12500 "0" "College" ) (command "text" "j" "c" (list (+ (car p1) 1.00000) (+ (cadr p1) 1.162)) 0.09375 "0" "2745 Winchester Pike" ) (command "text" "j" "c" (list (+ (car p1) 1.00000) (+ (cadr p1) 0.994)) 0.09375 "0" "Columbus, Ohio 43232" ) (command "text" "j" "c" (list (+ (car p1) 1.00000) (+ (cadr p1) 0.827)) 0.09375 "0" "614.456.4600" ) ; insert titleblock information (command "text" (list (+ (car p25) 0.03125) (- (cadr p25) 0.3125)) 0.1250 "0" drawingname ) (command "text" (list (+ (car p22) 0.03125) (- (cadr p22) 0.3125)) 0.1250 "0" projectname ) (command "text" (list (+ (car p19) 0.03125) (- (cadr p19) 0.2187)) 0.0937 "0" drawnby ) (command "text" (list (+ (car p20) 0.03125) (- (cadr p20) 0.2187)) 0.0937 "0" datedrawn ) (command "text" (list (+ (car p16) 0.03125) (- (cadr p16) 0.2187)) 0.0937 "0" checkby ) (command "text" (list (+ (car p17) 0.03125) (- (cadr p17) 0.2187)) 0.0937 "0" datechecked ) (command "text" (list (+ (car p13) 0.03125) (- (cadr p13) 0.2187)) 0.0937 "0" approvedby ) (command "text" (list (+ (car p14) 0.03125) (- (cadr p14) 0.2187)) 0.0937 "0" dateapproved ) (command "text" (list (+ (car p8 ) 0.03125) (- (cadr p8 ) 0.4375)) 0.1875 "0" drawingscale ) (command "text" (list (+ (car p9 ) 0.03125) (- (cadr p9 ) 0.4375)) 0.1875 "0" drawingnumber ) (command "text" (list (+ (car p10) 0.03125) (- (cadr p10) 0.4375)) 0.1875 "0" sheetnumber ) (command "text" (list (+ (car p11) 0.03125) (- (cadr p11) 0.4375)) 0.1875 "0" revisionletter ) ; end the program (setvar "osmode" osm) ; turns osnap settings back on )