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.
  • When you say analog head you mean as oppose to indexing?

    Be warned: there are serious issues with the Qualify and Qualify2 methods, but this mainly relates to selecting specified tip angles, maybe with infinite angles head you might be okay, not having used one I can't comment.


    Badger, I'm not familiar with what you're referring to. Can you explain to me what you mean? I'm using PH10M (and MQ) heads all over the shop. What issues would I run into?
  • I tried write a tool which would qualify only the tips used in a program which hadn't been calibrated within a certain time frame.

    I couldn't get it to work (and I understand what I'm doing - i.e. it should have worked), and I've heard others report the same issues.

    I could get it to select the tips I wanted, but when I tried get it to qualify

    Using Qualify2 method - the 'Do you want to qualify All tips or none' question was still asked - rendering my required tip selection useless.

    Using Qualigy method - it performed the qualification of the tips (i.e. the CMM moved and took hits on the ref sphere) and I think it might have even generated/updated the results file, but the actual .prb file wasn't updated (i.e. the qualification data didn't hold).


    I think the company I tried write it for actually managed to achieve it, but I think the used part of the Windows API to in effect click the buttons on screen instead of using the pc-dmis automation language.

    Others have done it using the qualify single tip method - there should be a fairly recent thread in the code forum about it.

    I'm going to give it another go when I get a chance/the mod takes me. My approach will be to store all tip info in external file (probably .xml), delete all tips and just add the ones I want, then make it qualify all. Then I'll add the other saved tips back into the probe file.
  • yeah I saw the thread on it. kind of sparked my interest in this. I will keep poking around. See what I come up with.

  • 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
    
    
  • Nothing better to do so I'm revisiting it using the automation language.

    If it doesn't work then I'll try it using my construct/destruct/construct probe files method.
  • Don't get too excited here, but I think I may have ******* it!

    Watch this space!
  • Why on earth is the work c-r-a-c-k-e-d blocked?!?!
  • Oh yeah PC-Dmis - how do you like that? Like it do ya? love it do ya? well IN YOUR FACE!!!!!!!!!!


    GET THE FRICK IN THERE!!!!
  • Disappointed


    AAARRRGGGHHHHHH


    Right, so I can get it to select the tips I want, qualify them, results files generated AND .prb file updated.


    ...unless there's more that one probe in the program - in which case it decides it only wants to do A0B0, AND it will then change the last LOADPROBE command to a different probe.