home *** CD-ROM | disk | FTP | other *** search
- -- PROGRAM TBLOCK.UPL
-
- -- This program inserts a border (A,B,C OR D SIZE) and a title block
- -- for a drawing. The block contains the drawing name, drawing number,
- -- author's name or initials and date of the drawing.
-
- GROUP
- CONST INTEGER SMAX = 13
- STRING MESS(5):30, S(5):SMAX, NEW_S:SMAX
- END GROUP
-
- PROC CHANGE_TEXT(INOUT INTEGER S_SIZE(5))
-
- INTEGER J
- STRING ANS:1
-
- --display menu to allow title block strings to be changed
-
- LOOP
- CLEAR 1
- PRINT " --Change Menu--"
- PRINT
-
- --display title block names and current values
-
- LOOP J = 1 TO 5
- PRINT J, ") ", MESS(J):-30, S(J):-(S_MAX+4), \
- "(Max ", S_SIZE(J), " characters)"
- END_LOOP
-
- PRINT
-
- --get which item is to be changed
-
- ACCEPT ANS IN("12345E") LAST("#13#") \
- PROMPT("select item to change or E to exit: ")
-
- EXIT WHEN ANS = 'E'
-
- PRINT; PRINT
-
- --get new value for selected item
-
- J = INTEGER(ANS)
- ACCEPT NEW_S SIZE(S_SIZE(J)) LAST("#13#") NEWLINE \
- PROMPT("New value for " + MESS(J) + ": ")
- S(J) = NEW_S
- END_LOOP
-
- END PROC -- CHANGE_TEXT
-
- -------------------------------------------------
- PROC MAIN
- -------------------------------------------------
-
- STRING ANS:1, FNAME(4):8
- INTEGER J, S_SIZE(5), BNUM
- REAL TH(5),TW(5)
- COORD TEXT_ORG(5), BO(4)
-
- BREAK_CHAR = 3
-
- --initialize border drawing names
-
- FNAME(1) = "BORDA"; FNAME(2) = "BORDB";
- FNAME(3) = "BORDC"; FNAME(4) = "BORDD"
-
- ECHO OFF; SEND; SEND "SEL MENU OFF"; SEND "SET SCROLL 9"; ECHO ON
-
- --initialize text heights and widths
-
- LOOP J = 1 TO 4; TH(J) = 0.25; TW(J) = 0.25; END_LOOP
- TH(5) = 0.2; TW(5) = 0.2
-
- --initialize names of items in title block
-
- MESS(1) = "Title line 1"; S_SIZE(1) = SMAX
- MESS(2) = "Title line 2"; S_SIZE(2) = SMAX
- MESS(3) = "Drawing number"; S_SIZE(3) = SMAX
- MESS(4) = "Name or initials"; S_SIZE(4) = 7
- MESS(5) = "Drawing date (DD/MM/YY)"; S_SIZE(5) = 8
-
- --initialize border origins for each border sizes
-
- BO(1) = [5.25,-4.0]; BO(2) = [8.25,-5.25];
- BO(3) = [10.75,-8.25]; BO(4) = [16.75,-10.75]
-
- --initialize relative text origins for each item in the title block
-
- TEXT_ORG(1) = [1.633,-1.145]; TEXT_ORG(2) = [1.633,-0.76]
- TEXT_ORG(3) = [1.633,-0.158]; TEXT_ORG(4) = [4.221,-1.016]
- TEXT_ORG(5) = [4.221,-0.158]
-
- CLEAR 1
- DISPLAY
- This program inserts a title block in the lower-right corner of your
- drawing and inserts a double border around your drawing. You may select
- the border size, two title lines, drawing number, name and date of drawing
-
- $
-
- --get size of border to be installed
-
- ACCEPT ANS PROMPT("Select border size (A,B,C, or D) ?") IN("ABCD") NEWLINE
- BNUM = ASCII(ANS)-ASCII("A")+1
-
- --adjust text orgins for selected border size
-
- LOOP J = 1 TO 5
- TEXT_ORG(J) = BO(BNUM)-TEXT_ORG(J)
- END_LOOP
-
- --get values for each item in the title block
-
- LOOP J = 1 TO 5
- ACCEPT NEW_S SIZE(S_SIZE(J)) LAST("#13") NEWLINE \
- PROMPT("Enter "+MESS(J)+" (Max "+STRING(S_SIZE(J))+" characters): ")
- S(J) = NEW_S
- END_LOOP
-
- LOOP
-
- --display current title block data
-
- CLEAR 1
- PRINT "Current block data:"
- LOOP J = 1 TO 5
- PRINT MESS(J)+":":-30,S(J)
- END_LOOP
-
- PRINT
- ACCEPT ANS IN('ACE') NEWLINE \
- PROMPT("Do you want this data (A)dded, (C)hanged or (E)xit? ")
-
- IF ANS = "A" THEN
-
- --insert border drawing as a figure
-
- ECHO OFF
- SEND "INS FIG ",FNAME(BNUM)," :X0 Y0 Z0"
- SEND
- SEND "INS FIG TBLOCK :X ", \
- BO(BNUM).X,"Y ",BO(BNUM).Y,"Z ",BO(BNUM).Z
- SEND
- ECHO ON
-
- --insert title block text
-
- LOOP J = 1 TO 5
- INSERT TEXT JUST(3) ORG(TEXT_ORG(J)) HGT(TH(J)) WDT(TW(J)) \
- TXT(S(J)) RPNT(TRUE)
- END_LOOP
-
- ELSE IF ANS = "C" THEN
-
- --allow user to change title block information
-
- CHANGE_TEXT(S_SIZE())
- ENDIF
-
- EXIT WHEN ANS = "E" OR ANS = "A" --all done?
-
- END_LOOP
-
- CLEAR 1
- ECHO OFF; SEND "SET SCR 3"; ECHO ON
-
- PRINT "program completed"
-
- END PROC