' Sisyphus Text Generator - version 2 'Ray Solomon crsolomon@yahoo.com '2-5-2020 ' the code is all here - some cludge, some clunky - but it works. gw = 600 gh = 750 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Top = (Desktop.Height - gh) / 2 GraphicsWindow.Left = (Desktop.Width - gw) / 2 secondtime = 0 prevtexttype = 0 prevcursivetxt = -1 line1len = 0 line2len = 0 line3len = 0 'loop back here to write another output file **************************************************** BigRepeat: GraphicsWindow.FontSize = 12 GraphicsWindow.BackgroundColor = "White" GraphicsWindow.CanResize = "False" GraphicsWindow.Title = "Sisyphus Text Generator" path = Program.Directory initialbox1 = 0 initialbox2 = 0 initialbox3 = 0 threelines = 0 typeselect = 0 fontselect = 0 sizeselect = 0 eraseselect = 0 button1color = "white" button2color = "white" button3color = "white" button4color = "white" button5color = "white" button6color = "white" button7color = "white" button8color = "white" button9color = "white" button10color = "white" button11color = "white" button12color = "white" button1shade = "blue" button2shade = "blue" button3shade = "blue" button4shade = "purple" button5shade = "purple" button6shade = "darkgreen" button7shade = "darkgreen" button8shade = "darkgreen" button9shade = "red" button10shade = "red" button11shade = "black" button12shade = "blue" buttonwidth =150 buttonheight = 40 '======================================================== numlines = "" ' numberic value 1 = spiral, 2 = circular, 3 = 3 lines fonttype = "" ' these are used for writing descriptions size = "" 'these are used for writing descriptions erasetype = "" ' these are used for writing descriptions Rotangextr = 0 filenamz = "" rotprob = 1 fileprob = 0 bigprob = 1 Pass = 0 returnedtext = 0 xx1 = "" ' this is for 3 lines xx2 = "" xx3 = "" '====================this is the entry part for the 1st screen kickback: Gui() 'call up the main entry screen (page 1) filenameprob = 0 bigprob = 1 Controls.ButtonClicked = OnButtonClick Controls.TextTyped = OnTyped ' Button Wait Loop: '--------------------------------------------------------------------------------------------------------------------------------' Loop: If Buttonpush <> "" Then ' Waits until Button is retrieved from Sub OnButtonClick. loopz: Rotangextr = Controls.GetTextBoxText(rotation) ' Last selected button name filenamz = Controls.GetTextBoxText(filename) ' Its corresponding caption checkvalid() CheckButtons() If( bigprob = 0) then Goto enterlines endif Buttonpush = "" ButtonCap = "" EndIf Program.Delay(50) ' A quick delay to avoid heating up CPU! Goto Loop '-======================== end of 1st page entry logic ' this starts PAGE 2 - and reading the approprate font file 'this goes to the 2nd screens enterlines: ' start by zeroing out the target file filenamy = "\"+ filenamz filePath = path+filenamy+".thr" 'zero output file a = File.WriteContents(filePath,"0,1") If(a = "FAILED") Then GraphicsWindow.Clear() GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(70,20,"Problem Writing your output file ") GraphicsWindow.DrawText(70,35,"Check the disk and try again") GraphicsWindow.DrawText(70,50,"Exiting Program") Program.Delay(3000) Goto endit endif 'skipover1: If(prevtexttype = 0) then Goto justread endif If(cursivetxt = prevcursivetxt) then Goto skipreadchr endif justread: GraphicsWindow.Clear() GraphicsWindow.BrushColor = "black" If (cursivetxt = 0) then GraphicsWindow.DrawText(70, 20, "Please Wait - reading and sorting the abcdp.txt data file") endif If (cursivetxt = 1) then GraphicsWindow.DrawText(70, 20, "Please Wait - reading and sorting the abcd.txt data file") endif GraphicsWindow.DrawText(70, 40, "Takes around a minute to read") GraphicsWindow.Brushcolor = "red" ' filename1 = path+"\abcd.txt" filename0 = path+"\abcdpkern.txt" filename = filename1 If (cursivetxt = 0) then ' printed font filename = filename0 endif letters = 1 ' this is for reading the abc file! reset if you have to reread a new font '--------------------------------------------------------------------------------------------------------------------------------' ' reads line for line, saves values to csv and stores them in the xchr, ychr variables '----------------------------------------------------------------------------- line_number = 1 line = File.ReadLine(filename, line_number) 'check for proper read of abc.txt data file - exit if it isn't there If(line = "") Then GraphicsWindow.Clear() GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(70, 20, "Can't find abc.txt file - please put into same directory") Goto endit endif aa = 70 ab = 1 ' now read the abc file data and sort it While line <> "" comma_position1 = Text.GetIndexOf(line, " ") nextblank = Text.GetSubTextToEnd(line, comma_position1+1) comma_position2 = Text.GetIndexOf(nextblank, " ") number[line_number] = Text.GetSubText(line, 1, comma_position1-1) XChr[line_number] = Text.GetSubText(nextblank, 1, comma_position2-1) yChr[line_number] = Text.GetSubTextToEnd(nextblank, comma_position2+1) zz = Text.GetLength(xChr[line_number]) If (zz> 9) Then zz = 9 EndIf x1 = Text.getsubtext(xChr[line_number],1,zz) xChr[line_number] = x1 zz = Text.GetLength(yChr[line_number]) If (zz> 9) Then zz = 9 EndIf y1 = Text.getsubtext(yChr[line_number],1,zz) yChr[line_number] = y1 If (Math.Abs(xChr[line_number]) < .00001) Then xChr[line_number] = 0 EndIf If (Math.Abs(yChr[line_number]) < .00001) Then yChr[line_number] = 0 EndIf ab = ab+1 If(ab = 500) Then GraphicsWindow.DrawText(aa,60," *") ab = 1 aa = aa+10 EndIf line_number = line_number + 1 line = File.ReadLine(filename, line_number) EndWhile '=========================================== endf = line_number-1 letters = 1 ' initialize first letter from position 1 'this makes a table of start and end points of each letter as well as counts letters start[letters] = 1 start_x[letters] = xChr[1] start_y[letters] = yChr[1] For i = 2 To endf If (number[i] <>1) then Goto skip2 EndIf ends[letters] = i-1 end_x[letters] = xChr[i-1] end_y[letters] = yChr[i-1] letters = letters + 1 start[letters] = i start_x[letters] = xChr[i] start_y[letters] = yChr[i] skip2: EndFor ends[letters] = endf end_x[letters] = xChr[endf] end_y[letters] = yChr[endf] If letters <> 96 then GraphicsWindow.DrawText(70,80,"Your abc.txt file is out of date - please update ") df = TextWindow.Read() Goto endit endif '============================================ file read ok and data in place GraphicsWindow.DrawText(70,80,"Success! number of data points read "+ endf) GraphicsWindow.DrawText(70,95,"number of characters found in data "+ letters ) Program.Delay(3000) skipreadchr: ' jump here if you already read the font set to use GraphicsWindow.PenWidth = 2 Line1valid = 0 Line2valid = 0 Line3valid = 0 '----------------------this starts the text entry part to display the correct page 2 screen GraphicsWindow.Clear() If(numblines = 3) then outval = 3 line1x = 150 line1y = 65 line1bx = 250 line2x = 190 line2y = 125 line2bx = 170 xmul = 2.8 ymul = 1.4 If (sizez = 2) then xmul = 2.6 ymul = 1.3 endif If (sizez = 3) then xmul = 2.4 ymul = 1.2 endif Line3Screen() endif If(numblines = 2) then outval = 2 line1x = 335 line1y = 55 line1bx = 170 line2x = 160 line2y = 125 line2bx = 170 xmul = 2.2 ymul = 1.1 Line2Screen() endif If(numblines = 1) then outval = 1 line1x = 25 line1y = 100 line1bx = 140 xmul = 2.4 ymul = 1.2 Line1Screen() endif ' this is common for all GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(40,360,"Basic can be very slow to update, so") GraphicsWindow.DrawText(40,390,"Text Below echoes entries above to confirm input") 'Controls.TextTyped = OnTyped Controls.ButtonClicked = OnButtonClick oldline1 = "" oldline2 = "" oldline3 = "" loop1: line1chg = 0 line2chg = 0 line3chg = 0 line1text = Controls.GetTextBoxText(LIne1) line2text = Controls.GetTextBoxText(LIne2) line3text = Controls.GetTextBoxText(LIne3) If(line1text <> oldline1) then oldline1 = line1text line1chg = 1 endif If(line2text <> oldline2) then oldline2 = line2text line2chg = 1 endif If(line3text <> oldline3) then oldline3 = line3text line3chg = 1 endif ' =============================== click a button ==================================================== If( Controls.LastClickedButton = Buttonpush) then ' one final check on length before going on because basic is SO slow GraphicsWindow.BrushColor = "green" GraphicsWindow.DrawText(160, 220,"Making One last validity check!") textline = line1text CheckText() x2 = line1len If line1len = 0 then Line1valid = 0 Goto wontwork endif If line1len > linelen1 then Line1valid = 0 Goto wontwork endif textline = line2text CheckText() x2 = line2len If (line2len > linelen2) then Line2valid = 0 Goto wontwork endif If (line2len =0) then Line2valid = 0 Goto wontwork endif textline = line3text CheckText() x2 = line3len If line3len > linelen3 then Line3valid = 0 Goto wontwork endif If line3len =0 then Line3valid = 0 Goto wontwork endif If (Line1valid +Line2valid+Line3valid = outval) Then If( Buttonpush = button11) then drawitfirst = 0 endif If( Buttonpush = button12) then drawitfirst = 1 endif Goto endout EndIf wontwork: GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(158,218,400,22) GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(160, 220,"One Text Box is empty or invalid") Program.Delay(2000) GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(158,218,400,22) Buttonpush = 0 endif '======================================================================== ' do box 1 first If(line1chg = 1) then If line1text = "" then ' cut to the chase if the field is blank line1len = 0 Line1valid = 0 Goto jumpsd endif textline = line1text ' so it's something new CheckText() line1len = x2 Line1valid = 0 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(line1x-2,line1y-2,400,20) If (illegal = 1) then GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(line1x,line1y,"illegal character in string") Goto skipsa endif If (line1len > linelen1) then GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(line1x,line1y,"text line 1 too long") Goto skipsa endif jumpsd: GraphicsWindow.FontSize = 12 If(numblines = 2) then ' this is for the 2 line case first box GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(333,53,400,20) xx1 = Text.Append("Your line length is ",line1len) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(335, 55,xx1) xy1a = Text.Append("of a maximum ",linelen1) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(335, 75,xy1a) Goto skips1a endif ' end 2 line case first box xx1 = Text.Append("your line length is ",line1len) ' this is 3 line case and single line case first line xx1 = Text.Append(xx1," of a maximum ") xx1 = Text.Append(xx1,linelen1) GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(line1x-2,line1y-2,400,20) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(line1x,line1y,xx1) skips1a: Line1valid = 1 skipsa: GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(108,418,400,24) GraphicsWindow.fillRectangle(38,418,400,24) GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawText(110,420,line1text) GraphicsWindow.DrawText(40,420,line1len) initialbox1 = 1 endif '=================2nd box entry If(line2chg = 1) then If line2text = "" then ' cut to the chase if the field is blank line2len = 0 Line2valid = 0 Goto jumps2 endif textline = line2text ' so it's something new CheckText() line2len = x2 Line2valid = 0 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(line2x-2,line2y-2,400,20) If (illegal = 1) then GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(line2x,line2y,"illegal character in string") Goto skips2 endif If (line2len > linelen2) then GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(line2x,line2y,"text line 2 too long") Goto skips2 endif jumps2: GraphicsWindow.FontSize = 12 xx2 = Text.Append("your line length is ",line2len) xx2 = Text.Append(xx2," of a maximum ") xx2 = Text.Append(xx2,linelen2) GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(line2x-2,line2y-2,400,20) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(line2x,line2y,xx2) Line2valid = 1 skips2: initialbox2 = 1 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(108,448,400,24) GraphicsWindow.fillRectangle(38,448,400,24) GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawText(110,450,line2text) GraphicsWindow.DrawText(40,450,x2) endif ' =================3rd Box================== If(line3chg = 1) then If line3text = "" then ' cut to the chase if the field is blank line3len = 0 Line3valid = 0 Goto jumps3 endif textline = line3text ' so it's something new CheckText() line3len = x2 Line3valid = 0 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(150-2,185-2,400,20) If (illegal = 1) then GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(150, 185,"illegal character in string") Goto skips3 endif jumps3: If (line3len > linelen3) then GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(150, 185,"text line 3 too long") Goto skips3 endif GraphicsWindow.FontSize = 12 xx3 = Text.Append("your line length is ",line3len) xx3 = Text.Append(xx3," of a maximum ") xx3 = Text.Append(xx3,linelen3) GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(150-2,185-2,400,20) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(150, 185,xx3) Line3valid = 1 skips3: initialbox3 = 1 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(108,478,400,24) GraphicsWindow.fillRectangle(38,478,400,24) GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawText(110,480,line3text) GraphicsWindow.DrawText(40,480,x2) endif Program.Delay(500) ' A quick delay to avoid heating up CPU! Goto Loop1 '===============================end of the page 2 logic screen endout: ' now output the .thr file ROTANG = -Math.pi/2 + Rotangextra GraphicsWindow.Clear() GraphicsWindow.DrawText(20,50,"Starting Conversion - please wait") '========================3 STRAIGHT LINES LOGIC========== If( numblines = 3 ) then ' this is the logic for the 3 straight line output 'zoffset =78.53975+Math.Pi ' for fast test write linx = 3 xx = Text.Append(zoffset," 1") File.WriteLine(FilePath,1,"0 0") File.WriteLine(FilePath,2,xx) writepos = 0 ydisp = .22 ' baseline is y disp +.1*ymul for .22 it equals .36 line2 = 1 linelen = 1.56 textline = line1text GetLineText() StraightLogic() 'now do line 2 ydisp = -.2 linelen = 1.9 textline = line2text GetLineText() StraightLogic() 'now do line 3 ydisp = -.62 linelen = 1.56 textline = line3text GetLineText() StraightLogic() finishx: diffs = 5 badrad = .3 x[1] = xpic[1] y[1] = ypic[1] 'numk[1] = number[1] k=2 For j = 2 To writepos dist = Math.squareroot(xpic[j]*xpic[j] +ypic[j]*ypic[j]) 'numk[k] = number[j] x[k] = xpic[j-1] y[k] = ypic[j-1] k = k+1 If(dist > badrad) then Goto noadjust endif xdif = (xpic[j-1] - xpic[j])/diffs ydif = (ypic[j-1] - ypic[j])/diffs xs = xpic[j-1] ys = ypic[j-1] For l = 1 To diffs-1 xs = xs -xdif ys = ys -ydif 'numk[k] = number[j] x[k] = xs y[k] = ys k = k+1 endfor noadjust: endfor ' now write it back into xpic writepos = k-1 For i = 1 to writepos xpic[i] = x[i] ypic[i] = y[i] endfor drawpos = writepos drawpreview() If(drawitfirst = 1) then Goto showtrace endif backfromshow1: Finishit() x1 = x1+.01 xz = Text.Append(x1," 1") File.WriteLine(FilePath,linx,xz) Goto itsdone endif '=================' all this is the 3 line logic above============ '=================2 LINE LOGIC ==================== If (numblines = 2) then ' this is specifi logic forthe 2 line circular output backfromshow2: 'no thick and thin - needs to be uniform in 2 phases 'linx = 3 'linx needs to be 2, not 3 because the first point is the center linx = 3 zoffset =157.0795 '==================================================== 'xmul = 2.2 'mul = 1.1 ROTANG = -Math.pi/2 + Rotangextra line2 = 1 writepos = 0 '.7 radius circle , subtract .1 for safety from the circumference cirrad = .70 linelen = cirrad*2*math.pi-.1 textline = line1text GetLineText() xstarts = xstr[1] ystarts = ystr[1] 'tranfer to array xpic and set first point to 0,0 For i = 1 to outline -1 xrad[i] = (xstr[i] - xstarts)/cirrad yrad[i] = ystr[i] - ystarts +cirrad xstr[i] = yrad[i]*Math.Cos(xrad[i]) ystr[i] = yrad[i]*Math.Sin(xrad[i]) endfor startang = xrad[1] endang = xrad[outline-1] rottang = MAth.pi/2 - 2*Math.pi-(endang - startang)/2 'now draw a line from 0 0 to the first point x1 = -(xstr[1] *Math.cos(ROTtANG) - ystr[1] *Math.sin(ROTtANG)) y1 = xstr[1] *MAth.sin(ROTtANG) + ystr[1] *Math.cos(ROTtANG) m = y1/x1 b = y1 - m*x1 innercircle = .4 i= 1 x[i] = x1 y[i] = y1 Quadrant() z= x[i]*x[i] + y[i]*y[i] rer[i] = Math.SquareRoot(z) If rer[i] = 0 Then reang[i] = 0 else z = x[i]/rer[i] reang[i] = Math.ArcCos(z) endif Normalize() xpic[1] = innercircle*Math.cos(reang[1]) ypic[1] = innercircle*Math.Sin(reang[1]) xa = Text.Append(" ",innercircle) xx = Text.Append(zoffset+reang[i],xa) File.WriteLine(FilePath,1,"1 1") File.WriteLine(FilePath,2,xx) i = 2 lhoop: xpic[i] = xpic[i-1] -.02 If(xpic[i] > x1) Then ypic[i] = m*xpic[i] +b i = i+1 Goto lhoop EndIf xpic[i] = x1 ypic[i] = y1 firstline = i ' convert the rest ===================== For i = 1 To outline -1 x1 = -(xstr[i] *Math.cos(ROTtANG) - ystr[i] *Math.sin(ROTtANG)) y1 = xstr[i] *MAth.sin(ROTtANG) + ystr[i] *Math.cos(ROTtANG) xpic[i+firstline] = x1 ypic[i+firstline] = y1 EndFor 'bulk convert done ================================== 'set the real end point of xpic here outline = outline-1+firstline 'now draw a line from 0 0 to the last point 'you know x1 and y1 m = y1/x1 b = y1 - m*x1 i= 1 x[i] = x1 y[i] = y1 Quadrant() z= x[i]*x[i] + y[i]*y[i] rer[i] = Math.SquareRoot(z) If rer[i] = 0 Then reang[i] = 0 else z = x[i]/rer[i] reang[i] = Math.ArcCos(z) endif Normalize() lix[1] = innercircle*Math.cos(reang[1]) liy[1] = innercircle*Math.Sin(reang[1]) i = 2 l2hoop: lix[i] = lix[i-1] +.02 If(lix[i] < x1) Then liy[i] = m*lix[i] +b i = i+1 Goto l2hoop EndIf lix[i] = x1 liy[i] = y1 cv = i+1 For j = 1 To i x1 = lix[cv-j] y1 = liy[cv-j] xpic[j+outline] = x1 ypic[j+outline] = y1 EndFor writepos = outline +i ' ===expand the inner area diffs = 5 badrad = .3 x[1] = xpic[1] y[1] = ypic[1] 'numk[1] = number[1] k=2 For j = 2 To writepos dist = Math.squareroot(xpic[j]*xpic[j] +ypic[j]*ypic[j]) 'numk[k] = number[j] x[k] = xpic[j-1] y[k] = ypic[j-1] k = k+1 If(dist > badrad) then Goto noadjust1 endif xdif = (xpic[j-1] - xpic[j])/diffs ydif = (ypic[j-1] - ypic[j])/diffs xs = xpic[j-1] ys = ypic[j-1] For l = 1 To diffs-1 xs = xs -xdif ys = ys -ydif 'numk[k] = number[j] x[k] = xs y[k] = ys k = k+1 endfor noadjust1: endfor ' now write it back into xpic writepos = k-1 For i = 1 to writepos xpic[i] = x[i] ypic[i] = y[i] xdisp[i] = x[i] ydisp[i] = y[i] endfor firstpart = writepos '================================= if( drawitfirst = 0) then Finishit() endif '==================== this completes and writes the outer circle ' 30 seems to work here 'xmul = 2.2 'mul = 1.1 x1 = x1 + 30*Math.Pi xz = Text.Append(x1," 0") '=============================== if( drawitfirst = 0) then File.WriteLine(FilePath,linx,xz) linx = linx +1 endif '===================================== a = x1/Math.Pi b = Math.Floor(a) c = Math.Round(a) a = b If(c>b) Then a = c EndIf x1 = a * Math.pi If (a-2* Math.Floor(a/2) >0 )then x1 = a*Math.Pi + Math.pi endif zoffset = x1 'now read and write the 2nd line inner circle writepos = 0 ' baseline is y disp +.1*ymul for .22 it equals .36 '.3 radius circle , subtract .1 for safety for inner one cirrad = .30 linelen = cirrad*2*math.pi-.1 textline = line2text GetLineText() xstarts = xstr[1] ystarts = ystr[1] 'tranfer to array xpic and set first point to 0,0 For i = 1 to outline -1 xrad[i] = (xstr[i] - xstarts)/cirrad yrad[i] = ystr[i] - ystarts +cirrad xstr[i] = yrad[i]*Math.Cos(xrad[i]) ystr[i] = yrad[i]*Math.Sin(xrad[i]) endfor startang = xrad[1] endang = xrad[outline-1] rottang = MAth.pi/2 - 2*Math.pi-(endang - startang)/2 'now draw a line from 0 0 to the first point x1 = -(xstr[1] *Math.cos(ROTtANG) - ystr[1] *Math.sin(ROTtANG)) y1 = xstr[1] *MAth.sin(ROTtANG) + ystr[1] *Math.cos(ROTtANG) m = y1/x1 b = y1 - m*x1 'second line center is 0,0 innercircle = 0 i= 1 x[i] = x1 y[i] = y1 Quadrant() z= x[i]*x[i] + y[i]*y[i] rer[i] = Math.SquareRoot(z) If rer[i] = 0 Then reang[i] = 0 else z = x[i]/rer[i] reang[i] = Math.ArcCos(z) endif Normalize() xpic[1] = innercircle*Math.cos(reang[1]) ypic[1] = innercircle*Math.Sin(reang[1]) i = 2 lhoop2: xpic[i] = xpic[i-1] -.02 If(xpic[i] > x1) Then ypic[i] = m*xpic[i] +b i = i+1 Goto lhoop2 EndIf xpic[i] = x1 ypic[i] = y1 firstline = i ' convert the rest ===================== For i = 1 To outline -1 x1 = -(xstr[i] *Math.cos(ROTtANG) - ystr[i] *Math.sin(ROTtANG)) y1 = xstr[i] *MAth.sin(ROTtANG) + ystr[i] *Math.cos(ROTtANG) xpic[i+firstline] = x1 ypic[i+firstline] = y1 EndFor 'bulk convert done ================================== 'set the real end point of xpic here outline = outline-1+firstline 'now draw a line from 0 0 to the last point 'you know x1 and y1 m = y1/x1 b = y1 - m*x1 i= 1 x[i] = x1 y[i] = y1 Quadrant() z= x[i]*x[i] + y[i]*y[i] rer[i] = Math.SquareRoot(z) If rer[i] = 0 Then reang[i] = 0 else z = x[i]/rer[i] reang[i] = Math.ArcCos(z) endif Normalize() lix[1] = innercircle*Math.cos(reang[1]) liy[1] = innercircle*Math.Sin(reang[1]) i = 2 l2hoop2: lix[i] = lix[i-1] +.02 If(lix[i] < x1) Then liy[i] = m*lix[i] +b i = i+1 Goto l2hoop2 EndIf lix[i] = x1 liy[i] = y1 cv = i+1 For j = 1 To i x1 = lix[cv-j] y1 = liy[cv-j] xpic[j+outline] = x1 ypic[j+outline] = y1 EndFor writepos = outline +i ' ===expand the inner area diffs = 5 badrad = .4 x[1] = xpic[1] y[1] = ypic[1] 'numk[1] = number[1] k=2 For j = 2 To writepos dist = Math.squareroot(xpic[j]*xpic[j] +ypic[j]*ypic[j]) 'numk[k] = number[j] x[k] = xpic[j-1] y[k] = ypic[j-1] k = k+1 If(dist > badrad) then Goto noadjust2 endif xdif = (xpic[j-1] - xpic[j])/diffs ydif = (ypic[j-1] - ypic[j])/diffs xs = xpic[j-1] ys = ypic[j-1] For l = 1 To diffs-1 xs = xs -xdif ys = ys -ydif 'numk[k] = number[j] x[k] = xs y[k] = ys k = k+1 endfor noadjust2: endfor ' now write it back into xpic writepos = k-1 For i = 1 to writepos xpic[i] = x[i] ypic[i] = y[i] xdisp[firstpart+i] = x[i] ydisp[firstpart+i] = y[i] endfor '=========================================== if( drawitfirst = 1) then GraphicsWindow.PenColor = "black" GraphicsWindow.PenWidth = 2 cenx = gw/2 ceny = gh/2 mul = 200 mul2 = 200 GraphicsWindow.Clear() For i = 1 To firstpart+writepos-1 x1 = xdisp[i]*mul +cenx y1 = ceny -ydisp[i]*mul2 x2 = xdisp[i+1]*mul +cenx y2 = ceny -ydisp[i+1]*mul2 GraphicsWindow.DrawLine(x1,y1,x2,y2) endfor Goto showtrace endif '=========================================== 'backfromshow2: Finishit() endif 'end of circular 2 line logic '==============Spiral logic here 1 line ====================== If( numblines = 1 ) then zoffset =314.159 'zoffset =78.53975+Math.Pi ' for fast test write 'xmul = 2.4 'ymul = 1.2 ROTANG = -Math.pi/2 + Rotangextra line2 = 1 a = .0215 b = .113 e = 2.718281828 incr = 10 i = 1 ' a is linear displacement adisp = .07 theta10 = incr*Math.pi r10 = a*Math.Power(e,b*theta10) s10 = Math.SquareRoot(b*b+1)/b*r10 ' s10 is the max value here 6.665926 line length linx = 3 xx = Text.Append(zoffset," 1") File.WriteLine(FilePath,1,"0 0") File.WriteLine(FilePath,2,xx) ' baseline is y disp +.1*ymul for .22 it equals .36 'line2 = 1 'linelen = 1.56 textline = line1text GetLineText() writepos = outline -1 a1 = xstr[1] b1 = ystr[1] For i = 1 To writepos xstr[i] = xstr[i] - a1 ystr[i] = ystr[i] - b1 endfor xmax = xstr[writepos] xmax1 = xmax/s10 'this is the % of max lenght now xmax2 = xmax1*.05 ' reduce the height at the end 5% For i = 1 To writepos sf = i/writepos sg = 1-xmax2*sf xstr[i] = xstr[i]*sg ystr[i] = ystr[i]*sg endfor 'TextWindow.WriteLine(writepos) 'TextWindow.WriteLine(xstr[writepos]) 'texdd = TextWindow.Read() ' s= -0.792160764 magic value to end 4 pi on the spiral '-0.663324539 3.5 pi works better while xstr[writepos] < 6.5-0.663324539 writepos = writepos +1 xstr[writepos] = xstr[writepos-1] +.012 ' .012 is size of x distance of blank ystr[writepos] = 0.0 'TextWindow.WriteLine(xstr[writepos]) endwhile ' add blank to the end here For i = 1 To writepos spir[i] = s10 - xstr[i] xx = (spir[i]*b)/(a*Math.SquareRoot(1+b*b)) theta[i] = Math.NaturalLog(xx)/b r[i] = a*Math.Power(e,b*theta[i])+ystr[i] endfor ROTANG = Math.pi For i = 1 To writepos xpic[i] = Math.cos(theta[i])*r[i] ypic[i] = Math.Sin(theta[i])*r[i] x1 = xpic[i] *Math.cos(ROTANG) - ypic[i] *Math.sin(ROTANG) y1 = xpic[i] *MAth.sin(ROTANG) + ypic[i] *Math.cos(ROTANG) xpic[i] = x1 + adisp ypic[i] = y1 endfor drawpos = writepos drawpreview() If(drawitfirst = 1) then Goto showtrace endif backfromshow3: ROTANG = -Math.pi/2 Finishit() 'write a last jump to the center x1 =reang[counter] +zoffset y1 = 0 zz = Text.GetLength(x1) If (zz> 9) Then zz = 9 EndIf x1 = Text.getsubtext(x1,1,zz) zz = Text.GetLength(y1) If (zz> 9) Then zz = 9 EndIf y1 = Text.getsubtext(y1,1,zz) xy = "" xy = Text.Append(xy,x1) xy = Text.Append(xy," ") xy = Text.Append(xy,y1) File.WriteLine(FilePath,linx,xy) endif '===============end of 1 line logic Goto itsdone '============================ endit: 'program is over in error GraphicsWindow.Clear() GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(70,20,"Program terminated For error") Program.Delay(3000) Program.end() '============================ itsdone: GraphicsWindow.FontSize = 14 GraphicsWindow.Clear() GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(70,20,"Conversion complete - File Written") secondtime = 1 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(70,50,"Do you want to write another text output file?") GraphicsWindow.BrushColor = button1color ' button 5 background bt1bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt1bkg,50,80) GraphicsWindow.BrushColor = button2color ' button 5 background bt2bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt2bkg,250,80) GraphicsWindow.BrushColor = button1shade ' button 1 at 100% opacity Button1 = Controls.AddButton("Make Another File",50,80) Shapes.SetOpacity(Button1, 60) GraphicsWindow.BrushColor = button9shade ' button 2 at 60% opacity Button2 = Controls.AddButton("End Program",250,80) Shapes.SetOpacity(Button2, 60) Controls.SetSize(Button1,buttonwidth,buttonheight) ' size buttons to match colored boxes Controls.SetSize(Button2,buttonwidth,buttonheight) Controls.ButtonClicked = OnButtonClick ' Button Wait Loop: '--------------------------------------------------------------------------------------------------------------------------------' Loopend: If Buttonpush <> "" Then ' Waits until Button is retrieved from Sub OnButtonClick. If( Buttonpush = Button1) then prevtexttype = 1 prevcursivetxt = cursivetxt Goto BigRepeat endif If( Buttonpush = Button2) then Program.End() endif Buttonpush = "" ButtonCap = "" EndIf Program.Delay(50) ' A quick delay to avoid heating up CPU! Goto Loopend '============================ this is for the draw example and select write .thr or enter again showtrace: 'GraphicsWindow.Clear() GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawText(70,20,"Please select the button to either write the .thr file") GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(70,40,"Or push the other button to reenter your text message") GraphicsWindow.FontSize = 12 GraphicsWindow.BrushColor = button12color ' button 5 background bt1bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt1bkg,50,80) GraphicsWindow.BrushColor = button11color ' button 5 background bt2bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt2bkg,250,80) GraphicsWindow.BrushColor = button12shade ' button 1 at 100% opacity Button1 = Controls.AddButton("Write the .thr file",50,80) Shapes.SetOpacity(Button1, 60) GraphicsWindow.BrushColor = button11shade ' button 2 at 60% opacity Button2 = Controls.AddButton("Re-enter text message",250,80) Shapes.SetOpacity(Button2, 60) Controls.SetSize(Button1,buttonwidth,buttonheight) ' size buttons to match colored boxes Controls.SetSize(Button2,buttonwidth,buttonheight) Controls.ButtonClicked = OnButtonClick ' Button Wait Loop: '--------------------------------------------------------------------------------------------------------------------------------' Loopend1: If Buttonpush <> "" Then ' Waits until Button is retrieved from Sub OnButtonClick. If( Buttonpush = Button1) then prevtexttype = 1 prevcursivetxt = cursivetxt drawitfirst = 0 ' don't redraw it GraphicsWindow.Clear() If (numblines = 3) then goto backfromshow1 endif If (numblines = 2) then GraphicsWindow.DrawText(20,50,"Starting Conversion - please wait") goto backfromshow2 ' this one has to redo the whole thing since it writes twce endif If (numblines = 1) then goto backfromshow3 endif endif If( Buttonpush = Button2) then returnedtext = 1 'Line1 = 0 'Line2 = 0 'Line3 = 0 Goto skipreadchr endif Buttonpush = "" ButtonCap = "" EndIf Program.Delay(50) ' A quick delay to avoid heating up CPU! Goto Loopend1 '========================SUBROUTINES START HERE================ sub Quadrant If Math.Abs(x[i]) < .0001 Then x[i] = 0 Goto Xzero EndIf If Math.Abs(y[i]) < .0001 Then y[i] = 0 Goto Yzero EndIf If x[i]>0 Then Goto quad14 Else Goto quad23 EndIf '=============== Xzero: If y[i] = 0 Then Pos[i] = 0 Else If y[i] >0 Then Pos[i] =1.5 Else Pos[i] = 3.5 EndIf EndIf Goto done '=============== Yzero: If x[i] = 0 Then Pos[i] = 0 Else If x[i] >0 Then Pos[i] = 0 Else Pos[i] = 2.5 EndIf EndIf Goto done '=============== quad14: If y[i] = 0 Then Pos[i] = 0 Goto done endif If y[i] >0 Then Pos[i] = 1 Else Pos[i] = 4 EndIf Goto done '=============== quad23: If y[i] = 0 Then Pos[i] = 2.5 Goto done EndIf If y[i] >0 Then Pos[i] = 2 Else Pos[i] = 3 EndIf '=============== done: endsub '================================================================== Sub Normalize ac = reang[i] If Pos[i] = 0 Then reang[i] = 0 Goto finp EndIf If Pos[i] = 1.5 then reang[i] = Math.pi/2 Goto finp endif If Pos[i] = 2.5 then reang[i] = Math.pi Goto finp endif If Pos[i] = 3.5 Then reang[i] = 1.5 * Math.pi Goto finp Endif If Pos[i] = 1 then reang[i] = ac Goto finp endif If Pos[i] = 2 then reang[i] = ac Goto finp endif If Pos[i] = 3 then reang[i] = 2*Math.pi- ac Goto finp EndIf If Pos[i] = 4 then reang[i] = 2*Math.pi- ac Goto finp EndIf finp: endsub '--------------------------------------------------------------------------------------------------------------------------------' ' Triggered Event Subs: 'sub On1ButtonClicked 'boxclick = Controls.LastClickedButton 'endsub '============================ sub OnTyped boxnum = Controls.LastTypedTextBox textline = Controls.GetTextBoxText(boxnum) laskey = GraphicsWindow.Lastkey EndSub '===================================================== Sub OnButtonClick Buttonpush = Controls.LastClickedButton ' Last selected button name ButtonCap = Controls.GetButtonCaption(Buttonpush) ' Its corresponding caption EndSub '======================================================= sub drawpreview ' this draws a preview instead of writing the .thr file if( drawitfirst = 1) then GraphicsWindow.PenColor = "black" GraphicsWindow.PenWidth = 2 cenx = gw/2 ceny = gh/2 mul = 200 mul2 = 200 GraphicsWindow.Clear() For i = 1 To drawpos-1 x1 = xpic[i]*mul +cenx y1 = ceny -ypic[i]*mul2 x2 = xpic[i+1]*mul +cenx y2 = ceny -ypic[i+1]*mul2 GraphicsWindow.DrawLine(x1,y1,x2,y2) endfor endif endsub '===================================================== 'Button Subroutines: '--------------------------------------------------------------------------------------------------------------------------------' sub CheckButtons If (buttonCap = "3 Straight Lines") then If(button1color = "white") Then button1color = "red" button1shade = "black" button2color = "white" button2shade = "blue" button3color = "white" button3shade = "blue" threelines = 1 typeselect = 1 numblines = 3 goto s1 EndIf If(button1color = "red") Then button1color = "white" button1shade = "blue" threelines = 0 typeselect = 0 numblines = "" endif s1: numlines = buttoncap EndIf If (buttonCap = "2 Curved Lines") then If(button2color = "white") Then button2color = "red" button2shade = "black" button1color = "white" button1shade = "blue" button3color = "white" button3shade = "blue" threelines = 0 typeselect = 1 numblines = 2 goto s2 EndIf If(button2color = "red") Then button2color = "white" button2shade = "blue" threelines = 0 typeselect = 0 numblines = "" endif s2: numlines = buttoncap EndIf If (buttoncap = "1 Spiral Line") then If(button3color = "white") Then button3color = "red" button3shade = "black" button1color = "white" button1shade = "blue" button2color = "white" button2shade = "blue" threelines = 0 typeselect = 1 numblines = 1 goto s3 EndIf If(button3color = "red") Then button3color = "white" button3shade = "blue" threelines = 0 typeselect = 0 numblines = "" endif s3: numlines = buttoncap EndIf If (Buttoncap = "Cursive Font") then If(button4color = "white") Then button4color = "green" button4shade = "black" button5color = "white" button5shade = "purple" fontselect = 1 cursivetxt = 1 goto s4 EndIf If(button4color = "green") Then button4color = "white" button4shade = "purple" fontselect = 0 cursivetxt = -1 endif s4: fonttype = buttoncap EndIf If (Buttoncap = "Printed Font") then If(button5color = "white") Then button5color = "green" button5shade = "black" button4color = "white" button4shade = "purple" fontselect = 1 cursivetxt = 0 goto s5 EndIf If(button5color = "green") Then button5color = "white" button5shade = "purple" fontselect = 0 cursivetxt = -1 endif s5: fonttype = buttoncap EndIf If (buttonCap = "Large") then ' If(button6color = "white") Then button6color = "purple" button6shade = "black" button7color = "white" button7shade = "green" button8color = "white" button8shade = "green" sizeselect = 1 goto s6 EndIf If(button6color = "purple") Then button6color = "white" button6shade = "green" sizeselect = 0 endif s6: size = buttoncap sizez = 1 EndIf If (buttonCap = "Medium") then If(button7color = "white") Then button7color = "purple" button7shade = "black" button6color = "white" button6shade = "green" button8color = "white" button8shade = "green" sizeselect = 1 goto s7 EndIf If(button7color = "purple") Then button7color = "white" button6shade = "green" sizeselect = 0 endif s7: size = buttoncap sizez = 2 EndIf If (buttonCap = "Small") then If(button8color = "white") Then button8color = "purple" button8shade = "black" button6color = "white" button6shade = "green" button7color = "white" button7shade = "green" sizeselect = 1 goto s8 EndIf If(button8color = "purple") Then button8color = "white" button6shade = "green" sizeselect = 0 endif s8: size = buttoncap sizez = 3 EndIf If (buttonCap = "Thick Erase (faster)") then If(button9color = "white") Then button9color = "green" button9shade = "red" button10color = "white" button10shade = "red" eraseselect = 1 zoffset =157.0795 goto s9 EndIf If(button9color = "green") Then button9color = "white" button9shade = "red" eraseselect = 0 endif s9: erasetype = buttoncap erazez = 1 EndIf If (buttonCap = "Thin Erase (better)") then If(button10color = "white") Then button10color = "green" button10shade = "red" button9color = "white" button9shade = "red" eraseselect = 1 zoffset =314.159 goto s10 EndIf If(button10color = "green") Then button10color = "white" button10shade = "red" eraseselect = 0 endif s10: erasetype = buttoncap erazez = 2 EndIf If (buttonCap = "Check Entries") then bigprob = 1 button11color = "red" button11shade = "black" If ( threelines = 1) Then If (typeselect + fontselect + sizeselect + eraseselect + rotprob + fileprob <> 6) then bigprob = -1 Goto s11 endif bigprob = 0 endif If ( threelines = 0) Then If (typeselect + fontselect + rotprob + fileprob <> 4) then bigprob = -1 Goto s11 endif bigprob = 0 EndIf s11: EndIf If (buttonCap = "Accept Entries") then bigprob = 1 button11color = "red" button11shade = "black" If ( threelines = 1) Then If (typeselect + fontselect + sizeselect + eraseselect + rotprob + fileprob <> 6) then bigprob = -1 Goto s12 endif bigprob = 0 endif If ( threelines = 0) Then If (typeselect + fontselect + rotprob + fileprob <> 4) then bigprob = -1 Goto s12 endif bigprob = 0 EndIf s12: EndIf Gui() endsub '--------------------------------------------------------------------------------------------------------------------------------' sub Gui GraphicsWindow.Clear() GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(70, 20, "1) Select one button below with the Type of Text Line output to generate") GraphicsWindow.DrawText(100, 110, "2) Select one button below with the Style of Text output to write") If (threelines = 1) then GraphicsWindow.DrawText(120, 200, "3) Select one button below with the Size of Text to use") GraphicsWindow.DrawText(120, 290, "4) Select one button below with finess of Erase to use") EndIf GraphicsWindow.DrawText(120, 380, "A) Enter an whole number between 0 - 360 degrees to rotate the output") GraphicsWindow.DrawText(120, 400, " Enter 0 for no rotation") GraphicsWindow.DrawText(120, 470, "B) Enter the filename to output (don't type the .thr extension)") GraphicsWindow.DrawText(110, 660, "LAST) Push the button below after you fill in all of the form above") GraphicsWindow.BrushColor = "red" If (numblines <> "") then GraphicsWindow.DrawText(250, 530, "Style = "+ numlines) endif If (fontselect =1) then GraphicsWindow.DrawText(250, 550, "Font = "+ fonttype) endif If (threelines = 1) then If (sizeselect =1) then GraphicsWindow.DrawText(250, 570, "Size = "+ Size) EndIf If (eraseselect =1) then GraphicsWindow.DrawText(250, 590, "Erase = "+ erasetype) endif endif If rotprob = 1 then GraphicsWindow.DrawText(250, 610, "Rotation = "+ Rotangextr) EndIf If rotprob = 0 then GraphicsWindow.DrawText(250, 610, "Rotation value invalid") EndIf If (filenamz <> "") then If fileprob = 1 then GraphicsWindow.DrawText(250, 630, "Filename = "+ filenamz) endif If fileprob = 0 then GraphicsWindow.DrawText(250, 630, "Filename invalid") EndIf If fileprob = -1 then GraphicsWindow.DrawText(250, 630, "Can't Write Output File to your disk") EndIf endif GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(110, 660, "LAST) Push the button below after you fill in all of the form above") If (bigprob = -1) then GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(135, 730, "Not all items are selected or text fields are blank or invalid!" ) endif GraphicsWindow.PenColor = "white" GraphicsWindow.BrushColor = button1color ' button 1 background bt1bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt1bkg,25,50) GraphicsWindow.BrushColor = button2color ' button 2 background bt2bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt2bkg,225,50) GraphicsWindow.BrushColor = button3color ' button 3 background bt3bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt3bkg,425,50) GraphicsWindow.BrushColor = button4color ' button 4 background bt4bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt4bkg,125,140) GraphicsWindow.BrushColor = button5color ' button 5 background bt5bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt5bkg,325,140) If (threelines = 1) then GraphicsWindow.BrushColor = button6color ' button 3 background bt6bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt6bkg,25,230) GraphicsWindow.BrushColor = button7color ' button 4 background bt7bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt7bkg,225,230) GraphicsWindow.BrushColor = button8color ' button 5 background bt8bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt8bkg,425,230) GraphicsWindow.BrushColor = button9color ' button 4 background bt9bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt9bkg,125,320) GraphicsWindow.BrushColor = button10color ' button 5 background bt10bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt10bkg,325,320) endif GraphicsWindow.BrushColor = button11color ' button 5 background bt11bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt11bkg,215,685) GraphicsWindow.BrushColor = button1shade ' button 1 at 100% opacity Button1 = Controls.AddButton("3 Straight Lines",25,50) Shapes.SetOpacity(Button1, 60) GraphicsWindow.BrushColor = button2shade ' button 2 at 60% opacity Button2 = Controls.AddButton("2 Curved Lines",225,50) Shapes.SetOpacity(Button2, 60) GraphicsWindow.BrushColor = button3shade ' button 2 at 60% opacity Button3 = Controls.AddButton("1 Spiral Line",425,50) Shapes.SetOpacity(Button3, 60) GraphicsWindow.BrushColor = button4shade ' button 2 at 60% opacity Button4 = Controls.AddButton("Cursive Font",125,140) Shapes.SetOpacity(Button4, 60) GraphicsWindow.BrushColor = button5shade ' button 2 at 60% opacity Button5 = Controls.AddButton("Printed Font",325,140) Shapes.SetOpacity(Button5, 60) If(threelines = 1) then GraphicsWindow.BrushColor = button6shade ' button 2 at 60% opacity Button6 = Controls.AddButton("Large",25,230) Shapes.SetOpacity(Button6, 60) GraphicsWindow.BrushColor = button7shade ' button 2 at 60% opacity Button7 = Controls.AddButton("Medium",225,230) Shapes.SetOpacity(Button7, 60) GraphicsWindow.BrushColor = button8shade ' button 2 at 60% opacity Button8 = Controls.AddButton("Small",425,230) Shapes.SetOpacity(Button8, 60) GraphicsWindow.BrushColor = button9shade ' button 2 at 60% opacity Button9 = Controls.AddButton("Thick Erase (faster)",125,320) Shapes.SetOpacity(Button9, 60) GraphicsWindow.BrushColor = button10shade ' button 2 at 60% opacity Button10 = Controls.AddButton("Thin Erase (better)",325,320) Shapes.SetOpacity(Button10, 60) endif If(Pass = 0) then GraphicsWindow.BrushColor = button11shade ' button 2 at 60% opacity Button11 = Controls.AddButton("Check Entries",215,685) Shapes.SetOpacity(Button11, 60) endif If(Pass = 1) then GraphicsWindow.BrushColor = button11shade ' button 2 at 60% opacity Button11 = Controls.AddButton("Accept Entries",215,685) Shapes.SetOpacity(Button11, 60) endif GraphicsWindow.Brushcolor = "red" rotation = Controls.AddTextBox(245, 420) Controls.SetTextBoxText(rotation,Rotangextr) filename = Controls.AddTextBox(245, 490) Controls.SetTextBoxText(filename,filenamz) Controls.SetSize(Button1,buttonwidth,buttonheight) ' size buttons to match colored boxes Controls.SetSize(Button2,buttonwidth,buttonheight) Controls.SetSize(Button3,buttonwidth,buttonheight) Controls.SetSize(Button4,buttonwidth,buttonheight) Controls.SetSize(Button5,buttonwidth,buttonheight) If (threelines = 1) then Controls.SetSize(Button6,buttonwidth,buttonheight) Controls.SetSize(Button7,buttonwidth,buttonheight) Controls.SetSize(Button8,buttonwidth,buttonheight) Controls.SetSize(Button9,buttonwidth,buttonheight) Controls.SetSize(Button10,buttonwidth,buttonheight) endif Controls.SetSize(Button11,buttonwidth,buttonheight) endsub '================================================================================ Sub checkvalid ' this just checks the rotation angle and filename on the first screen rotprob = 1 ' not a problem fileprob = 0 i = Text.GetLength(Rotangextr) For j = 1 To i c = Text.GetCharacterCode(Text.GetSubText(Rotangextr,j,1)) If (c > 57 Or c < 48) Then rotprob = 0 Goto probs endif endfor If (Rotangextr > 360 Or Rotangextr < 0) Then rotprob = 0 Goto probs endif Rotangextra = Math.pi*Rotangextr/180 probs: i = Text.GetLength(filenamz) If (i = 0) Then Goto filprob endif For j = 1 To i c = Text.GetCharacterCode(Text.GetSubText(filenamz,j,1)) If (c < 47) Then ' less than 0 Goto filprob endif If (c < 58) Then ' between 9 and a Goto itsok endif If (c < 65) Then ' less than A Goto filprob endif If (c < 91) Then ' between A and Z Goto itsok endif If (c < 97) Then ' less than A Goto filprob endif If (c < 123) Then ' between A and Z Goto itsok endif Goto filprob itsok: endfor fileprob = 1 Goto noprob filprob: fileprob = 0 'if(filenameprob = 1) then 'Goto kickback 'endif noprob: endsub '=========================================================== Sub shorten zz = Text.GetLength(x1) If (zz> 6) Then zz = 6 EndIf x1 = Text.getsubtext(x1,1,zz) EndSub '---------------------------------------------------------------------------------------------------------------------------------- Sub Line3Screen linelen1 = 1.56 linelen2 = 1.9 linelen3 = 1.56 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(25, 10, "Input Text In the 3 entry fields below and push Button when done") GraphicsWindow.BrushColor = "blue" GraphicsWindow.FontSize = 16 Line1 = Controls.AddTextBox(25, 60) Controls.SetSize(Line1,120,30) Line2 = Controls.AddTextBox(25, 120) Controls.SetSize(Line2,150,30) Line3 = Controls.AddTextBox(25, 180) Controls.SetSize(Line3,120,30) GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawText(25, 40, "Line 1") GraphicsWindow.DrawText(25, 100, "Line 2") GraphicsWindow.DrawText(25, 160, "Line 3") If(returnedtext = 1) Then GraphicsWindow.BrushColor = "blue" Controls.SetTextBoxText(Line1,line1text) textline = line1text CheckText() line1len = x2 GraphicsWindow.FontSize = 12 xx1 = Text.Append("your line length is ",line1len) ' this is 3 line case and single line case first line xx1 = Text.Append(xx1," of a maximum ") xx1 = Text.Append(xx1,linelen1) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(line1x,line1y,xx1) Controls.SetTextBoxText(Line2,line2text) textline = line2text CheckText() line2len = x2 xx2 = Text.Append("your line length is ",line2len) xx2 = Text.Append(xx2," of a maximum ") xx2 = Text.Append(xx2,linelen2) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(line2x,line2y,xx2) Controls.SetTextBoxText(Line3,line3text) textline = line3text CheckText() line3len = x2 xx3 = Text.Append("your line length is ",line3len) xx3 = Text.Append(xx3," of a maximum ") xx3 = Text.Append(xx3,linelen3) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(150, 185,xx3) Line1valid = 1 Line2valid = 1 Line3valid = 1 returnedtext = 0 boxnum = -1 Buttonpush = -1 endif GraphicsWindow.BrushColor = button11color ' button 1 background bt11bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt11bkg,50,250) GraphicsWindow.BrushColor = button12color ' button 1 background bt12bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt12bkg,280,250) GraphicsWindow.BrushColor = button11shade ' button 1 at 100% opacity Button11 = Controls.AddButton("Generate .thr file!",50,250) Shapes.SetOpacity(Button11, 60) GraphicsWindow.BrushColor = button12shade ' button 1 at 100% opacity Button12 = Controls.AddButton("Draw preview first",280,250) Shapes.SetOpacity(Button12, 60) Controls.SetSize(Button11,buttonwidth,buttonheight) Controls.SetSize(Button12,buttonwidth,buttonheight) GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(60, 320, "Legal characters to enter are a-z, A-Z, 0-9 and , ? ! $ % & and space ") endsub '========================================================== Sub Line2Screen cirrad = .70 linelen = cirrad*2*math.pi-.1 x1 = linelen shorten() linelen1 = x1 cirrad = .30 linelen2 = cirrad*2*math.pi-.1 x1 = linelen2 shorten() linelen2 = x1 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(25, 10, "Input Text In the 2 (circular path) entry fields below and push Button when done") GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawText(25, 40, "Line 1") GraphicsWindow.FontSize = 16 Line1 = Controls.AddTextBox(25, 60) Controls.SetSize(Line1,300,30) GraphicsWindow.FontSize = 14 GraphicsWindow.DrawText(25, 100, "Line 2") GraphicsWindow.FontSize = 16 Line2 = Controls.AddTextBox(25, 120) Controls.SetSize(Line2,125,30) 'xy = Text.Append("Your line length is ",xlen) 'xy = Text.Append(xy," of a maximum ") 'xy = Text.Append(xy,linelen2) If(returnedtext = 1) Then GraphicsWindow.FontSize = 12 Controls.SetTextBoxText(Line1,line1text) textline = line1text CheckText() line1len = x2 GraphicsWindow.BrushColor = "white" GraphicsWindow.fillRectangle(333,53,400,20) xx1 = Text.Append("Your line length is ",line1len) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(335, 55,xx1) xy1a = Text.Append("of a maximum ",linelen1) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(335, 75,xy1a) Controls.SetTextBoxText(Line2,line2text) textline = line2text CheckText() line2len = x2 xx2 = Text.Append("your line length is ",line2len) xx2 = Text.Append(xx2," of a maximum ") xx2 = Text.Append(xx2,linelen2) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(line2x,line2y,xx2) Line1valid = 1 Line2valid = 1 'Line3valid = 1 returnedtext = 0 boxnum = -1 Buttonpush = -1 endif GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = button11color ' button 1 background bt11bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt11bkg,50,170) GraphicsWindow.BrushColor = button12color ' button 1 background bt12bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt12bkg,280,170) GraphicsWindow.BrushColor = button11shade ' button 1 at 100% opacity Button11 = Controls.AddButton("Generate .thr file!",50,170) Shapes.SetOpacity(Button11, 60) GraphicsWindow.BrushColor = button12shade ' button 1 at 100% opacity Button12 = Controls.AddButton("Draw preview first",280,170) Shapes.SetOpacity(Button12, 60) Controls.SetSize(Button11,buttonwidth,buttonheight) Controls.SetSize(Button12,buttonwidth,buttonheight) ' 'GraphicsWindow.BrushColor = button12color ' button 1 background 'bt12bkg = Shapes.AddRectangle(150,40) 'Shapes.Move(bt12bkg,225,170) 'GraphicsWindow.BrushColor = button12shade ' button 1 at 100% opacity 'Button12 = Controls.AddButton("Generate .thr file!",225,line2bx) 'Shapes.SetOpacity(Button12, 60) 'Controls.SetSize(Button12,buttonwidth,buttonheight) GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(60, 240, "Legal characters to enter are a-z, A-Z, 0-9 and , ? ! $ % & and space ") endsub '------------------------------------------------------------- ' 1 line version Sub Line1screen 'linelen = 6.6659 linelen1 = 5 GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "red" GraphicsWindow.DrawText(25, 15, "Updating length on this long text string is slow - please be patient") GraphicsWindow.BrushColor = "blue" GraphicsWindow.DrawText(25, 40, "Input Text into the field below and push Button when done") GraphicsWindow.FontSize = 16 Line1 = Controls.AddTextBox(25, 60) Controls.SetSize(Line1,450,30) If(returnedtext = 1) Then GraphicsWindow.FontSize = 12 Controls.SetTextBoxText(Line1,line1text) textline = line1text CheckText() len1len = x2 xx1 = Text.Append("your line length is ",line1len) ' this is 3 line case and single line case first line xx1 = Text.Append(xx1," of a maximum ") xx1 = Text.Append(xx1,linelen1) GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(line1x,line1y,xx1) Line1valid = 1 'Line2valid = 1 'Line3valid = 1 returnedtext = 0 boxnum = -1 Buttonpush = -1 endif GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = button11color ' button 1 background bt11bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt11bkg,50,140) GraphicsWindow.BrushColor = button12color ' button 1 background bt12bkg = Shapes.AddRectangle(150,40) Shapes.Move(bt12bkg,280,140) GraphicsWindow.BrushColor = button11shade ' button 1 at 100% opacity Button11 = Controls.AddButton("Generate .thr file!",50,140) Shapes.SetOpacity(Button11, 60) GraphicsWindow.BrushColor = button12shade ' button 1 at 100% opacity Button12 = Controls.AddButton("Draw preview first",280,140) Shapes.SetOpacity(Button12, 60) Controls.SetSize(Button11,buttonwidth,buttonheight) Controls.SetSize(Button12,buttonwidth,buttonheight) GraphicsWindow.FontSize = 14 GraphicsWindow.BrushColor = "black" GraphicsWindow.DrawText(60, 280, "Legal characters to enter are a-z, A-Z, 0-9 and , ? ! $ % & and space ") endsub '=========================================================== Sub CheckText loopback: ab = Text.GetLength(textline) If(ab = 0) Then xlen = 0 textline ="" Goto getout EndIf illegal = 0 If(laskey ="Back") Then laskey = 0 goto skip45 endif 'for the circle version = make the first text start at character 2, since chacter 1 is a space For i = 1 To ab chr = Text.getSubText(textline,i,1) ac[i] = Text.GetCharacterCode(chr) 'space If(ac[i] = 32) Then Goto skip4 endif ' comma If(ac[i] = 44) Then Goto skip4 endif ' ? If(ac[i] = 63) Then Goto skip4 endif 'exclamation point If(ac[i] = 33) Then Goto skip4 endif 'dollar sign If(ac[i] = 36) Then Goto skip4 endif 'percentage If(ac[i] = 37) Then Goto skip4 endif 'ampersand If(ac[i] = 38) Then Goto skip4 endif 'GraphicsWindow.BrushColor = "red" ' less than numbers If (ac[i] <48) Then illegal = 1 Goto getout EndIf 'between numbers and capital letters If ( ac[i] > 57 And ac[i] < 65) Then illegal = 1 Goto getout EndIf ' between capital and small If ( ac[i] > 90 And ac[i] < 97) Then illegal = 1 Goto getout EndIf If (ac[i] >122) Then illegal = 1 Goto getout EndIf skip4: endfor skip45: ' now make a data output of the text line GetLenCommon() zz = Text.GetLength(xlen) If (zz> 6) Then zz = 6 EndIf x2 = Text.getsubtext(xlen,1,zz) getout: 'getout: endsub '====================get a line of text Sub GetLineText ab = Text.GetLength(textline) 'for the circle version = make the first text start at character 2, since chacter 1 is a space For i = 1 To ab chr = Text.getSubText(textline,i,1) ac[i] = Text.GetCharacterCode(chr) endfor ' ac[i] = character in set 'xchr[i] = individual character valuse from read memory 'xstr[i] = the constucted line of text ' xlen = length of the xstr sting of values ' now make a data output of the text line GetLenCommon() endsub '=================================================== Sub GetLenCommon '*****************DIFFERENT************** If(numblines <>2) Then Goto itsstraight1 endif ' first character is a space for the circle 2 line version 'add a space and the start and the end For i = 1 to ab j = ab + 2 -i ac[j] = ac[j-1] endfor ac[1] = 32 ac[ab+2] = 32 ' now add the 2 spaces at the ends ab = ab+2 itsstraight1: '*****************DIFFERENT************** xstart = 0 outline = 1 'first character is lower start point - do separate 'space If(ac[1] = 32) Then disp = 1 endif If(ac[1] = 44) Then disp = 91 endif If(ac[1] = 63) Then disp = 92 endif If(ac[1] = 33) Then disp = 95 endif If(ac[1] = 38) Then disp = 93 endif If(ac[1] = 36) Then disp = 94 endif If(ac[1] = 37) Then disp = 96 endif If (ac[1] >47 And ac[1] <58) Then disp = ac[1] -46 EndIf If ( ac[1] > 64 And ac[1] < 91) Then disp = ac[1] -53 EndIf If ( ac[1] > 96 And ac[1] < 123) Then disp = ac[1] -59 EndIf '============================================== if (cursivetxt = 1 )then Goto xxcb EndIf dist = .005 ' this is for T and t If (ac[1] = 84) then 'T dist = .002 If (ac[2] = 84) then 't dist = .0007 Goto xxcb endif If (ac[2] = 106) then 'j dist = -.0025 Goto xxcb endif Goto xxcb endif If (ac[1] = 116) then ''t dist = .0035 If(ac[2] = 116) then 't dist = .005 Goto xxcb endif If (ac[2] = 106) then 'j dist = -.001 Goto xxcb endif If(ac[2] = 98) then ' b next (general) dist = .006 Goto xxcb endif If(ac[2] = 104) then 'h next (general) dist = .006 Goto xxcb endif If(ac[2] = 107) then ' k next (general) dist = .006 Goto xxcb endif If(ac[2] = 108) then ' l next (general) dist = .006 Goto xxcb endif Goto xxcb endif If(ac[1] = 70) then 'F (general) dist = .005 If(ac[2] = 106) then ' j next (general) dist = .001 Goto xxcb endif If(ac[2] = 98) then ' b next (general) dist = .007 Goto xxcb endif If(ac[2] = 100) then 'd next (general) dist = .005 Goto xxcb endif If(ac[2] = 102) then 'f next (general) dist = .007 Goto xxcb endif If(ac[2] = 104) then 'h next (general) dist = .007 Goto xxcb endif If(ac[2] = 107) then ' k next (general) dist = .007 Goto xxcb endif If(ac[2] = 108) then ' l next (general) dist = .007 Goto xxcb endif If(ac[2] = 116) then 't dist = .006 Goto xxcb endif If(ac[2] = 120) then ' x next (general) dist = .006 Goto xxcb endif Goto xxcb endif If(ac[1] = 102) then ' f (general) dist = .004 If(ac[2] = 106) then ' j next (general) dist = .0005 Goto xxcb endif If(ac[2] = 98) then ' b next (general) dist = .005 Goto xxcb endif If(ac[2] = 102) then 'f next (general) dist = .005 Goto xxcb endif If(ac[2] = 104) then 'h next (general) dist = .005 Goto xxcb endif If(ac[2] = 107) then ' k next (general) dist = .005 Goto xxcb endif If(ac[2] = 108) then ' l next (general) dist = .005 Goto xxcb endif If(ac[2] = 116) then 't dist = .005 Goto xxcb endif Goto xxcb endif If(ac[2] = 98) then ' b next (general) dist = .006 Goto xxcb endif If(ac[2] = 104) then 'h next (general) dist = .006 Goto xxcb endif If(ac[2] = 107) then ' k next (general) dist = .006 Goto xxcb endif If(ac[2] = 108) then ' l next (general) dist = .006 Goto xxcb endif If(ac[2] = 120) then ' x next (general) dist = .003 Goto xxcb endif If(ac[2] = 106) then ' j next (general) dist = .002 Goto xxcb endif If(ac[2] = 116) then ' t next (general) dist = .003 Goto xxcb endif If(ac[1] = 106) then ' j (general) dist = .004 Goto xxcb endif If (ac[1] = 99) then 'c dist = .004 endif xxcb: '**************************************************************** stz = start[disp] enz = ends[disp] For j = stz To enz xstr[outline] = xChr[j]*xmul + xstart ystr[outline] = yChr[j]*ymul ' outline = outline +1 EndFor ' this is the new stuff if (cursivetxt = 1 )then Goto nokern EndIf For ii = 1 To 4 xstr[outline] = dist*xmul + xstr[outline-1] 'xstr[outline] = dist*xmul + xdf ystr[outline] = .1*ymul 'ystr[outline] = .1*ymul+ydisp outline = outline +1 endfor nokern: xstart = xstr[outline-1] ' end new For i = 2 to ab If(ac[i] = 32) Then disp = 1 Goto skipspace endif If(ac[i] = 44) Then disp = 91 Goto skipspace endif If(ac[i] = 63) Then disp = 92 Goto skipspace endif If(ac[i] = 33) Then disp = 95 Goto skipspace endif If(ac[i] = 38) Then disp = 93 Goto skipspace endif If(ac[i] = 36) Then disp = 94 Goto skipspace endif If(ac[i] = 37) Then disp = 96 Goto skipspace endif If (ac[i] >47 And ac[i] <58) Then disp = ac[i] -46 Goto skipspace EndIf If ( ac[i] > 64 And ac[i] < 91) Then disp = ac[i] -53 Goto skipspace EndIf If ( ac[i] > 96 And ac[i] < 123) Then disp = ac[i] -59 EndIf last = ac[i-1] ' print part - skip the upper connect If(cursivetxt = 0) then Goto skipspace endif ' b o, v, w , trigger upper If (last = 98) Then disp = disp +27 EndIf If (last = 111) Then disp = disp +27 EndIf If (last = 118) Then disp = disp +27 EndIf If (last = 119) Then disp = disp +27 EndIf skipspace: '***************************************************************** if (cursivetxt = 1 )then Goto xxcv EndIf dist = .005 ' this is for T and t If (ac[i] = 84) then 'T dist = .002 If (ac[i+1] = 84) then 't dist = .0007 Goto xxcv endif If (ac[i+1] = 106) then 'j dist = -.0025 Goto xxcv endif Goto xxcv endif If (ac[i] = 116) then ''t dist = .0035 If(ac[i+1] = 116) then 't dist = .005 Goto xxcv endif If (ac[i+1] = 106) then 'j dist = -.001 Goto xxcv endif If(ac[i+1] = 98) then ' b next (general) dist = .006 Goto xxcv endif If(ac[i+1] = 104) then 'h next (general) dist = .006 Goto xxcv endif If(ac[i+1] = 107) then ' k next (general) dist = .006 Goto xxcv endif If(ac[i+1] = 108) then ' l next (general) dist = .006 Goto xxcv endif Goto xxcv endif If(ac[i] = 70) then 'F (general) dist = .005 If(ac[i+1] = 106) then ' j next (general) dist = .001 Goto xxcv endif If(ac[i+1] = 98) then ' b next (general) dist = .007 Goto xxcv endif If(ac[i+1] = 100) then 'd next (general) dist = .005 Goto xxcv endif If(ac[i+1] = 102) then 'f next (general) dist = .007 Goto xxcv endif If(ac[i+1] = 104) then 'h next (general) dist = .007 Goto xxcv endif If(ac[i+1] = 107) then ' k next (general) dist = .007 Goto xxcv endif If(ac[i+1] = 108) then ' l next (general) dist = .007 Goto xxcv endif If(ac[i+1] = 116) then 't dist = .006 Goto xxcv endif If(ac[i+1] = 120) then ' x next (general) dist = .006 Goto xxcv endif Goto xxcv endif If(ac[i] = 102) then ' f (general) dist = .004 If(ac[i+1] = 106) then ' j next (general) dist = .0005 Goto xxcv endif If(ac[i+1] = 98) then ' b next (general) dist = .005 Goto xxcv endif If(ac[i+1] = 102) then 'f next (general) dist = .005 Goto xxcv endif If(ac[i+1] = 104) then 'h next (general) dist = .005 Goto xxcv endif If(ac[i+1] = 107) then ' k next (general) dist = .005 Goto xxcv endif If(ac[i+1] = 108) then ' l next (general) dist = .005 Goto xxcv endif If(ac[i+1] = 116) then 't dist = .005 Goto xxcv endif Goto xxcv endif If(ac[i+1] = 98) then ' b next (general) dist = .006 Goto xxcv endif If(ac[i+1] = 104) then 'h next (general) dist = .006 Goto xxcv endif If(ac[i+1] = 107) then ' k next (general) dist = .006 Goto xxcv endif If(ac[i+1] = 108) then ' l next (general) dist = .006 Goto xxcv endif If(ac[i+1] = 106) then ' j next (general) dist = .002 Goto xxcv endif If(ac[i+1] = 116) then ' t next (general) dist = .003 Goto xxcv endif If(ac[i+1] = 120) then ' x next (general) dist = .003 Goto xxcv endif If(ac[i] = 106) then ' j (general) dist = .004 Goto xxcv endif If (ac[i] = 99) then 'c dist = .004 endif xxcv: '**************************************************************** stz = start[disp] enz = ends[disp] stz = stz +1 For j = stz To enz xstr[outline] = xChr[j]*xmul +xstart ystr[outline] = yChr[j]*ymul outline = outline +1 EndFor ' this is the new stuff 'xdf = xstr[outline-1] if (cursivetxt = 1 )then Goto nokern1 EndIf ' add .02 to end For ii = 1 To 4 xstr[outline] = dist*xmul + xstr[outline-1] 'xstr[outline] = dist*xmul + xdf ystr[outline] = .1*ymul 'ystr[outline] = .1*ymul+ydisp outline = outline +1 endfor nokern1: xstart = xstr[outline-1] ' this is the new stuff endfor xlen = xstart endsub '===================================================== Sub StraightLogic ' this parses each line of straight text centtext = (2 - xlen)/2 -1.0 ' center it 'now generate a line to start point y1 = ydisp + .1 *ymul linest = -(Math.Squareroot(1 - y1*y1) -.02) x1 = linest ' keep the start point of this line startwrite = writepos +1 loopsz: If(Math.Abs(centtext) < Math.Abs(x1)) Then writepos = writepos +1 xpic[writepos] = x1 ypic[writepos] = y1 x1 = x1 + .005 Goto loopsz endif ' go to the outside 'reverse sides of table For line on other side linest = - linest For i = 1 to outline -1 xstr[i] = xstr[i] + centtext ystr[i] = ystr[i] + ydisp xpic[i+writepos] = xstr[i] ypic[i+writepos] = ystr[i] endfor writepos = writepos + outline -1 ' now generate a line on the other side from the end of the text x1 = Math.Abs(centtext) y1 = ydisp + .1*ymul loop2sz: If(Math.Abs(x1) >= Math.Abs(linest)) Then Goto loopout EndIf writepos = writepos +1 x1 = x1 + .005 xpic[writepos] = x1 ypic[writepos] = y1 Goto loop2sz 'write last x point at linest, y1 loopout: writepos = writepos +1 x1 = linest xpic[writepos] = x1 ypic[writepos] = y1 ' save the end point for the side drop points to the next line oldlinest = linest endwrite = writepos ' start position for line 2 in outlet file endsub '===================================================== sub Finishit ' this is the engine that conversts the cartesian map of characters ' into a polar form that the sisyphus table can understand ' write it alll out GraphicsWindow.DrawText(20,90,"Working hard here - writing file data") 'this is just debug code '============================== filenamr = "\"+ "xyout" filePat = path+filenamr+".txt" linzz = 1 'For i = 1 To writepos For i = 1 To 100 xy = "" xy = Text.Append(xy,xpic[i]) xy = Text.Append(xy," ") xy = Text.Append(xy,ypic[i]) File.WriteLine(FilePat,linzz,xy) linzz = linzz+1 endfor File.DeleteFile(FilePat) '=============================== For i = 1 To writepos ' rotate and mirror and set up final value as x[i], y[i] for polar conversion ' the table software rotates all images 90 degrees from normal zero point and mirrors X axis 'so compensate and reverse the effect 'Goto nomirrow 'mirror it If(xpic[i] < 0) Then xpic[i] = Math.Abs(xpic[i]) else xpic[i] = -xpic[i] EndIf 'rotate it x1 = xpic[i] *Math.cos(ROTANG) - ypic[i] *Math.sin(ROTANG) y1 = xpic[i] *MAth.sin(ROTANG) + ypic[i] *Math.cos(ROTANG) '================================ 'nomirrow: 'x1 = xpic[i] 'y1 = ypic[i] '================================ zz = Text.GetLength(x1) If (zz> 9) Then zz = 9 EndIf x1 = Text.getsubtext(x1,1,zz) zz = Text.GetLength(y1) If (zz> 9) Then zz = 9 EndIf y1 = Text.getsubtext(y1,1,zz) 'check limits If (Math.SquareRoot(x1*x1+y1*y1)>1) Then TextWindow.WriteLine("values out of range") Goto endout endif x[i] = x1 y[i] = y1 endfor direct[1] = 1 counter = writepos line_number = 1 For i = 1 To counter Quadrant() endfor line_number = 1 ' convert x y to polar For j = 1 to counter z= x[j]*x[j] + y[j]*y[j] rer[j] = Math.SquareRoot(z) If rer[j] = 0 Then reang[j] = 0 else z = x[j]/rer[j] reang[j] = Math.ArcCos(z) endif 'rxang[j] = reang[j] i = j Normalize() endfor '========================================================== 'erase this 'now - find where it crosses the quadrant 1/4 axis adder = 0 fourone = 0 onefour = 0 For i = 2 to counter 'look for four to one cross If(Pos[i-1] = 4) Then 'Goto noupcross if (Pos[i] = 1 OR Pos[i] = 0) then fourone = fourone +1 endif EndIf noupcross: If(Pos[i-1] = 1 Or Pos[i-1] = 0) Then 'Goto nodowncross if (Pos[i] = 4 ) then 'if (onefour = 1) Then fourone = fourone -1 'EndIf 'onefour = 1 endif EndIf nodowncross: ' just being paranoid 'If(fourone < 0) Then 'fourone = 0 'EndIf 'adder = adder + fourone*2*Math.pi reang[i] = reang[i] + fourone*2*Math.pi endfor For i = 1 To counter x1 =reang[i] +zoffset y1 = rer[i] zz = Text.GetLength(x1) If (zz> 9) Then zz = 9 EndIf x1 = Text.getsubtext(x1,1,zz) zz = Text.GetLength(y1) If (zz> 9) Then zz = 9 EndIf y1 = Text.getsubtext(y1,1,zz) xy = "" xy = Text.Append(xy,x1) xy = Text.Append(xy," ") xy = Text.Append(xy,y1) File.WriteLine(FilePath,linx,xy) linx = linx+1 endfor endsub