Geoff,
You are hard....:)
Note that you *must* install the new server that Ian Wilson
was so kind to make for us all.
This server is on the Yahoo groups site and also Ian's site
http://www.considered.com.au/ExposePCBToMacro_V1_0.zip
I copied the following files to 'C:\Protel99\System' directory:
ExposePCBToMacro.dll
ExposePCBToMacro.ins
ExposePCBToMacro.hlp
Then install the server as per the readme file included above.
See below for the .bas file.
Darren
> Tch, tch. :) When are the intrepid developers of Macro
> scripts going to incorporate the
> 'ExposePCBToMacro:PromptUserForCoordinate' Process that Ian
> Wilson has kindly provided to the Protel users community? (If
> used, users would no longer have to key in a X value and Y
> value within the dialog box invoked by the script.)
>
> I would do so myself, but I have a bit on at present. But I
> am sure that someone else could do so, and in so doing,
> provide feedback to Ian that his contribution is useful,
> appreciated, and functioning as envisaged.
>
> Regards,
> Geoff Harland.
------------------------------------------------------------------------
' Protel Client Basic code SpiralGeneratorProtelScript.bas June 19, 2001
'
' 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
'
' Removed the integers by Brian Guralnick, June 18, 2001
'
' Change to enter all data in one dialog box Darren Moore 20 June 2001
' Now you are required to pick point in the work place for the X,Y
center position Darren Moore 20 June 2001
DIM x0,y0,stp,growth as DOUBLE
DIM p,p0,pi,xc0,xc1,yc0,yc1 as DOUBLE
pi = 3.141592654#
'----------------------------------------------------
' PCB prompt for coordinate example
' Copyright (c) 2001 Considered Solutions
'----------------------------------------------------
' This macro will prompt for a PCB coordinate and
' display the result in a dialog box
' The ExposePCBToMacro server must be installed
' for this macro to run successfully.
'....................................................
Dim Result As Integer
Dim ChoosenOK as String
Dim XString as String
Dim YString as String
' Dim XOffsetString as String
' Dim YOffsetString as String
ResetParameters
AddStringParameter "Prompt", "Choose center of spiral"
RunProcess "ExposePCBToMacro:PromptUserForCoordinate"
GetStringParameter "OK", ChoosenOK
if ChoosenOK = "Yes" then
GetStringParameter "X", XString
GetStringParameter "Y", YString
' GetStringParameter "OffsetX", XOffsetString
' GetStringParameter "OffsetY", YOffsetString
end if
Sub Main ()
' Define the dialog box.
Begin Dialog DialogName1 160, 60, 130, 110, "Place Spiral Track"
Text 5, 10, 55, 12, "X location"
Textbox 5, 20, 55, 12, .x0
Text 5, 35, 55, 12, "Y location"
Textbox 5, 45, 55, 12, .y0
Text 5, 60, 55, 12, "Spiral spacing"
Textbox 5, 70, 55, 12, .spacing
Text 70, 10, 55, 12, "Number of loops"
Textbox 70, 20, 55, 12, .loops
Text 70, 35, 55, 12, "Resolution"
Textbox 70, 45, 55, 12, .res
Text 70, 60, 55, 12, "Track width"
Textbox 70, 70, 55, 12, .trackwidth
PushButton 20, 90, 30, 12, "Cancel", .Cancel
OKBUTTON 80, 90, 30, 12
End Dialog
' Dimension an object to represent the dialog.
Dim Dlg1 As DialogName1
'Default inputs
Dlg1.x0 = XString
Dlg1.y0 = YString
Dlg1.spacing = 20
Dlg1.loops = 2
Dlg1.res = 5
Dlg1.trackwidth = 10
Dialog Dlg1 ' Display the dialog.
If Dlg1.Cancel = 1 Then
Exit Sub
End If
Dlg1.loops = Dlg1.loops * 2
stp = Dlg1.res / pi / 4
growth = Dlg1.spacing / pi * stp / 2
' ClientBasic uses only integers with For-Next loops
FOR p0 = 0 TO Dlg1.loops * pi / stp + 1
p = p0 * stp - stp
xc1 = (COS(p) * Dlg1.spacing)
yc1 = (SIN(p) * Dlg1.spacing)
Dlg1.spacing = Dlg1.spacing + growth
if p0<>0 then
ResetParameters
AddStringParameter "Width", Dlg1.trackwidth
AddStringParameter "Location1.X", Dlg1.x0 + xc0
AddStringParameter "Location1.Y", Dlg1.y0 + yc0
AddStringParameter "Location2.X", Dlg1.x0 + xc1
AddStringParameter "Location2.Y", Dlg1.y0 + yc1
' AddStringParameter "UserRouted", "False"
AddStringParameter "Layer", "Current"
RunProcess "PCB:PlaceTrack"
end if
xc0=xc1
yc0=yc1
NEXT p0
End Sub
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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]
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *