hexagon logo

Detect presence of articulating probe head (and probe type also)

I'm trying to write a subroutine that I can call to have my CMMs run a quick check on a ring gage with tip 1. I want to be able to use the same subroutine on any machine, regardless of wether it has a Tesastar-m probe head, or a probe fixed to the quill. I'll add some other safe guards later to check the vector and diameter of the tip, incase it's pointing sideways or is a large disc and won't fit in the small ring gage.

To accomplish this, I think I need to test ifthere is a wrist present on the machine so I know to set the tip command to "TIP1" or "T1A0B0". I have a Basic script that can report what type of probe is in use, so I can easily tell if I'm using an LSP-X1s or X1c, and therefore, if there is an articulating probehead. However, I'd like to make the script robust enough so if I have, say an SP25 (which our sister company has), it can tell if its "quill-mounted" with a PH6M or on a probe head such as a PH10 or Tesastar-m. Anyone have any recommendations?
  • Doesn't the Probe object contain an inventory of all the hardware items in the assembly?
  • I believe it does, but I haven't been able to figure out what enumerations to use in the calls to find the right components. Unfortunately, I don't have alot of experience with scripting inside PC-DMIS, most of what I have done is from a stand-alone VB application, and is pushing data into PC-DMIS not trying to get information back out.
  • I never tried to get the info either, just remember seeing it in the object browser. If I get some time I'll tinker with it and see if I can figure it out.
  • This seems to work. I can tell from your posts that this will be more than sufficient to get you going.
        Set app = CreateObject("PCDLRN.Application")
        Set part = app.ActivePartProgram
        Set prb = part.Probes(part.CurrentProbeName)
        
        For I = 0 To prb.ConnectionCount
            prb.ActiveConnection = I
            For J = 0 To prb.ComponentCount
              Debug.Print I, J, prb.ConnectionDescription(I), prb.ComponentDescription(J)
            Next
        Next


    Here is the start of the output that shows up in the VB Immediate window:
    0             0            PROBEPH10MQ   1mm_FIXEDBALLwithSTEM
     0             1            PROBEPH10MQ   25.41-BT40(Shank)
     0             2            PROBEPH10MQ   25.41-BT50(Shank)
     0             3            PROBEPH10MQ   25.41-CAT40(Shank)
     0             4            PROBEPH10MQ   25.41-CAT50(Shank)
     0             5            PROBEPH10MQ   25.41-HDR(Body)
     0             6            PROBEPH10MQ   25.41-HSK100A(Shank)
     0             7            PROBEPH10MQ   25.41-HSK63A(Shank)
     0             8            PROBEPH10MQ   25.44-TMPHDR(Body)
     0             9            PROBEPH10MQ   2mm_FIXEDBALL
     0             10           PROBEPH10MQ   2mm_FIXEDBALLwithSTEM
     0             11           PROBEPH10MQ   30mm_FIXEDBALLwithSTEM
     0             12           PROBEPH10MQ   3mm_FIXEDBALL
     0             13           PROBEPH10MQ   3mm_FIXEDBALLwithSTEM
     0             14           PROBEPH10MQ   40.00-BT30(Shank)
     0             15           PROBEPH10MQ   40.00-BT40(Shank)
     0             16           PROBEPH10MQ   40.00-CAT40(Shank)
     0             17           PROBEPH10MQ   40.00-HSK40E-36-TI-V1(ThermoBlockShank))
     0             18           PROBEPH10MQ   40.00-HSK40E-L36(Shank)


    So prb.ConnectionDescription(0) gives direct access to the name of first component in the probe assembly.
  • I actually made some progress yesterday afternoon, but didn't see your post until this morning. This is what I've made so far, though passing a variable back into the program was giving me some grief:

    Sub Main
    	CHECKBUSH
    End Sub
    
    Sub CHECKBUSH
    	'Declare local variables
    	Dim DmisApp As Object
    	Dim DmisPart As Object
    	Dim Probe As Object
    	Dim tempstr as String
    	Dim Var as Object
    
    
    	'Set application objects
    	Set DmisApp = CreateObject ("PCDLRN.Application")
    	Set DmisPart = DmisApp.ActivePartProgram
    	Set Probe = DmisPart.Probes(DmisPart.CurrentProbeName)
    	Set Var = DmisPart.GetVariableValue ("V1")
    	Var.LongValue = 0
    
    
    	'Iterate through probe components looking for probehead
    	For i = 0 to Probe.ConnectionCount() - 1
    
    		tempstr = Ucase(Probe.ConnectionDescription(i))
    
    		If InStr(1, tempstr, "TESASTAR_M") Then
    			Var.LongValue = 1
    			Exit For
    		ElseIf InStr(1, tempstr, "TESASTAR_SM") Then
    			Var.LongValue = 1
    			Exit For
    		ElseIf InStr(1, tempstr, "PH8") Then 
    			Var.LongValue = 1
    			Exit For
    		ElseIf InStr(1, tempstr, "PH9") Then
    			Var.LongValue = 1
    			Exit For
    		ElseIf InStr(1, tempstr, "PH10") Then
    			Var.LongValue = 1
    			Exit For
    		End If
    
    	Next
    
    	DmisPart.SetVariableValue "V1", Var
    	DmisPart.RefreshPart
    
    	'Clear objects
    	Set Var = Nothing
    	Set Probe = Nothing
    	Set DmisPart = Nothing
    	Set DmisApp = Nothing
    
    End Sub
    
  • So I ended up taking this a few steps further. My basic script is not only telling me if I have in indexing probe head, but also if I have an analog probe, and if so, it is passing back the OPTIONPROBE parameters.

    Keep in mind, all of the OPTIONPROBE parameters I have listed here are default values I came across over time, and may not be correct.

    Here's what my "PROBEPARAMS.BAS" file looks like:

    Dim DmisApp As Object
    Dim DmisPart As Object
    Dim Commands as Object
    
    Sub Main
    	OpenPCDMISConnection
    	GetProbeData
    	ClosePCDMISConnection
    
    End Sub
    
    Sub OpenPCDMISConnection
    	'Populate Application Objects
    	Set DmisApp = CreateObject ("PCDLRN.Application")
    	Set DmisPart = DmisApp.ActivePartProgram
    	Set Commands = DmisPart.Commands
    
    End Sub
    
    Sub ClosePCDMISConnection
    	'Destroy Application Objects
    	Set Commands = Nothing
    	Set DmisPart = Nothing
    	Set DmisApp = Nothing
    
    End Sub
    
    Sub GetProbeData
    	'Returns information regarding probe and probe head
    	'Sets OptionProbe parameters for analog probes
    
    	'Declare Local Variables
    	Dim Probe As Object
    	Dim ProbeHeadVar as Object
    	Dim ScanningEnabled as Object
    	Dim tempstr as String
    	Dim temp as string
    
    	'Populate Local Objects
    	Set Probe = DmisPart.Probes(DmisPart.CurrentProbeName)
    	Set ProbeHeadVar = DmisPart.GetVariableValue ("V1")
    	ProbeHeadVar.LongValue = 0
    	Set ScanningEnabled = DmisPart.GetVariableValue ("V9")
    	ScanningEnabled.LongValue = 0
    
    	'Iterate through probe components looking for probehead
    	For i = 0 to Probe.ConnectionCount() - 1
    
    		tempstr = Ucase(Probe.ConnectionDescription(i))
    
    		If InStr(1, tempstr, "TESASTAR_M") Then
    			ProbeHeadVar.LongValue = 1
    			Exit For
    		ElseIf InStr(1, tempstr, "TESASTAR_SM") Then
    			ProbeHeadVar.LongValue = 1
    			Exit For
    		ElseIf InStr(1, tempstr, "PH8") Then 
    			ProbeHeadVar.LongValue = 1
    			Exit For
    		ElseIf InStr(1, tempstr, "PH9") Then
    			ProbeHeadVar.LongValue = 1
    			Exit For
    		ElseIf InStr(1, tempstr, "PH10") Then
    			ProbeHeadVar.LongValue = 1
    			Exit For
    		End If
    	Next
    
    		
    	For j = 0 to Probe.ConnectionCount() - 1
    	
    		tempstr = Ucase(Probe.ConnectionDescription(j))
    	
    		If InStr(1, tempstr, "SP25") Then
    			'msgbox "Probe Type: SP25"
    			SetOptProbeParams(1)
    			ScanningEnabled.LongValue = 1
    			Exit For
    			
    		ElseIf InStr(1, tempstr, "SP600") Then
    			'msgbox "Probe Type: SP600"
    			SetOptProbeParams(2)
    			ScanningEnabled.LongValue = 1
    			Exit For
    		
    		ElseIf InStr(1, tempstr, "SP80") and Not InStr(1, tempstr, "SP80_") Then
    			'msgbox "Probe Type: SP80"
    			SetOptProbeParams(3)
    			ScanningEnabled.LongValue = 1
    			Exit For
    		
    		ElseIf InStr(1, tempstr, "LSPX1S") Then
    			'msgbox "Probe Type: LSP-X1s/c"
    			SetOptProbeParams(4)
    			ScanningEnabled.LongValue = 1
    			Exit For
    			
    		ElseIf InStr(1, tempstr, "LSPX1C") Then
    			'msgbox "Probe Type: LSP-X1s/c"
    			SetOptProbeParams(4)
    			ScanningEnabled.LongValue = 1
    			Exit For
    		
    		ElseIf InStr(1, tempstr, "LSPX1M") Then
    			'msgbox "Probe Type: LSP-X1m/e"
    			SetOptProbeParams(5)
    			ScanningEnabled.LongValue = 1
    			Exit For
    			
    		ElseIf InStr(1, tempstr, "LSPX1E") Then
    			'msgbox "Probe Type: LSP-X1m/e"
    			SetOptProbeParams(5)
    			ScanningEnabled.LongValue = 1
    			Exit For
    		
    		ElseIf InStr(1, tempstr, "LSPX3") or InStr(1, tempstr, "LSPX5") Then
    			'msgbox "Probe Type: LSP-X3/X5"
    			SetOptProbeParams(6)
    			ScanningEnabled.LongValue = 1
    			Exit For
    		
    		Else
    
    		End If
    
    	Next
    
    	'Set PC-DMIS part program variable values
    	DmisPart.SetVariableValue "V1", ProbeHeadVar
    	DmisPart.SetVariableValue "V9", ScanningEnabled
    	DmisPart.RefreshPart
    
    	'Clear Local Objects
    	Set ProbeHeadVar = Nothing
    	Set Probe = Nothing
    
    End Sub
    
    Sub SetOptProbeParams(ProbeType as integer)
    	'Sets OptionProbe parameters for analog probes
    	
    	'Declare Local Application Objects
    	Dim cmds as Object
    	Dim cmd as Object
    	
    	'Declare Local Variables
    	Dim MaxForce as Object, LowerForce as Object, UpperForce as Object
    	Dim TriggerForce as Object, ReturnSpeed as Object, ScanOffsetForce as Object
    	Dim TouchSpeed as Object
    	
    	'Populate Local Application Objects
    	Set cmds = DmisPart.Commands
    	
    	'Populate Local Variables
    	Set MaxForce = DmisPart.GetVariableValue ("V2")
    	Set LowerForce = DmisPart.GetVariableValue ("V3")
    	Set UpperForce = DmisPart.GetVariableValue ("V4")
    	Set TriggerForce = DmisPart.GetVariableValue ("V5")
    	Set ReturnSpeed = DmisPart.GetVariableValue ("V6")
    	Set ScanOffsetForce = DmisPart.GetVariableValue ("V7")
    	Set TouchSpeed = DmisPart.GetVariableValue ("V8")
    	
    	'Populate Local Variables
    	Select Case ProbeType
    		Case 1
    			'Set parameters for SP25
    			MaxForce.DoubleValue = 0.15
    			LowerForce.DoubleValue = 0.025
    			UpperForce.DoubleValue = 0.075
    			TriggerForce.DoubleValue = 0.05
    			ReturnSpeed.DoubleValue = 1.0
    			ScanOffsetForce.DoubleValue = 0.05
    			TouchSpeed.DoubleValue = 4
    		Case 2
    			'Set parameters for SP600
    			MaxForce.DoubleValue = 0.36
    			LowerForce.DoubleValue = 0.06
    			UpperForce.DoubleValue = 0.18
    			TriggerForce.DoubleValue = 0.12
    			ReturnSpeed.DoubleValue = 1.0
    			ScanOffsetForce.DoubleValue = 0.12
    			TouchSpeed.DoubleValue = 5
    		Case 3
    			'Set parameters for SP80
    			MaxForce.DoubleValue = 0.6
    			LowerForce.DoubleValue = 0.04
    			UpperForce.DoubleValue = 0.16
    			TriggerForce.DoubleValue = 0.1
    			ReturnSpeed.DoubleValue = 0.6
    			ScanOffsetForce.DoubleValue = 0.2
    			TouchSpeed.DoubleValue = 4
    		Case 4
    			'Set parameters for LSP-X1s/c
    			MaxForce.DoubleValue = 0.072
    			LowerForce.DoubleValue = 0.0096
    			UpperForce.DoubleValue = 0.048
    			TriggerForce.DoubleValue = 0.015
    			ReturnSpeed.DoubleValue = 0.4
    			ScanOffsetForce.DoubleValue = 0.036
    			TouchSpeed.DoubleValue = 2
    		Case 5
    			'Set parameters for LSP-X1m/e
    			MaxForce.DoubleValue = 0.036
    			LowerForce.DoubleValue = 0.0048
    			UpperForce.DoubleValue = 0.024
    			TriggerForce.DoubleValue = 0.01
    			ReturnSpeed.DoubleValue = 0.4
    			ScanOffsetForce.DoubleValue = 0.018
    			TouchSpeed.DoubleValue = 2
    		Case 6
    			'Set parameters for LSP-X3c/t & LSP-X5
    			MaxForce.DoubleValue = 0.5
    			LowerForce.DoubleValue = 0.04
    			UpperForce.DoubleValue = 0.25
    			TriggerForce.DoubleValue = 0.15
    			ReturnSpeed.DoubleValue = 0.4
    			ScanOffsetForce.DoubleValue = 0.2
    			TouchSpeed.DoubleValue = 2
    
    		Case 7
    
    		Case 8
    		
    		Case 9
    		
    	End Select
    	
    	'Set PC-DMIS part program variable values
    	DmisPart.SetVariableValue "V2", MaxForce
    	DmisPart.SetVariableValue "V3", LowerForce
    	DmisPart.SetVariableValue "V4", UpperForce
    	DmisPart.SetVariableValue "V5", TriggerForce
    	DmisPart.SetVariableValue "V6", ReturnSpeed
    	DmisPart.SetVariableValue "V7", ScanOffsetForce
    	DmisPart.SetVariableValue "V8", TouchSpeed
    
    End Sub
    


    Variables being passed back are:

    V1 = Bit value for indexing probe head (0=No/1=Yes)
    V2 = Max force OptionProbe setting
    V3 = Lower force OptionProbe setting
    V4 = Upper force OptionProbe setting
    V5 = Trigger force OptionProbe setting
    V6 = Return speed OptionProbe setting
    V7 = Scan offset force OptionProbe setting
    V8 = Touch speed setting
    V9 = Scanning enabled bit value (0=No/1=Yes)

    And this is a simplified version of how I'm using it:

    $$ NO,
                Declare variables
                ASSIGN/V1=0
                ASSIGN/V2=0
                ASSIGN/V3=0
                ASSIGN/V4=0
                ASSIGN/V5=0
                ASSIGN/V6=0
                ASSIGN/V7=0
                ASSIGN/V8=0
                ASSIGN/V9=0
    $$ NO,
                Determine probe and probehead type
    CS1        =SCRIPT/FILENAME= PROBEPARAMS.BAS
                FUNCTION/Main,SHOW=YES,,
                STARTSCRIPT/
    $$ NO,
                Set active tip, enabling/disabling articulating probe head
                IF/V1==1
                ASSIGN/V10="T1A0B0"
                END_IF/
                IF/V1==0
                ASSIGN/V10="TIP1"
                END_IF/
                TIP/V10, SHANKIJK=0, 0, 1, ANGLE=0
    $$ NO,
                Set OPTIONPROBE parameters
                OPTIONPROBE/MAXFORCE=V2,LOWFORCE=V3,UPPERFORCE=V4,TRIGGERFORCE=V5,
                  PROBEACCURACY=0.1,POSACCURACY=0.1,#RETURNDATA=7,
                  RETURNSPEED=V6,SCANPNTDENSITY=2,
                  SCANACCELERATION=10,SCANOFFSETFORCE=V7,
                  PROBINGMODE=DFL,MANFINEPROBING=NO
                MOVESPEED/ 100
                TOUCHSPEED/ V8
                SCANSPEED/5
                PREHIT/0.05
                RETRACT/0.05
    


    Additional handling would be needed for the touch speed incase the probe does not have scanning capability. One easy way to do it would be to check the value of variable V8 before the TOUCHSPEED command, and if it is null or zero, set it to the default value you want.

  • $$ NO,
    Set active tip, enabling/disabling articulating probe head
    IF/V1==1
    ASSIGN/V10="T1A0B0"
    END_IF/
    IF/V1==0
    ASSIGN/V10="TIP1"
    END_IF/
    TIP/V10, SHANKIJK=0, 0, 1, ANGLE=0

    EWE, I was trying to use this part of your code. I have 2 cmm's one with a PH10, the other a PH6. When copying a program from 1 cmm to the other, I get invalid tip errors until I correct the

    TIP/ TIP1 or T1A0B0, SHANKIJK=0, 0, 1, ANGLE=0

    tipname parameter as required on each machine.
    I was hoping your method would keep me from the program stopping "illegal tipname" dialog.
    But it dosnt. It dosnt like the variable name in there I guess. Here is my adaptation of your code
                ASSIGN/WHATPROBE=GETSETTING("PH9 PRESENT")
                IF/WHATPROBE==1
                ASSIGN/TNAME="T1A0B0"
                END_IF/
                IF/WHATPROBE==0
                ASSIGN/TNAME="TIP1"
                END_IF/
                LOADPROBE/PROBE_83715-XXX
                TIP/TNAME, SHANKIJK=0, 0, 1, ANGLE=0

    TNAME shows as red. But when I enter it after the TIP/ pcdmis asks me if I'm referring to the variable or not.
    Any ideas?
  • UPDATE; I kept playing with it, copying and pasting the variable name, and trying different stuff - finally the red went away from the TNAME variable.
    Then I ran it online - and the variable is reading the correct value now.
    I'll keep testing and let you know.