[Do...] Posted 5 hours ago Share Posted 5 hours ago Hi all, I am encountering an anomaly with one of our programs. We use PCM to define the output file locations on our server as well as some scripting within the inspection_start_pcm file for converting the "dmesn" value to our internal machine number. This method seems to work on every program, however, we have one now that is proving to be stubborn. When running the program offline I get an error message "Parameter: cmm is not defined" and the value of 'cmm' has been assigned "9999". The offline seat should be set to "000000" by default and is the case with the other programs I have tested. I have copied the PCM output script exactly from the other program and the inspection_start_pcm script is automatically read from the C:\ drive so that file hasn't changed. What could I be missing here? Is there some obscure Calypso setting that I overlooked? Link to comment Share on other sites More sharing options...
[Ri...] Posted 5 hours ago Share Posted 5 hours ago Have you defined the parameter cmm in Plan - Advanced - Parameter? Link to comment Share on other sites More sharing options...
[Do...] Posted 4 hours ago Author Share Posted 4 hours ago We do not have the "cmm" variable set as a parameter within Calypso, but rather it's coded within the inspection_start_pcm.txt file that is executed once a program begins. Code looks like this: cmm=getRecordHead("dmesn") if cmm=="810021" then cmm="BPQ449" endif if cmm=="810475" then cmm="BPQ472" endif if cmm=="810481" then cmm="BPQ473" endif if cmm=="810480" then cmm="BPQ474" endif Link to comment Share on other sites More sharing options...
[He...] Posted 4 hours ago Share Posted 4 hours ago (edited) A little unsure about the syntax but selectCase will help you. The correct syntax might be case is "810021" for each case-row the thing is the caseElse that will handle everything else and never give cmm undefined. selectCase getRecordHead("dmesn") case "810021" cmm="BPQ449" case "810475" cmm="BPQ472" case "810480" cmm="BPQ474" caseElse cmm="000000" endSelect Edited 4 hours ago Link to comment Share on other sites More sharing options...
[DW...] Posted 4 hours ago Share Posted 4 hours ago Please sign in to view this username. In your troublesome program, what does this output? cmm=getRecordHead("dmesn") message(cmm) Link to comment Share on other sites More sharing options...
[Do...] Posted 4 hours ago Author Share Posted 4 hours ago Thank Henrik. I seem to get the same error message stating the cmm is not defined even with that updated script. Link to comment Share on other sites More sharing options...
[Do...] Posted 4 hours ago Author Share Posted 4 hours ago Please sign in to view this quote. It shows 000000 Link to comment Share on other sites More sharing options...
[DW...] Posted 4 hours ago Share Posted 4 hours ago Please sign in to view this username. Something is missing here. Where in your inspection_start_PCM file does it address the offline seat (000000)? The PCM you showed us only addresses online seats. Link to comment Share on other sites More sharing options...
[DW...] Posted 4 hours ago Share Posted 4 hours ago Please sign in to view this username. Open the suspect measurement program folder, and look for a local copy of the inspection_start_pcm file. This could be overriding the global file, so no matter what you do to the global file it will never work. Also, Please sign in to view this username. 's snippet is the one to use. It is cleaner, it scales, and will always return something (000000), avoiding an error. Link to comment Share on other sites More sharing options...
[Do...] Posted 3 hours ago Author Share Posted 3 hours ago It appears that Calypso defaults the cmm number to either 9999 or 000000 if it does not find a match case in the script. I did not see a local copy of the script in the program folder, however, the program is responding to changes I make to the global pcm script (ex. message(cmm)). I just can't figure out why the process seems to work on one program and not another given everything appears to be set the same way. Here is the file path in question as well; "\\NOS\Data\Gear_Lab_Zeiss_Output\"+cmm+"\"+getRecordHead("planid")+"\"+getRecordHead("order")+" "+getRecordHead("date")+"\"+"Part_"+getRecordHead("partnbinc")+"_Time_"+getRecordHead("time")+".txt" Link to comment Share on other sites More sharing options...
[Ri...] Posted 3 hours ago Share Posted 3 hours ago I've had issues using raw network paths - instead I prefer to use mapped network paths instead. Link to comment Share on other sites More sharing options...
[Do...] Posted 3 hours ago Author Share Posted 3 hours ago I've tried to use the mapped address, but Calypso didn't seem to like that. Maybe I'll give it some more testing. More food for thought. We are usually outputting the default report, measuring points and a PiWeb report. All with the same file path and naming convention. I decided to remove measuring points from the list and while I still receive a PCM error, it no longer shows the pcm script as the culprit. The program also generates the piweb report which it previously didn't do. Something strange is afoot. Link to comment Share on other sites More sharing options...
[DW...] Posted 3 hours ago Share Posted 3 hours ago (edited) Please sign in to view this quote. Please sign in to view this username. Is this filepath set in your global file, or in the local program? It looks like something in this program is triggering an output before "cmm" is defined. This gives you the error. Please sign in to view this quote. Yup, that confirms it. In your global text file, move your case logic to the very top. This sets the variable from the very beginning, before anything begins to output. Put this at the top before anything happens. cmm=“000000” selectCase getRecordHead("dmesn") case "810021" cmm="BPQ449" case "810475" cmm="BPQ472" case "810480" cmm="BPQ474" caseElse cmm="000000" endSelect Edited 3 hours ago Changed logic Link to comment Share on other sites More sharing options...
[Ri...] Posted 2 hours ago Share Posted 2 hours ago cmmAct=getRecordHead("dmesn") cmm="" selectCase cmmAct case "810021" cmm="BPQ449" case "810475" cmm="BPQ472" case "810480" cmm="BPQ474" caseElse cmm="000000" endSelect Link to comment Share on other sites More sharing options...
[Do...] Posted 2 hours ago Author Share Posted 2 hours ago The filepath was set for both global and local. I've removed the pathing for the local settings and Calypso seemed to work correctly, no PCM error and the PiWeb report populated afterwards. The issue I have now is, Calypso straight up ignored the global file path location and reverted to the default settings in (Extras>Settings>Environment>Paths). Link to comment Share on other sites More sharing options...
[DW...] Posted 2 hours ago Share Posted 2 hours ago Please sign in to view this username. Is it possible for you to paste your inspection_PCM file contents here (remove any sensitive information)? Link to comment Share on other sites More sharing options...
[Do...] Posted 2 hours ago Author Share Posted 2 hours ago Here is the original script. I also re-ran this script and it gives me the same result after removing the local path. Program runs, no errors, but files are not saved where they should be. read=readListFile(getActualInspectionDir()+"\startfile").asArray.asString Speed=mid((strElement(40,"'",read)),7,10) SpeedStr="Run Speed; "+Speed+" mm/s" StartTime=getRecordHead("time") StartTimeStr="Measurement Start Time; "+StartTime addToFile(("\\nos\data\Gear_Lab_Zeiss_Output\Run_Trackers\bpq473RunTracker.txt"),("Measurement Plan Name; "+getRecordHead("planid"))) addToFile(("\\nos\data\Gear_Lab_Zeiss_Output\Run_Trackers\bpq473RunTracker.txt"),("Operation Number; "+getRecordHead("u_OpNum"))) addToFile(("\\nos\data\Gear_Lab_Zeiss_Output\Run_Trackers\bpq473RunTracker.txt"),("Start Date; "+getRecordHead("date"))) addToFile(("\\nos\data\Gear_Lab_Zeiss_Output\Run_Trackers\bpq473RunTracker.txt"),SpeedStr) addToFile(("\\nos\data\Gear_Lab_Zeiss_Output\Run_Trackers\bpq473RunTracker.txt"),StartTimeStr) cmm=getRecordHead("dmesn") if cmm=="810021" then cmm="BPQ449" endif if cmm=="810475" then cmm="BPQ472" endif if cmm=="810481" then cmm="BPQ473" endif if cmm=="810480" then cmm="BPQ474" endif Link to comment Share on other sites More sharing options...
[DW...] Posted 2 hours ago Share Posted 2 hours ago (edited) Please sign in to view this username. Try this to fix your filepath to accept the CMM variable correctly (you currently show bpq473RunTracker.txt) cmm="000000" cmm=getRecordHead("dmesn") selectCase cmm case "810021" cmm="BPQ449" case "810475" cmm="BPQ472" case "810480" cmm="BPQ474" caseElse cmm="000000" endSelect read=readListFile(getActualInspectionDir()+"\startfile").asArray.asString Speed=mid((strElement(40,"'",read)),7,10) SpeedStr="Run Speed; "+Speed+" mm/s" StartTime=getRecordHead("time") StartTimeStr="Measurement Start Time; "+StartTime filePath="\\\\nos\\data\\Gear_Lab_Zeiss_Output\\Run_Trackers\\" + cmm + "\\RunTracker.txt" addToFile(filePath,("Measurement Plan Name; "+getRecordHead("planid"))) addToFile(filePath,("Operation Number; "+getRecordHead("u_OpNum"))) addToFile(filePath,("Start Date; "+getRecordHead("date"))) addToFile(filePath,SpeedStr) addToFile(filePath,StartTimeStr) This assumes these folders already exist - \\nos\data\Gear_Lab_Zeiss_Output\Run_Trackers\BPQ449\ \\nos\data\Gear_Lab_Zeiss_Output\Run_Trackers\BPQ472\ \\nos\data\Gear_Lab_Zeiss_Output\Run_Trackers\BPQ474\ \\nos\data\Gear_Lab_Zeiss_Output\Run_Trackers\000000\ This version establishes all your variables before writing anything to a file, and should correctly pass the variable "cmm" into the file path. Edited 2 hours ago Link to comment Share on other sites More sharing options...
[Do...] Posted 2 hours ago Author Share Posted 2 hours ago I didn't see a change when trying that refactored version of the script. I feel that there may be something else I'm missing so I decided to look at other files within the program directory. I am currently reviewing the "startfile". Comparing two working programs vs my single non-working one. The working programs each have additional user defined fields at the end of the list. (u_NewVariable6 and u_NewVar BPQ449) Strangely everything else seems to match up with the exception of one of the working copies being TRUE for pdfExport and FALSE for protocolHead. I basically have different settings for all three programs, but I think the user defined fields may be a tell. I do not see these within the programs themselves though. I seem to recall an INI file is needed for that sort of thing. 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