This article contains a sample script which creates a circular BLN file.
To run this script:
- Copy the script below, or download the attached BAS file: circle2.bas.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
- Click Script | Run to run the script.
*********
'Circle2.bas creates a circular BLN file.
Sub main
Debug.Print "-----";Time;" -----"
Begin Dialog UserDialog 400,140,"Circle Origin and Radius" ' %GRID:10,7,1,1
TextBox 190,15,170,21,.OriginX
TextBox 190,45,170,21,.OriginY
TextBox 190,75,170,21,.Radius
Text 30,15,140,21,"X Coordinate of Origin",.Text1
Text 30,45,140,21,"Y Coordinate of Origin",.Text2
Text 30,75,140,21,"Circle Radius",.Text3
OKButton 60,105,90,21
CancelButton 200,105,90,21
End Dialog
Dim dlg As UserDialog
On Error GoTo theend
Dialog dlg
On Error GoTo 0
originX = dlg.originX
originY = dlg.originY
radius = dlg.radius
If originx = "" Or originy = "" Or radius = "" Then End
BLNFile=GetFilePath("circle.bln","bln", ,"Output BLN File",2)
Debug.Print " PROCESSING INSTRUCTIONS - PLEASE WAIT . . ."
xorigin=Val(originx)
yorigin=Val(originy)
rad=Val(radius)
If BLNFile="" Then End
Open BLNFile For Output As #1
Print #1, "37 0"
For DEGREE= 0 To 360 Step 10 'Use 1 to blank inside.
RADIAN = .0174603 * DEGREE
Print #1, xorigin + RAD * Cos(RADIAN);" "; yorigin + RAD * Sin(RADIAN)
Next
Close #1
MsgBox( BLNFile +" has been created.",48)
theend:
Debug.Print " COMPLETE"
End Sub
Updated November 08, 2018
Comments
0 comments
Please sign in to leave a comment.