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 get to the Hierarchy of Probes. But. That is my wall. The .Qualify() command is hit and miss when executing, but the Part.Probes(Oper1) opens up the Probe Utilities dialogue. Anyone know how I can step down to gain access to the Probe (not Probes) command object members? I'm starting to get hesitant at fumbling around, like I noted, I have lost some stuff.


    See the slight addition below to get to the Probe object. I have never been able to prevent the Probe Utilities dialog from opening when working with the Probes object. Even when I set the Boolean .ShowDialog member to FALSE. (it might be .Visible or something else along those lines - not at work right now, but you get the idea).

    Good luck - looking forward to seeing how you progress. I would test the issues that NinjaBadger mentions as quickly as possible, to prevent spending a bunch of time getting to a dead end. If NB couldn't get it to work, there's probably no easy way to get it done using this method. (challenge issued! Slight smile )

    
     i = 0
     For Each Cmd In Cmds
     i = i + 1
     App.StatusBar = "Cycling through commands. Current command: " & i
         If Cmd.Type = GET_PROBE_DATA And Cmd.GetText(File_Name, 0) = Oper1 Then
              If Len(Cmd.GetText(File_Name,0)) > 0 Then 
                   ProbeCmd = Cmds.SetCurrentCommand(Cmds(i))
                   [COLOR=#0000cd][B]Dim PartProbe as Object[/B][/COLOR]
                   [COLOR=#0000cd][B]Set[/B][/COLOR] PartProbe = Part.Probes(Oper1)
              End If
         End If
     Next Cmd
    
    
Reply

  • I get to the Hierarchy of Probes. But. That is my wall. The .Qualify() command is hit and miss when executing, but the Part.Probes(Oper1) opens up the Probe Utilities dialogue. Anyone know how I can step down to gain access to the Probe (not Probes) command object members? I'm starting to get hesitant at fumbling around, like I noted, I have lost some stuff.


    See the slight addition below to get to the Probe object. I have never been able to prevent the Probe Utilities dialog from opening when working with the Probes object. Even when I set the Boolean .ShowDialog member to FALSE. (it might be .Visible or something else along those lines - not at work right now, but you get the idea).

    Good luck - looking forward to seeing how you progress. I would test the issues that NinjaBadger mentions as quickly as possible, to prevent spending a bunch of time getting to a dead end. If NB couldn't get it to work, there's probably no easy way to get it done using this method. (challenge issued! Slight smile )

    
     i = 0
     For Each Cmd In Cmds
     i = i + 1
     App.StatusBar = "Cycling through commands. Current command: " & i
         If Cmd.Type = GET_PROBE_DATA And Cmd.GetText(File_Name, 0) = Oper1 Then
              If Len(Cmd.GetText(File_Name,0)) > 0 Then 
                   ProbeCmd = Cmds.SetCurrentCommand(Cmds(i))
                   [COLOR=#0000cd][B]Dim PartProbe as Object[/B][/COLOR]
                   [COLOR=#0000cd][B]Set[/B][/COLOR] PartProbe = Part.Probes(Oper1)
              End If
         End If
     Next Cmd
    
    
Children
No Data