Follow

How can I create a BLN file containing a circle via Surfer automation?

This article contains a sample script which creates a circular BLN file.

 

To run this script:

  1. Copy the script below, or download the attached BAS file: circle2.bas.
  2. In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Surfer 15\Scripter.
  3. Double click on Scripter.exe to launch Scripter.
  4. Press Ctrl+A to select all of the existing lines then press Delete.
  5. 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.
  6. 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 October 10, 2017

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.