[Mi...] Posted July 20, 2022 Share Posted July 20, 2022 Hello Community, i am new to PCM but i know C# and Visual Basic as a programming languages. We got some part families so i wanted to create something like a user interface were you can select between different partnames. I planned to save the .Para files in a directory within the Actuall Inspections Directory. filespath = getActualInspectionDir() + "\files\" -> this will give me the correct Path Now i want to loop through every File in this Directory and store the names in a list. Later the worker can pick one of the names in the user interface and it will load the picked .para file for the CNC Run. In C# i would use foreach. foreach(var item in myDictionery) { Filename = Filename + " " + item.name; } Is this possible within PCM ? Thanks, Michael Link to comment Share on other sites More sharing options...
[SH...] Posted July 20, 2022 Share Posted July 20, 2022 - Link to comment Share on other sites More sharing options...
[Ph...] Posted July 20, 2022 Share Posted July 20, 2022 One of many possibilities..... filepath = getActualInspectionDir()+"\files" dirContent = getParameterNamed(filepath.asFilename).directoryContents for i = 1 to dirContent.size display(getParameterNamed(dirContent,i)) next i Link to comment Share on other sites More sharing options...
[Fl...] Posted July 21, 2022 Share Posted July 21, 2022 Thank you Michael for asking this question and thank you Phillip for sharing this possibility. I find this AMAZING!!! I probably can't and won't describe how we used to work around for this problem. And this solution is so much better! I adapted it a little bit for my use and i think this is also what Michael asked for. filepath = getActualInspectionDir() + "\files" dirContent = getParameterNamed(filepath.asFilename).directoryContents ListPara = "inquireList(" + qm() + "Type auswählen" + qm() for i = 1 to dirContent.size display(getParameterNamed(dirContent,i)) N[i] = getParameterNamed(dirContent,i) ListPara = ListPara + ",N[" + i + "]" next i ListPara = ListPara + ")" ItemName = getParameterNamed(ListPara) readPCMFile(ItemName) Link to comment Share on other sites More sharing options...
[Gu...] Posted December 13, 2022 Share Posted December 13, 2022 An other idea with the selectFileDialog? // selectFileDialog([path (or path symbol such as directoryPath)[,Filter[,Dialogtext[,Return mode]]]] //For more option, please check the PCM manual (seach for "selectFileDialog") PATH="C:\temp\" FILTER="*.para" DIALOG="Please select file" MODE=0 SELECTION=selectFileDialog(PATH,FILTER,DIALOG,MODE) Link to comment Share on other sites More sharing options...
[Cl...] Posted December 22, 2022 Share Posted December 22, 2022 Wouldn't this be the simpler way to do it? Presetting's clearCAD() dir = getActualInspectionDir() Part_Number = inquireList("Which part number are you inspecting?","13-12345","13-23456","13-34567") selectCase Part_Number case "13-12345" readPCMFile(dir + "\13-12345.PARA") loadCADFile(dir+"\13-12345.sab") case "13-23456" readPCMFile(dir + "\13-23456.PARA") loadCADFile(dir+"\13-23456.sab") case "13-34567" readPCMFile(dir + "\13-34567.PARA") loadCADFile(dir+"\13-34567.sab") endSelect .PARA file with variables is in the program folder. Link to comment Share on other sites More sharing options...
[Gu...] Posted January 11, 2023 Share Posted January 11, 2023 An example without "if" or "select case" For more variants, just expand T1, T2,T3... //-------------------------------------------------------- clearParameter() //Clear all Parameter clearCAD() // Deletes the loaded CAD model MeinLogFile = "C:\temp\PCM\log.txt" // My Log File aSep = " | " //A separator for my log file PathInspection = getActualInspectionDir() //Here is the measurement plan FileExtension = ".para" // File extension Path = PathInspection +"\PCM\" // There is a subfolder PCM in the measurement plan. Here are my PCM files //------A selection list of variants--------- T0 ="Please select " T1 = "small ring" T2 = "middle ring" T3 = "big ring" Variante = inquireList(T0,T1,T2,T3) //Query and remember the variant PCMFileName = Path + Variante + FileExtension // Build complete path structure together display(PCMFileName) //Show complete path structure addToFile(MeinLogFile,"This variant was selected: ",PCMFileName,aSep, dateAndTime()) //Write path structure and date to log file if fileExists(PCMFileName) message("File is there: " ,cr(),PCMFileName ,cr()," ==> CNC process is started") readPCMFile(PCMFileName) //read in the parameter file CADFile = Path+"CAD" + Variante + ".sab" if fileExists(CADFile) == true loadCADFile(CADFile) endif else // There is no parameter file !!!! message("There is no parameter file !!!! " ,cr(),cr(), PCMFileName) // output message cncBreak() // Switch traffic light to red endif // Write information in the report header // setRecordHead("drawingno",ZeichNr) //Write the drawing number // aktiviere die Datenbankvariantensteuerung ab CALYPSO 2022 // activate the database variant control from CALYPSO 2022 // Prepare / Results to File / PiWeb reporting / Configuration /Separate Database for each variant setRecordHead("variant", Variante) // Write the variant 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