Working with SPC Module

Sepasoft MES Module Suite

Working with SPC and File Monitor

If you want to enter in a sample in the SPC module when you parse a file use the following code for the onAfterParse event on the File Monitor Controller.

Code Example

Python
results = event.getParseResults()
if results.isValid():
locationX = results.getValue("LocationX")
locationY = results.getValue("LocationY")
diameter = results.getValue("Diameter")
location = "[global]\My Enterprise\Site 1\Packaging\Line 1\Line 1 Quality"
sampleDef = "Measurement"
sample = system.quality.sample.data.getCreateSampleByName('',sampleDef, location)
sample.setSampleData(1, "LocationX", str(locationX))
sample.setSampleData(1, "LocationY", str(locationY))
sample.setSampleData(1, "Diameter", str(diameter))
sample.setApproved(1)
system.quality.sample.data.updateSample(location, sample, 1)

If you want to display the results on a window take a look at the Sample Entry > Auto Collect window in the quality demo project. The onAfterParse script is slightly different:

Code Example

Python
results = event.getParseResults()
if results.isValid():
location = "[global]\My Enterprise\Site 1\Packaging\Line 1\Line 1 Quality"
sampleDef = "Measurement"
sample = system.quality.sample.data.getCreateSampleByName('', sampleDef, location)
event.source.parent.getComponent("Sample Entry").sample = sample
valueMap = results.createValueMap()
event.source.parent.getComponent("Sample Entry").populateMeasurements(valueMap)



Sepasoft MES Module Suite