hexagon logo

Dropdown List of Stylus in program

Hello All.

I hit a bump and I can't seem to figure out what I am missing.

I have used dropdown lists before, and I am unaware what I am missing.

'  Rploughe 2015
'
Sub Main()
Dim App As Object
Dim Part As Object
Dim Cmds As Object
Dim Cmd As Object
Dim PartProbes, PartProbe, ProbeTips, ProbeTip
Dim Prober1
Dim ProbeList$( ) 

'Creat PC-Dmis Commands
Set App = CreateObject("PCDLRN.Application")
Set Part = App.ActivePartProgram
Set Cmds = Part.Commands
serverpath = "Z:\01 Leitz PMM-Xi\probes\" 'Path coded To point To probes folder

'Assign searchpath using "serverpath"
Dim filename As String
Dim count As Integer
Dim ECount As Integer
count = 9000

'Redimension array With correct count of entries
ReDim ProbeList$(Count)
filename = Dir(serverpath & "*.*", 0) 'value of "0" pulls In all files In directory given
Let ECount = "0"
While filename <> ""
    filelength = len(filename)
    delimper = instr(1,filename,".")
    delimp = Right$(filename,(filelength-delimper))
    If delimp = "PRB" Then
         checker = Left$(filename,(filelength-4))
         For Each Cmd In Cmds
              If Cmd.Type = GET_PROBE_DATA Then
                   bln = Cmd.GetText(File_Name, 0)
                   If checker = bln Then
                        ProbeList$(ECount) = checker  [COLOR=#ff0000][B]<-- If I call out "checker" here, a msgbox shows the correct value.[/B][/COLOR]
                   End If
              End If
         Next Cmd  
    End If
    ECount = ECount + 1  [COLOR=#0000FF][B]<-- This is in the wrong location, caused my list to populate blank entries.  Moved below the "checker" assignment above, and works fine.[/B][/COLOR]
    filename = Dir ' find the Next file
Wend

MsgBox (probelist (0))  [COLOR=#ff0000][B]<-- Even here I get a blank window.  So I am missing the correct way to call out a list value.[/B][/COLOR]

'Opens Dialog For Input
Begin Dialog DIALOG_1 50,10, 225, 75,      oCalibrationSelection
'Text For Operator Input
     'Box & Text For Operator Input
         Text                5,7,85,12, "Select Stylus :"
         ListBox    57,5,100,50, ProbeList$( ), .Lstbox

'Ok And Cancel Buttons 
  OKButton       165,5,50,15
  CancelButton 165,25,50,15
 End Dialog

'Code Begins
Dim Dialg As DIALOG_1
button = Dialog(Dialg)
If Button = 0 Then Exit Sub

'Dimensions Each box Input To an assignment
Oper1 = ProbeList (Dialg.Lstbox)  [COLOR=#ff0000][B]<-- This is my problem area.  I do not know why this won't pull in my selected value from the dropdownlist.
[/B][/COLOR]
MsgBox (ProbeList(0))
MsgBox (ProbeList (1))[COLOR=#ff0000][B] <-- I tried to simulate the process and still get a blank box[/B][/COLOR]
MsgBox (Dialg.lstbox)  [COLOR=#ff0000][B]<-- This does give me the value I selected, ex. 0,1,2[/B][/COLOR]
MsgBox (Oper1)

'Begins the Variable assignment To PCDMIS For Each COMMAND
For Each Cmd In Cmds
    If Cmd.Type = ASSIGNMENT Then
         If Cmd.GetText(DEST_EXPR,0) = "PROBECHOICE" Then
         bln = Cmd.PutText("""" + Oper1 + """", SRC_EXPR, 0)  [COLOR=#ff0000][B]<-- An attempt to show the result in a variable, the variable value does not change.[/B][/COLOR]
         Cmd.ReDraw
         End If
    End If
Next Cmd

Set PartProbes = Part.Probes("RBS_HALFLEFT")  [COLOR=#ff0000][B]<-- Future use of pulled value.  If I type in the value as shown, it works.[/B][/COLOR]

'Cleanup
Set Cmd = Nothing
Set Cmds = Nothing
Set Part = Nothing
Set App = Nothing
End Sub



^Nevermind, I figured out. See blue text above.
Parents
  • I'm not!


    I had it working - or at least for one probe it worked!

    I changed quite a lot to work around it adding/changing code in the edit window but couldn't get it working.

    So I've come back to the original code (which I'd only commented out and it's NOT working)


    Basically I get this...


    Using Qualify2 - it de-selects any selected tips before it qualifies - Now this might still be okay if you either want to do them all, or in later versions if you have the 'Tips to use if none explicitly selected' set to 'Used in Program'.

    But it won't let me pick a custom selection of tips


    Using Qualify method - it will qualify the tips I select (i.e. it will make the CMM perform the qualification) , but it won't update the probe file!
Reply
  • I'm not!


    I had it working - or at least for one probe it worked!

    I changed quite a lot to work around it adding/changing code in the edit window but couldn't get it working.

    So I've come back to the original code (which I'd only commented out and it's NOT working)


    Basically I get this...


    Using Qualify2 - it de-selects any selected tips before it qualifies - Now this might still be okay if you either want to do them all, or in later versions if you have the 'Tips to use if none explicitly selected' set to 'Used in Program'.

    But it won't let me pick a custom selection of tips


    Using Qualify method - it will qualify the tips I select (i.e. it will make the CMM perform the qualification) , but it won't update the probe file!
Children
No Data