hexagon logo

How to reach which probes/tip angles are being used in a program...

The Pc-DMIS object library is so vast, I don't quite know where to begin.

What I want to do is open a file in vba, (this part I know how to do), and write out a list of which probes and tip angles are being used in the program. Not which ones are available, but which are being used.
Help??
  • You will probably need to read through the routine line by line (you can do this using a For / Next loop). Each time you encounter a LOADPROBE command or a TIP command, grab the probe name or TIP reference and write it out to a text file.
  • Something like this would work...

    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim DmisCommands As Object
    Dim DmisCommand As Object
    Dim PrbName, TipID, ProgName As String
    
    Sub Main
      Set DmisApp = CreateObject("PCDLRN.Application")
      Set DmisPart = DmisApp.ActivePartProgram
      Set DmisCommands = DmisPart.Commands
      CommandCount = DmisCommands.Count
      Set DmisCommand = DmisCommands.Item(CommandCount)
      DmisCommands.InsertionPointAfter DmisCommand
    
     Open "C:\Users\Public\Documents\Probe_And_TIps_List.csv" For Output As #1
      PrbName = ""
      TipID = ""
      ProgName = DmisPart.FullName
    
     For Each DmisCommand In DmisCommands
        If DmisCommand.Type = 61 Then ' 61 = LoadProbe command
          PrbName = DmisCommand.GetText(152,0) ' Data Type 152 = probefile Name
        End If
    
        If DmisCommand.Type = 60 Then ' 60 =  Set Active Tip Command
          TipID = DmisCommand.gettext(3,0) ' Data Type 3 = ID
        End If
    
        If PrbName <>  "" Then
          If TipID <> "" Then
            Print #1, ProgName & Chr(44) & PrbName & Chr(44) & TipID ' CHR(44) is the ASCII code For a comma
          End If
        End If
     Next  
    
     Close #1
    
    End Sub
    ​
  • i agree with Neil, i would suggest writing both loadprobe and tip commands

  • The Pc-DMIS object library is so vast, I don't quite know where to begin.

    What I want to do is open a file in vba, (this part I know how to do), and write out a list of which probes and tip angles are being used in the program. Not which ones are available, but which are being used.
    Help??


    I usually go into the EDIT / PREFERENCES / FONT and change the color of the loadprobe command so I can easily see it in the program.​




  • I just wanted to give Neil Challinor a big thank you. Your code was exactly what I needed. I used it to write an Access Database which scrolls through all of our programs, (all 6,300 of them) and records the probes/tip angles into a table that is then searchable. It also removes any records that are in the database but are no longer in a program. (This is for when we archive old programs that we don't need anymore.) It took something like 20 hours to run, but I finally got there.