[Jo...] Posted yesterday at 01:21 PM Share Posted yesterday at 01:21 PM I am trying to write a simplified PCM code to do the validate probe data. I have one already just trying to cut it down and make it easier. First step is to read all the data of a given probe to validate. I have a list of probes from a text file that i loop through to validate, but i want to use: //rad1=(getProbe("1",line[I]).diameter*25.4) //rad2=(getProbe("2",line[I]).diameter*25.4) //rad3=(getProbe("3",line[I]).diameter*25.4) //rad4=(getProbe("4",line[I]).diameter*25.4) //rad5=(getProbe("5",line[I]).diameter*25.4) //std1=(getProbe("1",line[I]).stdProbeDev) //std2=(getProbe("2",line[I]).stdProbeDev) //std3=(getProbe("3",line[I]).stdProbeDev) //std4=(getProbe("4",line[I]).stdProbeDev) //std5=(getProbe("5",line[I]).stdProbeDev) //px1=(getProbe("1",line[I]).probeVector.x) //px2=(getProbe("2",line[I]).probeVector.x) //px3=(getProbe("3",line[I]).probeVector.x) //px4=(getProbe("4",line[I]).probeVector.x) //px5=(getProbe("5",line[I]).probeVector.x) //py1=(getProbe("1",line[I]).probeVector.y) //py2=(getProbe("2",line[I]).probeVector.y) //py3=(getProbe("3",line[I]).probeVector.y) //py4=(getProbe("4",line[I]).probeVector.y) //py5=(getProbe("5",line[I]).probeVector.y) Problem is if the probe does not have the tip given, it will error. I am trying to find PCM code to ONLY use the tips in a given probe cofiguration. All I have found so far to do this is with the Active probe, but I am doing all this before the probes are active. The way I am doing it right now is to have a running list of each probe and tips, and only evaluate certain ones... trying to get this simplified so that with new programmers in training, it will be less to update and make errors when a new configuration is made. Link to comment Share on other sites More sharing options...
[Ri...] Posted 6 hours ago Share Posted 6 hours ago //systemCall("cmd.exe /c taskkill /IM notepad.exe /F") // Constants MAX_STYLI = 10 MAX_SELECT = 11 // Reference Sphere Diameter Ref1Dia = baseSystem().machine.machineControl.sphereNormalObject.sphereRadius * 2 // Clear files deleteFile(systemFile) deleteFile(styliFile) deleteFile(correctionFile) // Stylus System selection (Sorted) probeKeys = baseSystem().machine.machineAllProbeObjects.keys.asList probeKeys.sort // Alphabetical sort (ascending) SS_List = "stylusSystem=inquireList(" + chr(34) + "Select Stylus System to Evaluate" + chr(34) for i = 1 to probeKeys.size SS_List = SS_List + "," + chr(34) + getParameterNamed(probeKeys, i) + chr(34) next i SS_List = SS_List + ")" addToFile(systemFile, SS_List) runPCMFile(systemFile) changeStylusSystem(stylusSystem) // Gather active stylus tips activeStylusTips = baseSystem().machine.machineProbeConfiguration.allProbes.values.asList styli_List = "" for i = 1 to activeStylusTips.size currentTip = getParameterNamed(activeStylusTips, i) styli_List = styli_List + currentTip.ident + cr() + currentTip.probeName + cr() next i addToFile(styliFile, styli_List) // Read stylus tip list styli_ListFile = readListFile(styliFile) // Tip assignments for i = 1 to 5 tip_num = val(getParameterNamed(styli_ListFile, i * 2 - 1)) tip_name = getParameterNamed(styli_ListFile, i * 2) if tip_num == 1 tip1 = tip_name tip1num = 1 endif if tip_num == 2 tip2 = tip_name tip2num = 2 endif if tip_num == 3 tip3 = tip_name tip3num = 3 endif if tip_num == 4 tip4 = tip_name tip4num = 4 endif if tip_num == 5 tip5 = tip_name tip5num = 5 endif next i // Initialize stylus array for i = 1 to MAX_STYLI stylus[i] = i Styli[i] = 0 next i stylus[MAX_SELECT] = "1-10" for i = 1 to MAX_SELECT selectstylus[i] = "-" next i // Other initialization TypCMM = "" AR_stylus = getCFNames() runMode = getRunID() cncBreak = 0 l = 1 // Auto-run logic CR2 = getParameterNamed(AR_stylus, 2) CRX = "End" if CR2 == "Activate" and runMode == "Detail" for m = 1 to 11 selectstylus[m] = getParameterNamed(AR_stylus, m + 2) if selectstylus[m] == CRX selectstylus[m] = "-" m = 11 else selectstylus[m] = val(selectstylus[m]) Styli[selectstylus[m]] = 1 endif next m else selectCase runMode // Manual Detail Mode case runMode == "Detail" selectstylus[1] = inquireList("Please select the stylus you want to verify.", stylus[1], stylus[2], stylus[3], stylus[4], stylus[5], "cancel") if selectstylus[1] == "cancel" cncBreak() endif if selectstylus[1] == "1-10" for m = 1 to MAX_STYLI Styli[m] = 1 selectstylus[m] = stylus[m] next m l = MAX_SELECT endif for s = 1 to MAX_STYLI if selectstylus[1] == stylus[s] stylus[s] = "" Styli[s] = 1 endif next s m = 2 for j = 1 to 10 if cncBreak == 1 j = 10 else selectstylus[m] = inquireList("Please select the stylus you want to verify.", stylus[1], stylus[2], stylus[3], stylus[4], stylus[5], "ready", "cancel") if selectstylus[m] == "cancel" cncBreak() cncBreak = 1 j = 10 endif if selectstylus[m] == "" message("Please select a stylus, select 'ready' or select 'cancel'") j = j - 1 m = m - 1 endif if selectstylus[m] == "ready" selectstylus[m] = "-" j = 10 endif for s = 1 to MAX_STYLI if selectstylus[m] == stylus[s] Styli[s] = 1 stylus[s] = "" endif next s m = m + 1 endif next j // Run Complete Mode case runMode == "Run Complete" for m = 1 to MAX_STYLI Styli[m] = 1 selectstylus[m] = stylus[m] next m l = MAX_SELECT // Complete Mode case runMode == "Complete" for m = 1 to MAX_STYLI Styli[m] = 1 selectstylus[m] = stylus[m] next m l = MAX_SELECT endSelect endif // Disable unassigned tips if tip1num <> 1 Styli[1] = 0 endif if tip2num <> 2 Styli[2] = 0 endif if tip3num <> 3 Styli[3] = 0 endif if tip4num <> 4 Styli[4] = 0 endif if tip5num <> 5 Styli[5] = 0 endif Above is the code for a Stylus Verification/Adjustment measurement plan that I built to work for standard Star Probes. It will prompt you to select the stylus system that you want to verify/adjust. I believe that the only way (other than some hidden command that is known to few) to access the styli list for a particular stylus system is to have it active first. Obviously you do not need all of my code, but there are pieces of it that will work well for you. Mainly these parts: probeKeys = baseSystem().machine.machineAllProbeObjects.keys.asList probeKeys.sort // Alphabetical sort (ascending) SS_List = "stylusSystem=inquireList(" + chr(34) + "Select Stylus System to Evaluate" + chr(34) for i = 1 to probeKeys.size SS_List = SS_List + "," + chr(34) + getParameterNamed(probeKeys, i) + chr(34) next i SS_List = SS_List + ")" addToFile(systemFile, SS_List) runPCMFile(systemFile) changeStylusSystem(stylusSystem) // Gather active stylus tips activeStylusTips = baseSystem().machine.machineProbeConfiguration.allProbes.values.asList styli_List = "" for i = 1 to activeStylusTips.size currentTip = getParameterNamed(activeStylusTips, i) styli_List = styli_List + currentTip.ident + cr() + currentTip.probeName + cr() next i addToFile(styliFile, styli_List) // Read stylus tip list styli_ListFile = readListFile(styliFile) This will build a list of all of the Stylus Systems available, prompt you to select the stylus system that you want to validate, change to that stylus system, and finally build a list of the styli available on that stylus system. Link to comment Share on other sites More sharing options...
[Ri...] Posted 6 hours ago Share Posted 6 hours ago Oh, and you can handle the issue of only selecting the ones that exist with if statements in the PCM code, and putting Conditions on the Characteristic (this will force you to run from the Characteristics side though). I took this idea below from the O-Inspect ToA measurement plan - works great! // Tip assignments for i = 1 to 5 tip_num = val(getParameterNamed(styli_ListFile, i * 2 - 1)) tip_name = getParameterNamed(styli_ListFile, i * 2) if tip_num == 1 tip1 = tip_name tip1num = 1 endif if tip_num == 2 tip2 = tip_name tip2num = 2 endif if tip_num == 3 tip3 = tip_name tip3num = 3 endif if tip_num == 4 tip4 = tip_name tip4num = 4 endif if tip_num == 5 tip5 = tip_name tip5num = 5 endif next i // Initialize stylus array for i = 1 to MAX_STYLI stylus[i] = i Styli[i] = 0 next i stylus[MAX_SELECT] = "1-10" for i = 1 to MAX_SELECT selectstylus[i] = "-" next i // Other initialization TypCMM = "" AR_stylus = getCFNames() runMode = getRunID() cncBreak = 0 l = 1 // Auto-run logic CR2 = getParameterNamed(AR_stylus, 2) CRX = "End" if CR2 == "Activate" and runMode == "Detail" for m = 1 to 11 selectstylus[m] = getParameterNamed(AR_stylus, m + 2) if selectstylus[m] == CRX selectstylus[m] = "-" m = 11 else selectstylus[m] = val(selectstylus[m]) Styli[selectstylus[m]] = 1 endif next m else selectCase runMode // Manual Detail Mode case runMode == "Detail" selectstylus[1] = inquireList("Please select the stylus you want to verify.", stylus[1], stylus[2], stylus[3], stylus[4], stylus[5], "cancel") if selectstylus[1] == "cancel" cncBreak() endif if selectstylus[1] == "1-10" for m = 1 to MAX_STYLI Styli[m] = 1 selectstylus[m] = stylus[m] next m l = MAX_SELECT endif for s = 1 to MAX_STYLI if selectstylus[1] == stylus[s] stylus[s] = "" Styli[s] = 1 endif next s m = 2 for j = 1 to 10 if cncBreak == 1 j = 10 else selectstylus[m] = inquireList("Please select the stylus you want to verify.", stylus[1], stylus[2], stylus[3], stylus[4], stylus[5], "ready", "cancel") if selectstylus[m] == "cancel" cncBreak() cncBreak = 1 j = 10 endif if selectstylus[m] == "" message("Please select a stylus, select 'ready' or select 'cancel'") j = j - 1 m = m - 1 endif if selectstylus[m] == "ready" selectstylus[m] = "-" j = 10 endif for s = 1 to MAX_STYLI if selectstylus[m] == stylus[s] Styli[s] = 1 stylus[s] = "" endif next s m = m + 1 endif next j // Run Complete Mode case runMode == "Run Complete" for m = 1 to MAX_STYLI Styli[m] = 1 selectstylus[m] = stylus[m] next m l = MAX_SELECT // Complete Mode case runMode == "Complete" for m = 1 to MAX_STYLI Styli[m] = 1 selectstylus[m] = stylus[m] next m l = MAX_SELECT endSelect endif // Disable unassigned tips if tip1num <> 1 Styli[1] = 0 endif if tip2num <> 2 Styli[2] = 0 endif if tip3num <> 3 Styli[3] = 0 endif if tip4num <> 4 Styli[4] = 0 endif if tip5num <> 5 Styli[5] = 0 endif If the tipnum does not equal 1, then the Styli[n] is set to 0. The condition on the characteristic is looking for that status of Styli[n] to equal 1; it will only run that characteristic if it equals 1. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in