I was working on a similar idea, except this version uses the Place Arc
process so no resolution setting is required, and the number of primitives
placed is much smaller (smaller file size).
It's been tested and works well, however the usual warnings (no
responsibility taken at all, for anything) apply.

Again, cut and paste this into a text  file (with .bas extension) somewhere
convenient (like your templates.ddb) or get it from
http://groups.yahoo.com/group/protel-users/files/

Use the Macro:RunMacro process assigned to a menu item or toolbutton to
launch.

Make sure the long line do not wordwrap, and feel free to improve upon
anything.
I'm planning to get rid of the input box for the x,y location, and replace
it with a mouse click if possible.


'-----------------------------------------------------
' File Name:    spiral.bas
' Title:                Spiral Generator (Basic Version)
' Copyright:    (c) 2001 by Powercom Consultants Pty Ltd
' Author:               Tom Luttrell
'-----------------------------------------------------
' This macro will draw a spiral on the current layer
' using arc quadrants.
' Uses current units (except for center location).
'......................................................

Sub Main

DIM Cx#,Cy#,Ws#,Wt#,dC#,X#,Y#,r#,a0%,a1%,n%,Q%,L%

Cx# = InputBox$("Enter spiral center x location (in mil from bottom left
corner of workspace)", "Center X")
Cy# = InputBox$("Enter spiral center y location (in mil from bottom left
corner of workspace)", "Center Y")
Ws# = InputBox$("Enter spiral spacing (in current units)", "Spacing")
Wt# = InputBox$("Enter spiral track width (in current units)", "Track
width")
n% = InputBox$("Enter number of turns", "Number of Turns")
' Get Click position sub to be done (to replace center location input boxes)

    dC# = (Wt# + Ws#)/4  'center offset of arc

    for L% = 1 to n%    'for each turn
       for Q% = 1 to 4 'do 4 quadrants

          Select Case Q

             Case 1   'for quadrant 1
                X# = Cx#-dC# 'center x co-ord of arc
                Y# = Cy#      'center x co-ord of arc
                a0% = 0      'start angle of arc
                a1% = 90     'end angle of arc
             Case 2
                X# = Cx#-dC#
                Y# = Cy#-dC#
                a0% = 90
                a1% = 180
             Case 3
                X# = Cx#
                Y# = Cy#-dC#
                a0% = 180
                a1% = 270
             Case 4
                X# = Cx#
                Y# = Cy#
                a0% = 270
                a1% = 360
          End Select

          r# = r#+dC# 'calculate radius

          ResetParameters
          AddIntegerParameter "Method", 1
          AddSingleParameter "Location.X", X#
          AddSingleParameter "Location.Y", Y#
          AddSingleParameter "Width", Wt#
          AddSingleParameter "StartAngle", a0%
          AddSingleParameter "Radius", r#
          AddSingleParameter "EndAngle", a1%
          AddStringParameter "Layer", "Current"
          RunProcess "PCB:PlaceArc"
       Next Q
    Next L
    ResetParameters
End Sub
'......................................................

' � Powercom Consultants Pty Ltd 2001. All rights reserved.


-----Original Message-----
From: Paul Hutchinson [mailto:[EMAIL PROTECTED]]
Sent: Friday, 15 June 2001 3:57 AM
To: Protel EDA Forum
Subject: Re: [PEDA] Spiral generator.


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