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?
Parents
  • 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​

Reply
  • 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​

Children
No Data