hexagon logo

Probe Utilites Box

Does anyone know a way of closing the probe utilities box using VBA? I have tried using the Dialog method under the Probe Objects. I used Dialog.visible=False but couldn't get it to work. Is there possibly another way of doing this?
  • Hello,

    pcDMIS can't have intended this, but it seems to be working? could you please test this ^^

    in a test by me this script closes the probe dialog if it is open (v2021.2​).

    Sub Main()
    ' Dim Something
      Dim App As Object
      Set App = CreateObject("PCDLRN.Application")
    
      Dim Part As Object
      Set Part = App.ActivePartProgram
      Dim Name_of_a_Probe_as_string as string
    
    ' dialog ?
      Name_of_a_Probe_as_string = "G1_SP_60_4"
      Part.Probes.Item(Name_of_a_Probe_as_string).Dialog
    
      ' free something
      Set Part = Nothing
      Set App = Nothing
    End Sub
    ​


    I advise against using it even if it works. This cannot be intentional and may ruin your probe file.
  • This actually closes the dialog box? hmm that's weird. I will test in my script for the hell of it when I get a chance. I find it odd that they have a method for opening the probe utilities box, but nothing to close it.
  • Using .visible myself, what version are you running?

    Deallocating would call the destructor, it should be handled. It may not be optimal if you're going to access it again though, depending on the layout.
  • I am running V2017 R2, how about you? I am only accessing it once. The funny thing is in the obj library is says to use the dialog method to open the probe utilities, but I couldn't get it to work(I could have been doing it wrong though). However, I was able to use part.probes>probes.item>probe.tips to access the probe utilities. Here is my code so far. FYI I did cut out parts that don't pertain to the problem. But any who, I took the dialog method out of there. I got everything to work up until the end. Pcdmis removes all the tip angles, adds in the ones I need, calibrates the tip angles as it should, but I cannot get the dialog box to close, so when I quit the program after the auto calibration routine, the probe utilities box stays open and crashes pcdmis because of obvious reasons. I am rather new to the VB world, so maybe you could give me a suggestion? Thanks!

    app = CreateObject("PCDLRN.Application")
    Threading.Thread.Sleep(200)
    app.WaitUntilReady(20)
    app.Visible = True
    parts = app.PartPrograms
    parts.Open("C:\CalibrationProg" & PRG_Name & ".PRG", "CMM1") ' This opens and runs the Corresponding AutoCalibration program. The PCDmis programs reads in the tip angles from the txt file
    part = app.ActivePartProgram
    CurrPrb = part.CurrentProbeName
    'MsgBox(CurrPrb)
    probes = part.Probes
    probe = probes.Item(CurrPrb)
    probe.SelectAllTips()
    Tips = probe.Tips
    Tips.Remove(1)
    Dim Replaced1 As String
    Dim Replaced2 As String

    textline = ""
    If System.IO.File.Exists(file_name) = True Then
    Dim objreader As New System.IO.StreamReader(file_name)

    Do While objreader.Peek() <> -1
    Replaced1 = "T1A"
    Replaced2 = "B"

    textline = textline & objreader.ReadLine() & vbNewLine
    textline = Replace(textline, (Replaced1), "")
    textline = Replace(textline, (Replaced2), ",")
    'MsgBox(textline)
    Dim Angle_A As String
    Dim Angle_B As String
    Angle_A = Split(textline, ",")(0)
    Angle_B = Split(textline, ",")(1)
    Tips.Add(Angle_A, Angle_B)

    textline = ""


    Loop
    objreader.Close()
    End If

    probes.SaveChanges()
    part.EXECUTE()
    'part.Quit()
    'app.Visible = False​

  • Also, I just wanted to clarify I am not using. qualify to calibrate the angles. I am just removing the previous tip angles, adding in the ones I need, then using the autocailibrate command, using "all tips with defaults". So essentially after I add in my tips all I need to do is close the probe utilities box and execute the program. But this silly box will not go away!!! 8-(