Changes 20110605

20110605

Also reference

Note: 4 x right side heads mechanically/electrically functional but still not used by Excel GCode generator (ran out of time)

This improvement iteration is focused on improving accuracy & useability of setting / checking calibration as manually entering GCodes referencing Mach 3 variables etc is painful.  Hence we have primarily spent this iterations time on learning how to do Mach 3 Cyprus VB dialogs with interaction with Mach 3

This results in a fundamental change in the generated GCode:

- Previously, head & feeder offsets are stored in the Excel workbook, and generated GCode has fixed numbers for movement etc based on these offsets, (ie head + feeder + componetno = go coordinates)

This meant that if a head or feeder was misaligned to correct it required:

1. manually move to calibration point

2. enter new values into Excelworkbook, ie Left Head 0 X & Y offset

3. regenerate GCode

4. close open GCode file in Mach 3

5. copy paste from Excel to GCode txt file (we will automate this step eventually)

6. reopen Gcode file in Mach 3

Painful.

- To allow for recalibrating a head / feeder offset on the fly using the new VBScript dialog macros, the generated GCode now populates a large array of Mach 3 user variables with the offsets as stored in the Excel workbook.  Generated GCode movement instructions use these variables instead of the previous hardcoded values.

- This allows:

  - the VBScript dialogs to update a relevant head / feeder user variable on the fly

  - changes above to be available immediately for the next run

The reference link above details mapping of Mach 3 user variables to their use.


Changes:

I have another run of PCBs to assemble but after the last iteration and recent addition of 4 heads on the right side for a total of 8 heads I am going to try a different approach to the pick place process primarily to:

  • make it easier to reset component counters
  • restart PCB's in the event of a parts getting dropped etc
  • check / recalibrate head & feeder offsets on the fly

Previously I was processing an array of PCB's depending on the complexity of each PCB.  If I have problems with a head or a part it gets difficult to interrupt / resume easily as each run zeroes each component counter.  The first iteration of these changes will do a single PCB at a time.  Some array functionality will be reserved for potential reimplementation at a later date

Proposed changes:

  • A VB control panel
  • Head & Feeder offsets are calculated in the spreadsheet, we will instead store these as GCode user vars (and do the offset maths in the Gcode)
  • Initialise Head & Feeder X Y offsets per the source spreadsheet via a GCode sub routine called from a button on our new control panel
  • For each feeder, store as users vars (we already keep a running count of components used):
    • Max that can be accesed in a single run (usually 32 for 0805)
    • Number required per a single run
  • Manage running count per feeder on the control panel:
    • Allow to reset running count to 0 (default) or a custom number
  • Various other buttons on the Control panel:
    • Park heads (various positions)
    • Move heads to feeder origin's
    • Manage rotation origins
      • Move to rotation origins
      • Set rotation origins
This changes the main flow of the GCode, as basically it will:
  1. Initialise max per feeder, and required per current run per feeder
  2. GCode to include pick place GCODE sunroutines for each rotation ie O0, O90, O180,O270
  3. Call VB Dialog Macro to manage components
  4. Run each rotation by calling GCode sub routine from new control panel

Ok, after the usual hair pulling as we work out what the VB scripting engine allows and doesnt allow with regard to dialogs and we have a VB macro M90003 only using the Right hand feeder array at this time:

Found that I cannot have a 'text' object in a dialog and use a variable to assign its label (seems it needs to be hardcoded, so instead I use a disabled TextBox object, not ideal and hard to read..)

Also, I haven't yet added in the code to use the right side feeders nor the right side heads as I have to use the machine to assemble some PCB's..

Option Explicit

'20110604
'To do:
' - Reset All btn
' - Park heads btn

Dim b

Sub Main

Begin Dialog dlgManager 500, 500, "Component manager", .dialogManager

Text 10, 20, 40, 10, "FL25"
Text 10, 30, 40, 10, "FL24"
Text 10, 40, 40, 10, "FL23"
Text 10, 50, 40, 10, "FL22"
Text 10, 60, 40, 10, "FL21"
Text 10, 70, 40, 10, "FL20"
Text 10, 80, 40, 10, "FL19"
Text 10, 90, 40, 10, "FL18"
Text 10, 100, 40, 10, "FL17"
Text 10, 110, 40, 10, "FL16"
Text 10, 120, 40, 10, "FL15"
Text 10, 130, 40, 10, "FL14"
Text 10, 140, 40, 10, "FL13"
Text 10, 150, 40, 10, "FL12"
Text 10, 160, 40, 10, "FL11"
Text 10, 170, 40, 10, "FL10"
Text 10, 180, 40, 10, "FL9"
Text 10, 190, 40, 10, "FL8"
Text 10, 200, 40, 10, "FL7"
Text 10, 210, 40, 10, "FL6"
Text 10, 220, 40, 10, "FL5"
Text 10, 230, 40, 10, "FL4"
Text 10, 240, 40, 10, "FL3"
Text 10, 250, 40, 10, "FL2"
Text 10, 260, 40, 10, "FL1"

Text 50, 10, 40, 10, "Max"
TextBox 50, 20, 40, 10,  .max25
TextBox 50, 30, 40, 10,  .max24
TextBox 50, 40, 40, 10,  .max23
TextBox 50, 50, 40, 10,  .max22
TextBox 50, 60, 40, 10,  .max21
TextBox 50, 70, 40, 10,  .max20
TextBox 50, 80, 40, 10,  .max19
TextBox 50, 90, 40, 10,  .max18
TextBox 50, 100, 40, 10,  .max17
TextBox 50, 110, 40, 10,  .max16
TextBox 50, 120, 40, 10,  .max15
TextBox 50, 130, 40, 10,  .max14
TextBox 50, 140, 40, 10,  .max13
TextBox 50, 150, 40, 10,  .max12
TextBox 50, 160, 40, 10,  .max11
TextBox 50, 170, 40, 10,  .max10
TextBox 50, 180, 40, 10,  .max9
TextBox 50, 190, 40, 10,  .max8
TextBox 50, 200, 40, 10,  .max7
TextBox 50, 210, 40, 10,  .max6
TextBox 50, 220, 40, 10,  .max5
TextBox 50, 230, 40, 10,  .max4
TextBox 50, 240, 40, 10,  .max3
TextBox 50, 250, 40, 10,  .max2
TextBox 50, 260, 40, 10,  .max1

Text 100, 10, 40, 10, "Count"
TextBox 100, 20, 40, 10,  .count25
TextBox 100, 30, 40, 10,  .count24
TextBox 100, 40, 40, 10,  .count23
TextBox 100, 50, 40, 10,  .count22
TextBox 100, 60, 40, 10,  .count21
TextBox 100, 70, 40, 10,  .count20
TextBox 100, 80, 40, 10,  .count19
TextBox 100, 90, 40, 10,  .count18
TextBox 100, 100, 40, 10,  .count17
TextBox 100, 110, 40, 10,  .count16
TextBox 100, 120, 40, 10,  .count15
TextBox 100, 130, 40, 10,  .count14
TextBox 100, 140, 40, 10,  .count13
TextBox 100, 150, 40, 10,  .count12
TextBox 100, 160, 40, 10,  .count11
TextBox 100, 170, 40, 10,  .count10
TextBox 100, 180, 40, 10,  .count9
TextBox 100, 190, 40, 10,  .count8
TextBox 100, 200, 40, 10,  .count7
TextBox 100, 210, 40, 10,  .count6
TextBox 100, 220, 40, 10,  .count5
TextBox 100, 230, 40, 10,  .count4
TextBox 100, 240, 40, 10,  .count3
TextBox 100, 250, 40, 10,  .count2
TextBox 100, 260, 40, 10,  .count1

Text 150, 10, 40, 10, "Need"
TextBox 150, 20, 40, 10,  .need25
TextBox 150, 30, 40, 10,  .need24
TextBox 150, 40, 40, 10,  .need23
TextBox 150, 50, 40, 10,  .need22
TextBox 150, 60, 40, 10,  .need21
TextBox 150, 70, 40, 10,  .need20
TextBox 150, 80, 40, 10,  .need19
TextBox 150, 90, 40, 10,  .need18
TextBox 150, 100, 40, 10,  .need17
TextBox 150, 110, 40, 10,  .need16
TextBox 150, 120, 40, 10,  .need15
TextBox 150, 130, 40, 10,  .need14
TextBox 150, 140, 40, 10,  .need13
TextBox 150, 150, 40, 10,  .need12
TextBox 150, 160, 40, 10,  .need11
TextBox 150, 170, 40, 10,  .need10
TextBox 150, 180, 40, 10,  .need9
TextBox 150, 190, 40, 10,  .need8
TextBox 150, 200, 40, 10,  .need7
TextBox 150, 210, 40, 10,  .need6
TextBox 150, 220, 40, 10,  .need5
TextBox 150, 230, 40, 10,  .need4
TextBox 150, 240, 40, 10,  .need3
TextBox 150, 250, 40, 10,  .need2
TextBox 150, 260, 40, 10,  .need1


Text 200, 10, 40, 10, "Remaining"
TextBox 200, 20, 40, 10,  .remaining25
TextBox 200, 30, 40, 10,  .remaining24
TextBox 200, 40, 40, 10,  .remaining23
TextBox 200, 50, 40, 10,  .remaining22
TextBox 200, 60, 40, 10,  .remaining21
TextBox 200, 70, 40, 10,  .remaining20
TextBox 200, 80, 40, 10,  .remaining19
TextBox 200, 90, 40, 10,  .remaining18
TextBox 200, 100, 40, 10,  .remaining17
TextBox 200, 110, 40, 10,  .remaining16
TextBox 200, 120, 40, 10,  .remaining15
TextBox 200, 130, 40, 10,  .remaining14
TextBox 200, 140, 40, 10,  .remaining13
TextBox 200, 150, 40, 10,  .remaining12
TextBox 200, 160, 40, 10,  .remaining11
TextBox 200, 170, 40, 10,  .remaining10
TextBox 200, 180, 40, 10,  .remaining9
TextBox 200, 190, 40, 10,  .remaining8
TextBox 200, 200, 40, 10,  .remaining7
TextBox 200, 210, 40, 10,  .remaining6
TextBox 200, 220, 40, 10,  .remaining5
TextBox 200, 230, 40, 10,  .remaining4
TextBox 200, 240, 40, 10,  .remaining3
TextBox 200, 250, 40, 10,  .remaining2
TextBox 200, 260, 40, 10,  .remaining1


Text 250, 10, 40, 15, "Reset To?"
TextBox 250, 20, 40, 10, .new25
TextBox 250, 30, 40, 10, .new24
TextBox 250, 40, 40, 10, .new23
TextBox 250, 50, 40, 10, .new22
TextBox 250, 60, 40, 10, .new21
TextBox 250, 70, 40, 10, .new20
TextBox 250, 80, 40, 10, .new19
TextBox 250, 90, 40, 10, .new18
TextBox 250, 100, 40, 10, .new17
TextBox 250, 110, 40, 10, .new16
TextBox 250, 120, 40, 10, .new15
TextBox 250, 130, 40, 10, .new14
TextBox 250, 140, 40, 10, .new13
TextBox 250, 150, 40, 10, .new12
TextBox 250, 160, 40, 10, .new11
TextBox 250, 170, 40, 10, .new10
TextBox 250, 180, 40, 10, .new9
TextBox 250, 190, 40, 10, .new8
TextBox 250, 200, 40, 10, .new7
TextBox 250, 210, 40, 10, .new6
TextBox 250, 220, 40, 10, .new5
TextBox 250, 230, 40, 10, .new4
TextBox 250, 240, 40, 10, .new3
TextBox 250, 250, 40, 10, .new2
TextBox 250, 260, 40, 10, .new1


Text 300, 10, 40, 15, "Reset?"
PushButton 300, 20, 40, 10, "Reset", .btn25
PushButton 300, 30, 40, 10, "Reset", .btn24
PushButton 300, 40, 40, 10, "Reset", .btn23
PushButton 300, 50, 40, 10, "Reset", .btn22
PushButton 300, 60, 40, 10, "Reset", .btn21
PushButton 300, 70, 40, 10, "Reset", .btn20
PushButton 300, 80, 40, 10, "Reset", .btn19
PushButton 300, 90, 40, 10, "Reset", .btn18
PushButton 300, 100, 40, 10, "Reset", .btn17
PushButton 300, 110, 40, 10, "Reset", .btn16
PushButton 300, 120, 40, 10, "Reset", .btn15
PushButton 300, 130, 40, 10, "Reset", .btn14
PushButton 300, 140, 40, 10, "Reset", .btn13
PushButton 300, 150, 40, 10, "Reset", .btn12
PushButton 300, 160, 40, 10, "Reset", .btn11
PushButton 300, 170, 40, 10, "Reset", .btn10
PushButton 300, 180, 40, 10, "Reset", .btn9
PushButton 300, 190, 40, 10, "Reset", .btn8
PushButton 300, 200, 40, 10, "Reset", .btn7
PushButton 300, 210, 40, 10, "Reset", .btn6
PushButton 300, 220, 40, 10, "Reset", .btn5
PushButton 300, 230, 40, 10, "Reset", .btn4
PushButton 300, 240, 40, 10, "Reset", .btn3
PushButton 300, 250, 40, 10, "Reset", .btn2
PushButton 300, 260, 40, 10, "Reset", .btn1

PushButton 350, 25, 50, 10, "Park Heads", .btnpark 'not implemented yet
PushButton 350, 40, 50, 10, "Reset All", .btnresetall ' not implemented yet
OKButton 350, 55, 50, 10
CancelButton 350, 70, 50, 10

End Dialog

b = Dialog(dlgManager)
If b = 0 Then
    MsgBox("Cancelled")
Else
    Code("M98 P99") 'Call PCB function
End If

End Sub


Function dialogManager( ControlID$, Action%, SuppValue%)

    dialogManager = 1
    
    If Action = 2 Then
        If ControlID$ = "Ok" Or ControlID$ = "Cancel" Then
            dialogManager = 0
        Else
            'MsgBox(ControlID$)
            Select Case ControlID$
                Case "btn25"
                    SetVar (25, DlgText("new25"))
                Case "btn24"
                    SetVar (24, DlgText("new24"))
                Case "btn23"
                    SetVar (23, DlgText("new23"))
                Case "btn22"
                    SetVar (22, DlgText("new22"))
                Case "btn21"
                    SetVar (21, DlgText("new21"))
                Case "btn20"
                    SetVar (20, DlgText("new20"))
                Case "btn19"
                    SetVar (19, DlgText("new19"))
                Case "btn18"
                    SetVar (18, DlgText("new18"))
                Case "btn17"
                    SetVar (17, DlgText("new17"))
                Case "btn16"
                    SetVar (16, DlgText("new16"))
                Case "btn15"
                    SetVar (15, DlgText("new15"))
                Case "btn14"
                    SetVar (14, DlgText("new14"))
                Case "btn13"
                    SetVar (13, DlgText("new13"))
                Case "btn12"
                    SetVar (12, DlgText("new12"))
                Case "btn11"
                    SetVar (11, DlgText("new11"))
                Case "btn10"
                    SetVar (10, DlgText("new10"))
                Case "btn09"
                    SetVar (09, DlgText("new09"))
                Case "btn08"
                    SetVar (08, DlgText("new08"))
                Case "btn07"
                    SetVar (07, DlgText("new07"))
                Case "btn06"
                    SetVar (06, DlgText("new06"))
                Case "btn05"
                    SetVar (05, DlgText("new05"))
                Case "btn04"
                    SetVar (04, DlgText("new04"))
                Case "btn03"
                    SetVar (03, DlgText("new03"))
                Case "btn02"
                    SetVar (02, DlgText("new02"))
                Case "btn01"
                    SetVar (01, DlgText("new01"))
                        
            End Select
        End If
    End If
    If Action = 1 Or Action = 2 Then

        DlgText "max25", CStr(GetVar(225))
        DlgText "max24", CStr(GetVar(224))
        DlgText "max23", CStr(GetVar(223))
        DlgText "max22", CStr(GetVar(222))
        DlgText "max21", CStr(GetVar(221))
        DlgText "max20", CStr(GetVar(220))
        DlgText "max19", CStr(GetVar(219))
        DlgText "max18", CStr(GetVar(218))
        DlgText "max17", CStr(GetVar(217))
        DlgText "max16", CStr(GetVar(216))
        DlgText "max15", CStr(GetVar(215))
        DlgText "max14", CStr(GetVar(214))
        DlgText "max13", CStr(GetVar(213))
        DlgText "max12", CStr(GetVar(212))
        DlgText "max11", CStr(GetVar(211))
        DlgText "max10", CStr(GetVar(210))
        DlgText "max9", CStr(GetVar(209))
        DlgText "max8", CStr(GetVar(208))
        DlgText "max7", CStr(GetVar(207))
        DlgText "max6", CStr(GetVar(206))
        DlgText "max5", CStr(GetVar(205))
        DlgText "max4", CStr(GetVar(204))
        DlgText "max3", CStr(GetVar(203))
        DlgText "max2", CStr(GetVar(202))
        DlgText "max1", CStr(GetVar(201))

        DlgEnable "max25", 0
        DlgEnable "max24", 0
        DlgEnable "max23", 0
        DlgEnable "max22", 0
        DlgEnable "max21", 0
        DlgEnable "max20", 0
        DlgEnable "max19", 0
        DlgEnable "max18", 0
        DlgEnable "max17", 0
        DlgEnable "max16", 0
        DlgEnable "max15", 0
        DlgEnable "max14", 0
        DlgEnable "max13", 0
        DlgEnable "max12", 0
        DlgEnable "max11", 0
        DlgEnable "max10", 0
        DlgEnable "max9", 0
        DlgEnable "max8", 0
        DlgEnable "max7", 0
        DlgEnable "max6", 0
        DlgEnable "max5", 0
        DlgEnable "max4", 0
        DlgEnable "max3", 0
        DlgEnable "max2", 0
        DlgEnable "max1", 0
        
        DlgText "count25", CStr(GetVar(25))
        DlgText "count24", CStr(GetVar(24))
        DlgText "count23", CStr(GetVar(23))
        DlgText "count22", CStr(GetVar(22))
        DlgText "count21", CStr(GetVar(21))
        DlgText "count20", CStr(GetVar(20))
        DlgText "count19", CStr(GetVar(19))
        DlgText "count18", CStr(GetVar(18))
        DlgText "count17", CStr(GetVar(17))
        DlgText "count16", CStr(GetVar(16))
        DlgText "count15", CStr(GetVar(15))
        DlgText "count14", CStr(GetVar(14))
        DlgText "count13", CStr(GetVar(13))
        DlgText "count12", CStr(GetVar(12))
        DlgText "count11", CStr(GetVar(11))
        DlgText "count10", CStr(GetVar(10))
        DlgText "count9", CStr(GetVar(9))
        DlgText "count8", CStr(GetVar(8))
        DlgText "count7", CStr(GetVar(7))
        DlgText "count6", CStr(GetVar(6))
        DlgText "count5", CStr(GetVar(5))
        DlgText "count4", CStr(GetVar(4))
        DlgText "count3", CStr(GetVar(3))
        DlgText "count2", CStr(GetVar(2))
        DlgText "count1", CStr(GetVar(1))

        DlgEnable "count25", 0
        DlgEnable "count24", 0
        DlgEnable "count23", 0
        DlgEnable "count22", 0
        DlgEnable "count21", 0
        DlgEnable "count20", 0
        DlgEnable "count19", 0
        DlgEnable "count18", 0
        DlgEnable "count17", 0
        DlgEnable "count16", 0
        DlgEnable "count15", 0
        DlgEnable "count14", 0
        DlgEnable "count13", 0
        DlgEnable "count12", 0
        DlgEnable "count11", 0
        DlgEnable "count10", 0
        DlgEnable "count9", 0
        DlgEnable "count8", 0
        DlgEnable "count7", 0
        DlgEnable "count6", 0
        DlgEnable "count5", 0
        DlgEnable "count4", 0
        DlgEnable "count3", 0
        DlgEnable "count2", 0
        DlgEnable "count1", 0

        DlgText "need25", CStr(GetVar(125))
        DlgText "need24", CStr(GetVar(124))
        DlgText "need23", CStr(GetVar(123))
        DlgText "need22", CStr(GetVar(122))
        DlgText "need21", CStr(GetVar(121))
        DlgText "need20", CStr(GetVar(120))
        DlgText "need19", CStr(GetVar(119))
        DlgText "need18", CStr(GetVar(118))
        DlgText "need17", CStr(GetVar(117))
        DlgText "need16", CStr(GetVar(116))
        DlgText "need15", CStr(GetVar(115))
        DlgText "need14", CStr(GetVar(114))
        DlgText "need13", CStr(GetVar(113))
        DlgText "need12", CStr(GetVar(112))
        DlgText "need11", CStr(GetVar(111))
        DlgText "need10", CStr(GetVar(110))
        DlgText "need9", CStr(GetVar(109))
        DlgText "need8", CStr(GetVar(108))
        DlgText "need7", CStr(GetVar(107))
        DlgText "need6", CStr(GetVar(106))
        DlgText "need5", CStr(GetVar(105))
        DlgText "need4", CStr(GetVar(104))
        DlgText "need3", CStr(GetVar(103))
        DlgText "need2", CStr(GetVar(102))
        DlgText "need1", CStr(GetVar(101))

        DlgEnable "need25", 0
        DlgEnable "need24", 0
        DlgEnable "need23", 0
        DlgEnable "need22", 0
        DlgEnable "need21", 0
        DlgEnable "need20", 0
        DlgEnable "need19", 0
        DlgEnable "need18", 0
        DlgEnable "need17", 0
        DlgEnable "need16", 0
        DlgEnable "need15", 0
        DlgEnable "need14", 0
        DlgEnable "need13", 0
        DlgEnable "need12", 0
        DlgEnable "need11", 0
        DlgEnable "need10", 0
        DlgEnable "need9", 0
        DlgEnable "need8", 0
        DlgEnable "need7", 0
        DlgEnable "need6", 0
        DlgEnable "need5", 0
        DlgEnable "need4", 0
        DlgEnable "need3", 0
        DlgEnable "need2", 0
        DlgEnable "need1", 0
    
        DlgText "remaining25", CStr(GetVar(225) - GetVar(25))
        DlgText "remaining24", CStr(GetVar(224) - GetVar(24))
        DlgText "remaining23", CStr(GetVar(223) - GetVar(23))
        DlgText "remaining22", CStr(GetVar(222) - GetVar(22))
        DlgText "remaining21", CStr(GetVar(221) - GetVar(21))
        DlgText "remaining20", CStr(GetVar(220) - GetVar(20))
        DlgText "remaining19", CStr(GetVar(219) - GetVar(19))
        DlgText "remaining18", CStr(GetVar(218) - GetVar(18))
        DlgText "remaining17", CStr(GetVar(217) - GetVar(17))
        DlgText "remaining16", CStr(GetVar(216) - GetVar(16))
        DlgText "remaining15", CStr(GetVar(215) - GetVar(15))
        DlgText "remaining14", CStr(GetVar(214) - GetVar(14))
        DlgText "remaining13", CStr(GetVar(213) - GetVar(13))
        DlgText "remaining12", CStr(GetVar(212) - GetVar(12))
        DlgText "remaining11", CStr(GetVar(211) - GetVar(11))
        DlgText "remaining10", CStr(GetVar(210) - GetVar(10))
        DlgText "remaining9", CStr(GetVar(209) - GetVar(9))
        DlgText "remaining8", CStr(GetVar(208) - GetVar(8))
        DlgText "remaining7", CStr(GetVar(207) - GetVar(7))
        DlgText "remaining6", CStr(GetVar(206) - GetVar(6))
        DlgText "remaining5", CStr(GetVar(205) - GetVar(5))
        DlgText "remaining4", CStr(GetVar(204) - GetVar(4))
        DlgText "remaining3", CStr(GetVar(203) - GetVar(3))
        DlgText "remaining2", CStr(GetVar(202) - GetVar(2))
        DlgText "remaining1", CStr(GetVar(201) - GetVar(1))

        DlgEnable "remaining25", 0
        DlgEnable "remaining24", 0
        DlgEnable "remaining23", 0
        DlgEnable "remaining22", 0
        DlgEnable "remaining21", 0
        DlgEnable "remaining20", 0
        DlgEnable "remaining19", 0
        DlgEnable "remaining18", 0
        DlgEnable "remaining17", 0
        DlgEnable "remaining16", 0
        DlgEnable "remaining15", 0
        DlgEnable "remaining14", 0
        DlgEnable "remaining13", 0
        DlgEnable "remaining12", 0
        DlgEnable "remaining11", 0
        DlgEnable "remaining10", 0
        DlgEnable "remaining9", 0
        DlgEnable "remaining8", 0
        DlgEnable "remaining7", 0
        DlgEnable "remaining6", 0
        DlgEnable "remaining5", 0
        DlgEnable "remaining4", 0
        DlgEnable "remaining3", 0
        DlgEnable "remaining2", 0
        DlgEnable "remaining1", 0
        
        DlgText "new25", 0
        DlgText "new24", 0
        DlgText "new23", 0
        DlgText "new22", 0
        DlgText "new21", 0
        DlgText "new20", 0
        DlgText "new19", 0
        DlgText "new18", 0
        DlgText "new17", 0
        DlgText "new16", 0
        DlgText "new15", 0
        DlgText "new14", 0
        DlgText "new13", 0
        DlgText "new12", 0
        DlgText "new11", 0
        DlgText "new10", 0
        DlgText "new9", 0
        DlgText "new8", 0
        DlgText "new7", 0
        DlgText "new6", 0
        DlgText "new5", 0
        DlgText "new4", 0
        DlgText "new3", 0
        DlgText "new2", 0
        DlgText "new1", 0

    End If

End Function
     

And an initial GCODE generated from EXCEL

G0
G90
(Initialise Component Management vars)
#101 = 0
#201 = 0
#102 = 0
#202 = 0
#103 = 0
#203 = 0
#104 = 0
#204 = 0
#105 = 0
#205 = 0
#106 = 0
#206 = 0
#107 = 0
#207 = 0
#108 = 0
#208 = 0
#109 = 1
#209 = 32
#110 = 4
#210 = 32
#111 = 1
#211 = 32
#112 = 0
#212 = 0
#113 = 0
#213 = 0
#114 = 1
#214 = 32
#115 = 1
#215 = 32
#116 = 3
#216 = 32
#117 = 1
#217 = 32
#118 = 0
#218 = 0
#119 = 0
#219 = 0
#120 = 0
#220 = 0
#121 = 0
#221 = 0
#122 = 0
#222 = 0
#123 = 0
#223 = 0
#124 = 0
#224 = 0
#125 = 0
#225 = 0
#126 = 0
#226 = 0
#127 = 0
#227 = 0
#128 = 0
#228 = 0
#129 = 0
#229 = 0
#130 = 0
#230 = 0
#131 = 0
#231 = 0
#132 = 0
#232 = 0
#133 = 0
#233 = 0
#134 = 0
#234 = 0
#135 = 0
#235 = 0
#136 = 0
#236 = 0
#137 = 0
#237 = 0
#138 = 0
#238 = 0
#139 = 0
#239 = 0
#140 = 0
#240 = 0
#141 = 0
#241 = 0
#142 = 0
#242 = 0
#143 = 0
#243 = 0
#144 = 0
#244 = 0
#145 = 0
#245 = 0
#146 = 0
#246 = 0
#147 = 0
#247 = 0
#148 = 0
#248 = 0
#149 = 0
#249 = 0
#150 = 0
#250 = 0
#151 = 0
#251 = 0
#152 = 0
#252 = 0
#153 = 0
#253 = 0
#154 = 0
#254 = 0
#155 = 0
#255 = 0
#156 = 0
#256 = 0
#157 = 0
#257 = 0
#158 = 0
#258 = 0
#159 = 0
#259 = 0
#160 = 0
#260 = 0
#161 = 0
#261 = 0
#162 = 0
#262 = 0
#163 = 0
#263 = 0
#164 = 0
#264 = 0
#165 = 0
#265 = 0
#166 = 0
#266 = 0
#167 = 0
#267 = 0
#168 = 0
#268 = 0
#169 = 0
#269 = 0
#170 = 0
#270 = 0
#171 = 0
#271 = 0
#172 = 0
#272 = 0
#173 = 0
#273 = 0
#174 = 0
#274 = 0
#175 = 0
#275 = 0
#176 = 0
#276 = 0
#177 = 0
#277 = 0
#178 = 0
#278 = 0
#179 = 0
#279 = 0
#180 = 0
#280 = 0
#181 = 0
#281 = 0
#182 = 0
#282 = 0
#183 = 0
#283 = 0
#184 = 0
#284 = 0
#185 = 0
#285 = 0
#186 = 0
#286 = 0
#187 = 0
#287 = 0
#188 = 0
#288 = 0
#189 = 0
#289 = 0
#190 = 0
#290 = 0
#191 = 0
#291 = 0
#192 = 0
#292 = 0
#193 = 0
#293 = 0
#194 = 0
#294 = 0
#195 = 0
#295 = 0
#196 = 0
#296 = 0
#197 = 0
#297 = 0
#198 = 0
#298 = 0
#199 = 0
#299 = 0
G56 X185 Y195 (Park heads)
M90003 (Management VBA dialog)
M30
O99 (SUB for single PCB)
M1 (Do G55 for Rot:0)
M98 P0
G56 X185 Y195 (Park heads)
M1 (Do G55 for Rot:90)
M98 P90
G56 X185 Y195 (Park heads)
M99 (SUB END PCB)
O0(SUB for Rot:0)
M90001 P0 (Select HL0)
G56 (Pick  HL0, FL10, R2, R0805, 200R)
X[103.6141 + #10 * -4] Y85.0109
#10 = [#10 + 1]
Z352
M90002 (Vacuum Toggle)
Z0
M90001 P1 (Select HL1)
G56 (Pick  HL1, FL10, R3, R0805, 200R)
X[106.9047 + #10 * -4] Y40.3078
#10 = [#10 + 1]
Z330
M90002 (Vacuum Toggle)
Z0
M90001 P2 (Select HL2)
G56 (Pick  HL2, FL16, R7, R0805, 10k)
X[118.9844 + #16 * -4] Y64.2141
#16 = [#16 + 1]
Z181.5
M90002 (Vacuum Toggle)
Z0
M90001 P3 (Select HL3)
G56 (Pick  HL3, FL16, R8, R0805, 10k)
X[110.4719 + #16 * -4] Y-24.9859
#16 = [#16 + 1]
Z330
M90002 (Vacuum Toggle)
Z0
M90001 P0 (Select HL0)
G59 P[#100] (Place  HL0, FL10, R2, R0805, 200R)
X108.1641 Y108.3609
Z384
M90002 (Vacuum Toggle)
Z0
M90001 P1 (Select HL1)
G59 P[#100] (Place  HL1, FL10, R3, R0805, 200R)
X114.0547 Y63.6578
Z360
M90002 (Vacuum Toggle)
Z0
M90001 P2 (Select HL2)
G59 P[#100] (Place  HL2, FL16, R7, R0805, 10k)
X118.4625 Y29.35
Z198
M90002 (Vacuum Toggle)
Z0
M90001 P3 (Select HL3)
G59 P[#100] (Place  HL3, FL16, R8, R0805, 10k)
X112.6 Y-59.85
Z360
M90002 (Vacuum Toggle)
Z0
M90001 P2 (Select HL2)
G56 (Pick  HL2, FL16, R6, R0805, 10k)
X[118.9844 + #16 * -4] Y64.2141
#16 = [#16 + 1]
Z181.5
M90002 (Vacuum Toggle)
Z0
M90001 P0 (Select HL0)
G56 (Pick  HL0, FL10, R4, R0805, 200R)
X[103.6141 + #10 * -4] Y85.0109
#10 = [#10 + 1]
Z352
M90002 (Vacuum Toggle)
Z0
M90001 P1 (Select HL1)
G56 (Pick  HL1, FL10, R5, R0805, 200R)
X[106.9047 + #10 * -4] Y40.3078
#10 = [#10 + 1]
Z330
M90002 (Vacuum Toggle)
Z0
M90001 P0 (Select HL0)
G59 P[#100] (Place  HL0, FL10, R4, R0805, 200R)
X113.3641 Y108.3609
Z384
M90002 (Vacuum Toggle)
Z0
M90001 P1 (Select HL1)
G59 P[#100] (Place  HL1, FL10, R5, R0805, 200R)
X119.2547 Y63.6578
Z360
M90002 (Vacuum Toggle)
Z0
M90001 P2 (Select HL2)
G59 P[#100] (Place  HL2, FL16, R6, R0805, 10k)
X123.7125 Y29.35
Z198
M90002 (Vacuum Toggle)
Z0
M90001 P1 (Select HL1)
G56 (Pick  HL1, FL11, C1, CAP_0805, 0.1uF)
X[110.9938 + #11 * -4] Y12.3937
#11 = [#11 + 1]
Z330
M90002 (Vacuum Toggle)
Z0
M90001 P2 (Select HL2)
G56 (Pick  HL2, FL09, C2, CAP_0805, 0.01uF)
X[114.5125 + #9 * -4] Y-7.8
#9 = [#9 + 1]
Z181.5
M90002 (Vacuum Toggle)
Z0
M90001 P1 (Select HL1)
G59 P[#100] (Place  HL1, FL11, C1, CAP_0805, 0.1uF)
X119.0547 Y76.8078
Z360
M90002 (Vacuum Toggle)
Z0
M90001 P2 (Select HL2)
G59 P[#100] (Place  HL2, FL09, C2, CAP_0805, 0.01uF)
X128.8125 Y28.7
Z198
M90002 (Vacuum Toggle)
Z0
M99 (SUB END Rot:0)
O90(SUB for Rot:90)
M90001 P0 (Select HL0)
G56 (Pick  HL0, FL17, R1, R0805, 3K3)
X[107.9938 + #17 * -4] Y175.0409
#17 = [#17 + 1]
Z352
M90002 (Vacuum Toggle)
Z0
M90001 P2 (Select HL2)
G56 (Pick  HL2, FL14, D1, LED3216, )
X[118.8925 + #14 * -4] Y18.07
#14 = [#14 + 1]
Z181.5
M90002 (Vacuum Toggle)
Z0
M90001 P1 (Select HL1)
G56 (Pick  HL1, FL15, ZD1, PESD3V3L4UG, )
X[111.8781 + #15 * -4] Y83.9515
#15 = [#15 + 1]
Z330
M90002 (Vacuum Toggle)
Z0
M90001 P0 (Select HL0)
G59 P[#100] (Place  HL0, FL17, R1, R0805, 3K3)
X112.3141 Y72.5609
Z384
M90002 (Vacuum Toggle)
Z0
M90001 P1 (Select HL1)
G59 P[#100] (Place  HL1, FL15, ZD1, PESD3V3L4UG, )
X119.1047 Y31.8078
Z360
M90002 (Vacuum Toggle)
Z0
M90001 P2 (Select HL2)
G59 P[#100] (Place  HL2, FL14, D1, LED3216, )
X123.0125 Y-13.05
Z198
M90002 (Vacuum Toggle)
Z0
M99 (SUB END Rot:90)