Jump to content

setRunID(): using PCM.


---
 Share

Recommended Posts

---

I have a para fie that sets a part number (PN) from an external source

Then I have a selectCase for the part numbers for setRunID().

//Pre Settings:
cd=(getActualInspectionDir())
systemCallWithWait(cd+"\"+"parameters_Eaton_R2.exe")
cd=(getActualInspectionDir())
readPCMFile(cd+"\"+"runpart.para")
if PN==0
cncBreak()
endif

//Start MiniPlan selection 04.24.25 RS
selectCase PN
case "00-428363"
    setRunID("00-428363")
case "00-569754"
    setRunID("00-569754")
case "00-571009"
    setRunID("00-571009")
endSelect
//getRunID()

The first line in the para file is: PN = "00-428363" (For this example).

I must have something wrong, as it is not setting the runID and running what the user selects from the para file, it runs everything.

There are mini plans named as the select case shows.

Any assistance is appreciated.

Link to comment
Share on other sites

---

For context, below is my Post Settings.

//Pre Settings:

cd=(getActualInspectionDir())
//systemCallWithWait(cd+"\"+"parameters.exe")
systemCallWithWait(cd+"\"+"parameters_Eaton_R2.exe")
cd=(getActualInspectionDir())
readPCMFile(cd+"\"+"runpart.para")
if PN==0
cncBreak()
endif

//Start MiniPlan selection 04.24.25 RS
selectCase PN
case "00-428363"
    setRunID("00-428363")
case "00-569754"
    setRunID("00-569754")
case "00-571009"
    setRunID("00-571009")
endSelect
message(getRunID())

//paramters exe file cancel, Start. 01.12.24
//Read Canc-Cont.txt value
my_list=readListFile("Canc-Cont.txt")
//Extract value from file
CanCon=val(getParameterNamed(my_list,2))
if CanCon==1
cncBreak()
endif
//paramters exe file cancel, End.

//Stylus Axis Control 01.30.25 R.Stanich
if Datum_B_tip2 == "#2_+Y"
New_Axis1 ="SP -Y"
New_Axis2="SP +Y"
dB_RotationA=dB_Rotation2
dB_RotationB=0.0
Datum_B_tipA=Datum_B_tip4
Datum_B_tipB=Datum_B_tip2
else
New_Axis1 ="SP +X"
New_Axis2="SP -X"
dB_RotationA=dB_Rotation3
dB_RotationB=90
Datum_B_tipA=Datum_B_tip3
Datum_B_tipB=Datum_B_tip5
endif

setRecordHead("u_PartNumb",PN)
//New 12.12.23
inspPath = getActualInspectionDir()+"\"
fileName = "setRunID.txt"
deleteFile(inspPath+fileName)
addToFile(inspPath+fileName, getRunID())
        //End New
setRunID(PN) //New
miniselection=getRunID()

//01.22.24 - Setup Last User information
OpName=getRecordHead("u_OperatorName")
OpWoID=getRecordHead("u_WorkOrderID")
OpPartNumb=getRecordHead("u_PartNumb")
OpSerNumb=getRecordHead("u_SerNumb")
OpFam=getRecordHead("planid") //Program ID
//01.30.25 RS //Opminiselection="NA" //Mini Plan Name
Opminiselection=miniselection //Mini Plan Name
OpLastMachCtr=getRecordHead("u_MachCenter")
inspPath2 = "C:\Users\Public\Documents\Zeiss\CALYPSO\workarea\inspections\Zeiss 1 Block\Eaton Aerospace\PCM Program\"
//end
//fileName = OpName +".txt"
fileName = OpName+".txt"
deleteFile(inspPath2+fileName)
addToFile(inspPath2+fileName, OpName)
addToFile(inspPath2+fileName, OpWoID)
addToFile(inspPath2+fileName, OpPartNumb)
addToFile(inspPath2+fileName, OpSerNumb)
addToFile(inspPath2+fileName, OpFam)
addToFile(inspPath2+fileName, Opminiselection)
addToFile(inspPath2+fileName, OpLastMachCtr)
//end

 

Link to comment
Share on other sites

---

Newbie here, but I really don't see any issues with what you are doing unless there is some bit of code later on that is overwriting the setRunID() portion. 

I think though that you could skip the select case portion of the code though, right? If the PN that the operator is selecting matches the Mini-Plan ID, then why can't you just set it to setRunID(PN)?

  • Like! 1
Link to comment
Share on other sites

---

Correction, this would need to be in the Pre-Settings. The Post-Settings isn't going to run until it is finished (and most likely you have this on the measurement plan level, so it won't run until the very end).

Link to comment
Share on other sites

---
Posted (edited)

Please sign in to view this quote.

You are 100% correct! Thank you for the tip.

This is in the Pre Settings.

Edited
Link to comment
Share on other sites

---

If what you need is geared towards a mini-plan. Then maybe you could tailor this to suit your needs?

Or part of this could be useful?

 

LN = getRecordHead("order")

clearCAD()
dir = getActualInspectionDir()

Run=inquireList("Which mini-plan do you wish to run?","Operation-10","Operation-20")
setRunID(Run)

if Run=="Operation-10","Operation-20" then setRunID(Run)

endif

Operation_Number = inquireList("Which operation are you inspecting?","Op-10","Op-20")
selectCase Operation_Number
    case "Op-10"
        readPCMFile(dir + "\123456 Op-10.PARA")
loadCADFile(dir+"\123456 - Turn-Blank.sab")

    case "Op-20"
        readPCMFile(dir + "\234567 Op-20.PARA")
loadCADFile(dir+"\234567 - Infeed-Grind.sab")

endSelect

Link to comment
Share on other sites

---

We have something similar but written in VB.net, this interface handles about 200+ PCM/Para programs.

(Not sure who created the original interface, I wrote this one to keep up with Windows updates).

 

PCM CMM Programs.png

Link to comment
Share on other sites

---
Posted (edited)

Well color me embarrassed.

It works just fine when you have the Mini Plan box Checked with any selection.

Adapted code.

//Pre Settings:
cd=(getActualInspectionDir())
//systemCallWithWait(cd+"\"+"parameters.exe")
systemCallWithWait(cd+"\"+"parameters_Eaton_R2.exe")
cd=(getActualInspectionDir())
readPCMFile(cd+"\"+"runpart.para")
//Set MiniPlan selection 04.24.25 RS
setRunID(PN)
fileName = "setRunID.txt"
//message(getRunID()) //For testing
//cncBreak() //For testing
if PN==0
cncBreak()
endif

Screenshot 2025-04-24 104747.png

Edited
  • Thank you! 1
Link to comment
Share on other sites

Please sign in to view this quote.

so ....  you have to type completelly the part number?  😬,  better ask chatGPT for an autocomplete combobox with wildcard:

image.png.b3af78db2dcf4f06ef16b27321654fee.png

 

 

Link to comment
Share on other sites

---

Please sign in to view this quote.

The user can type or use the dropdown list that is auto populated by an excel file.

Link to comment
Share on other sites

---

you could probably update your program pre-assignment to choose a mini-plan so the error no longer occurs, and further add PCM to check if startSettings are set to "All characteristics" or "current selection" to force it to default mini-plan until the selection screen is shown, etc..

 

Good luck !!

Link to comment
Share on other sites

Please sign in to view this quote.

 

wildcards is much better believe me, anyway maybe not your problem here but you could have other problems latter so better change readPCMFile()   to:

runPCMFile(cd+"\"+"runpart.para")

 

Edited
Link to comment
Share on other sites

 Share

×
×
  • Create New...