A great big thanks to both Brian and Eric.

I don't have any immediate need for spiral patterns but, it did introduce me
to Client Basic. I had completely forgotten about Client Basic being
built-in to Protel.

I added input boxes for the variables and some comments in a header during
lunch break.

Paul

BTW, it works great in Protel98.

----------------------------------------------------------------------

' Protel Client Basic code Spiral.bas
'
' Creates spiral track pattern based on numerical parameters
'
' Written by Eric Albach and posted to the
' Protel EDA Forum on June 2001 (see www.techservinc.com)
'
' Based on Qbasic code written by Brian Guralnick and posted to the
' Protel EDA Forum June 2001
'
' InputBox lines added by Paul Hutchinson June 2001
'

DIM x0,y0,stp,growth as DOUBLE
DIM p0,pi,xc0,xc1,yc0,yc1 as DOUBLE
pi = 3.141592654#


x0 = 3000     'spiral center x location
y0 = 3000     'spiral center y location
spacing = 20
loops = 4
res = 2       'resolution
trackwidth=10

'Added by P.H. 6/14/2001
x0 = InputBox$("Enter spiral center x location", "Center X", "3000")
y0 = InputBox$("Enter spiral center y location", "Center Y", "3000")
spacing = InputBox$("Enter spiral spacing", "Spacing", "20")
loops = InputBox$("Enter number of loops", "Number of loops", "4")
res = InputBox$("Enter spiral resolution", "Resolution", "2")
trackwidth = InputBox$("Enter spiral track width", "Track width", "10")


loops = loops * 2
stp = res / pi / 4
growth = spacing / pi * stp / 2

' ClientBasic uses only integers with For-Next loops
FOR p0 = 0 TO loops * pi / stp + 1
   p = p0 * stp - stp
   xc1 = INT(COS(p) * spacing)
   yc1 = INT(SIN(p) * spacing)
   spacing = spacing + growth
   if p0<>0 then
      ResetParameters
      AddStringParameter  "Width",trackwidth
      AddStringParameter  "Location1.X", x0 + xc0
      AddStringParameter  "Location1.Y", y0 + yc0
      AddStringParameter  "Location2.X", x0 + xc1
      AddStringParameter  "Location2.Y", y0 + yc1
'      AddStringParameter  "UserRouted", "False"
      AddStringParameter  "Layer", "Current"
      RunProcess          "PCB:PlaceTrack"
   end if
   xc0=xc1
   yc0=yc1
NEXT p0


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* To post a message: mailto:[EMAIL PROTECTED]
*
* To leave this list visit:
* http://www.techservinc.com/protelusers/subscrib.html
*                      - or email -
* mailto:[EMAIL PROTECTED]?body=leave%20proteledaforum
*
* Contact the list manager:
* mailto:[EMAIL PROTECTED]
*
* Browse or Search previous postings:
* http://www.mail-archive.com/[email protected]
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Reply via email to