Jump to content

PCM; If characteristic reports out of tolerance then add results to a file


---
 Share

Recommended Posts

I need some help. I want to keep a running log of features that report out of tolerance for selected programs. The goal is to add a line to a text file every time a characteristic reports out of tolerance. I have had success using addtofile inside of an individual characteristic to accomplish this. For example, placing the PCM in the post settings of the characteristic. The problem is copying this code to every single characteristic is too labor intensive.

I know I can do this using an end.bat file or in the postsettings of the program, but I can't figure out the syntax that I need.

Can anyone help me?
Link to comment
Share on other sites

Ok long story short.....
I use TXT text reports to dump data directly into WinSPC software system we use.
The problem is that if a part checks out of tol the program still generates a report, and the operators need to go in and manually mask all the data the points for the bad scan piece, which could be up to 14 dims per part.
This caused problems.
So after i had a couple hundred programs setup with text code, i had to figure out an east way so the code would delete itself if any of the dims checked bad.
I found "inspectionToleranceState()" worked for this, but its for the entire program but individual dims.
inspectionToleranceState() either says "InTolerance" or "OutOfTolerance"
Then i use function "len()" to count the letters, so In tolerance has a value of 11 and out of tolerance has a value of 14.
len(inspectionToleranceState())
I really don't have a use for in tolerance, the code i wrote basically says if inspectionToleranceState() = 14, then, wait 1 second and Delete the code you just created before WinSPC can grab it.

In your case....... You only want a report to generate if the part is bad, so in your case you would want the statement to read if inspectionToleranceState() = 14, then create TXT report.

Try copying this into your postsettings and of course edit the "#1 Distance" and such to fit your program.
Additionally we use Operator Input for Lot ID at the start of our programs, so since you probably don't use that you'll have to change that to something that will suit your program.
The way it sits it should generate a file folder with the name of your program, and dump the report inside.
That way you can copy paste this into multiple programs and not have to edit the file saving info, it'll always generate a new folder (if not already available) in the name of the program.

I know you wanted just the 1 offending dim to report, and that might be possible, but this code is for whole program results.

//Dims to notepad
filePath = "C:\Temp\"+getRecordHead ("planid")+"\"
ext = ".txt"

Len=len(inspectionToleranceState())

if Len == 14 then
Program = getRecordHead ("planid")
LotNo = getRecordHead ("lotid")
dirPath = filePath + Program + (" ") + LotNo + (" ") + ext

//#1
DIM1 = getActual("#1 Distance").actual
//#2
DIM2 = getActual("#2 Perpendicularity").actual
//#3
DIM3 = getActual("#3 Profile").actual
//#4
DIM4 = getActual("#4 Diameter").actual

addToFile(dirPath,(" "))
addToFile(dirPath,LotNo)
addToFile(dirPath,Program)
addToFile(dirPath,date()+ (" ") +time())
addToFile(dirPath,(" "))
addToFile(dirPath,("Dim 1 Distance : "),DIM1)
addToFile(dirPath,("Dim 2 Perpendicularity : "),DIM2)
addToFile(dirPath,("Dim 3 Distance : "),DIM3)
addToFile(dirPath,("Dim 4 Perpendicularity : "),DIM4)
message("SOMETHING IS OUT OF TOL"+cr()+"TEXT REPORT HAS BEEN CREATED AND YOU ALL WILL PROBABLY BE FIRED")
endif
Link to comment
Share on other sites

 Share

×
×
  • Create New...