;;; mech_border.LSP ;;; This program will draw an A, B, C or D size border, titleblock and place notes ;;; copyright 2007 by Charles Robbins (alert "mech_border.LSP - copyright 2007 by Charles Robbins. Type mech to start") ;;; start the program (defun c:mech (/) ;;; 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" "") ; create border layer (command "layer" "n" "text" "c" "cyan" "text" "") ; create text layer (command "style" "titleblock" "arial" "0.0" "1" "0" "n" "n") ; create arial font and sets arial as current (setvar "textstyle" "standard") ; set standard as current ;;; user input (setq sp (getpoint "\nPick the lower left corner of the titleblock. ")) (initget 1 "A B C D") (setq bs (getkword "\nWhat size border do you need ? ")) ;;; do the math (if (= bs "A")(setq borderwidth 10.5 borderheight 8.0 ) ) (if (= bs "B")(setq borderwidth 16.0 borderheight 10.0 ) ) (if (= bs "C")(setq borderwidth 21.0 borderheight 16.0 ) ) (if (= bs "D")(setq borderwidth 33.0 borderheight 21.0 ) ) (setq mx1 (car sp) mx2 (+ mx1 borderwidth) my1 (cadr sp) my2 (+ my1 borderheight) ) ;;; point assignment (setq mp1 (list mx1 my1) mp2 (list mx2 my1) mp3 (list mx2 my2) mp4 (list mx1 my2) ) ;;; lets draw (command "layer" "s" "border" "") ; set layer to border (command "pline" mp1 mp2 mp3 mp4 "c") ; draw the border (titleblock_maker) ; run titleblock maker subroutine (notemaker) ; run notemaker subroutine ;;; end of the main program (command "layer" "s" "0" "") ; set layer to 0 (setvar "osmode" osm) ; turns osnap settings back on ) ;;; ***************************************************** titleblock program subroutine ************************************************ ; start the program (defun titleblock_maker () ; user input (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 mp2) 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 mp2) 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 "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 (setvar "textstyle" "titleblock") (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 "layer" "s" "text" "") (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 ) ) ;;; ************************************************* notemaker program subroutine ******************************************************** ;;; start the program (defun notemaker (/) ;;; user input (setq nsp (getpoint "\nPick starting point ")) (setq txtht (getstring "\nWhat is the text height? <0.125> ")) (if (= txtht "")(setq txtht 0.125)) (setq matl (getstring T "\nWhat is the material? ")) (setq coats (getint "\nHow many coats of enamel? ")) (setq c_color (getstring T "\nWhat is the color of the enamel? ")) (setq c_texture (getstring T "\nWhat is the enamel texture? ")) (initget 1 "y n") (setq q1 (getkword "\nDo you want standard tolerances? [y n] ")) (if(= q1 "y")(setq frac "1/16" 1dec "0.06" 2dec "0.03" 3dec "0.010" ang "0.5" ) ) (if(= q1 "n")(setq frac (getstring "\nFraction ") 1dec (getstring "\n1 dec? ") 2dec (getstring "\n2 dec? ") 3dec (getstring "\n3 dec? ") ang (getstring "\nangular? ") ) ) ;;; point assignment (setq pt (strcat "@0,-" (rtos(* 2 txtht)))) ;;; add text to drawing (command "text" nsp txtht "0" "Notes:") (command "text" pt "" "" (strcat "1. Materials: "(strcase matl T) ".")) (command "text" pt "" "" "2. Remove all sharp edges and burrs.") (command "text" pt "" "" (strcat "3. Paint with one coat of primer and with " (itoa coats) " coat(s) of " (strcase c_texture T) " " (strcase c_color T) " enamel.")) (command "text" pt "" "" "4. Tolerances unless otherwise specified: " ) (command "text" pt "" "" (strcat " Fraction: %%p" (strcase frac T ))) (command "text" pt "" "" (strcat " 1 decimal: %%p" (strcase 1dec T ))) (command "text" pt "" "" (strcat " 2 decimal: %%p" (strcase 2dec T ))) (command "text" pt "" "" (strcat " 3 decimal: %%p" (strcase 3dec T ))) (command "text" pt "" "" (strcat " Angular: %%p" (strcase ang T) "%%d" )) ;;; end of program (princ) )