hexagon logo

PartProgram.Probes returning Application.Probes

Hi Everyone,

I've learned a lot from this forum and would like to thank those taking the time to pass along their trials and tribulations. Like some others I am the only one in our company using the CMM so am without the benefit of a more experienced co-worker.

I've written a small utility to document the probe build components in a program. Originally I had hoped to use the PartProgram.Probes collection which supposedly "returns this part program's Probes collection object". For me, this is actually returning all probes listed in my probes search path location. Instead of getting the Part Program Probes collection it seems to provide the Application Probes collection. I'm currently having to loop through all a programs commands in order to trap the LOADPROBE and pull the components. Has anyone run into this before? Am I going about it wrong? Running 2014 SP1 and coding in Excel 2010.

Sub ListPartProgramProbes()
	Dim DmisApp as PCDLRN.Application
	Dim DmisPart as PCDLRN.PartProgram
	Dim DmisPrbs as PCDLRN.Probes
	Dim DmisPrb as PCDLRN.probe
	
	Set DmisApp = CreateObject("PCDLRN.Application")
	Set DmisPart = DmisApp.ActivePartProgram
	Set DmisPrbs = DmisPart.Probes
	
	For Each DmisPrb in DmisPrbs
		Debug.Print DmisPrb.Name
	Next DmisPrb
	
	Set DmisPrb = Nothing
	Set DmisPrbs = Nothing
	Set DmisPart = Nothing
	Set DmisApp = Nothing
End Sub
  • Everything looks good in your code. Probably help file semantics. I like the way you interpreted it. Would be handy to be able to get only the probes used by the program. As opposed to all the probes available to the program.

    You say tomato, i say tomahto Slight smile

    Sent from my SPH-L710 using Tapatalk
  • If I want to know if a probe is used in a program I do this:

    Open a DOS shell window. Change to your main program directory and type the following command, replacing your probe name with the one in the example.

    FINDSTR /S/M "V.P.T.P.R.O.B.E.1" *.PRG


    the /s and /m switches will recurse into all the subdirectories and display only the name of the program i.e.:

    VPTPROGS/VPTPROGRAMNAME.PRG
  • Thanks for the replies. Usually the documentation does a pretty good job of, well, documenting things. Looks like this slipped through the cracks. I used to spend a lot of time trying to figure out where my code went south. Now it's more of a "Oh, we have a new baseline". I've never tried that at the command prompt (I assume the periods are null characters?).
  • For me, this is actually returning all probes listed in my probes search path location. Instead of getting the Part Program Probes collection it seems to provide the Application Probes collection.


    I have the same problem...
    I use this solution (maybe some guy here has a better one, it could be useful !!!!!)

    In the program (edit window), just before the loadprobe command :

    V3=FILE/DIALOG................................................I open the probe folder, and choose the probe
    ASSIGN/V4=ELEMENT(5,"\\",V3)...........................The path has 5 "\" - this function keeps the name of the file.PRB
    ASSIGN/V5=ELEMENT(1,".",V4).............................It keeps only the name of the probe
    LOADPROBE/V5



    In a script :
    dim pcd as object
    dim prg as object
    dim pd as object
    dim diam1 as double
    dim tip1 as object
    dim varvalue as object
    dim probe_name as string
    
    ste pcd = createobject("pcdlrn.application","")
    set prg = pcd.activepartprogram
    prg.probes.visible=False
    set varvalue=prg.GetVariableValue("V5")
    probe_name=varvalue.stringvalue
    set tip1=prg.probes(probe_name).tips("T1A0B0")



    Hope this help...

    *Thanks Djams for the code... Slight smile