For customers running multiple CMMs and measuring 100s to 1000s of parts each week.
Step 1: Set Up File Structure and Download CURL
1. Create a new folder called "CMM_Auto_Upload" in an accessible location, like your desktop. (You can name this one something else if desired, but all the instructions and screenshot in this doc will assume "CMM_Auto_Upload")
2. Navigate into this folder and create two new folders called "in" and "out"
3. Visit https://curl.haxx.se/windows/ and download the link (most likely the 64bit version)
4. Find the downloaded zip file and right click on it. Press extract all.
5. Go into the extracted folder and cut the "bin" folder
6. Go back to the "CMM_Auto_Upload" folder and paste "bin" inside. You should now have three folders within "CMM_Auto_Upload"
Step 2: Setup CMM Machines Tab in 1factory
7. Now go into 1Factory, click the "Master Data" tab, and click the "CMM Machines" tile.
8. Click , type in a name for your CMM, and click GO.
9. Select the CMM software type from the dropdown list in the upper right-hand corner.
10. In the "Path In" field on the top middle of the page, paste in your "in" folder location. To do this, go into the empty "in" folder, right click anywhere, and select "properties". Highlight and copy the location i.e. "C:\Users\JohnDoe\Desktop\CMM_Auto_Upload"
11. Paste this into the "Path In" field, and type "in" to the end of it, as this likely wasn't picked up when you copied the path.
12. Repeat the last two steps for the "Path Out", using the "out" folder location.
Step 3: Download Powershell Script
13. Now click the button on the left sidebar. This will download a script called "onefactory.ps1" to your computer. Save this file in the “bin” folder. The script uses the curl.exe utility to upload files to 1Factory server.
Step 4: Start Powershell and Run Script
14. Go into the "bin" folder, right click on the onefactory.ps1 file, and click "run with powershell"
15. If successful, powershell should open and the cursor will be flashing on the top line. If there are already files in your "in" folder, you will see powershell log the script results as it attempts to upload the files.
14. Copy the "Path Out" to your clipboard.
15. Start Windows PowerShell (search PowerShell in the Windows Start menu) and navigate to the "bin" folder. If you don't already know how to do this, follow the following four steps
i. In Powershell, type "cd", press the SPACEBAR, and press Ctrl+V to paste in your path out. Now remove "\out" and add "\bin" to the end of the path (there should be no "\out").
NOTE: If there are spaces in your file path, you will need to add double quotes around the separated words. I.e.
C:\Users\Quality Control Engineer\XYZ... should be
C:\Users\"Quality Control Engineer"\XYZ...
ii. The command line should look something like this:
iii. Press enter, and you should now be in the bin folder
16. Now you can start the script by pasting this red text and pressing enter: powershell -ExecutionPolicy ByPass -File onefactory.ps1
-- The system may ask you if you want to run the script. If this is the case, type "r" to run. You'll know the script is running if the cursor skips down to the next line.
-- Alternatively, to run the pwershell script, type ./onefactory.ps1
Step 5: Start Loading CMM Files
17. You can now upload CMM files automatically into 1Factory as long as you have an existing plan and inspection that matches the header and file name of the CMM file.
18. Configure your CMM to save files into the "in" file, so that they can be uploaded to 1factory as soon as they have been inspected.
You can now see all the files uploaded into 1factory on the "Machines" page, both successful and erroneous uploads. The lines are also color coded. You can click on individual files names to navigate to the inspection the data was uploaded to.
Step 6: [If needed] Stopping the Script
19. If you want to stop the script, which will cease the auto discovery of files in the "In" folder, go back into PowerShell and press Ctrl+C.
Here's how the script works:
-- The script is installed in the bin folder, runs in an infinite loop, and keeps scanning the “Path In” for new files.
-- The path in, e.g. "C:\Users\JohnDoe\Desktop\CMM_Auto_Upload\in", tells the script where to looks for CMM exported files.
-- Once a file is successfully uploaded into 1factory, it is moved to the “out” folder, i.e. "C:\Users\JohnDoe\Desktop\CMM_Auto_Upload\out".
--If there are errors, you will see them in PowerShell and the files will be moved to the "out" folder.
NOTE. The script is unique for each CMM machine. It contains a unique machine ID and a secret token that must match that stored in 1factory. You will need to have this file structure for each individual CMM you plan on auto-uploading files from.
If a file is uploaded that has a matching name and header as another file already in 1factory, it will overwrite the existing file. In other words, if you remeasure a part and have varying data, the latest/ most recently uploaded measurement data will overwrite any existing data for the inspection of that part.
Errors that are preceded by "Exception" and are highlighted in red, are considered "fatal" errors. You must restart the script in the event of a fatal error. Restart the script by typing: powershell -ExecutionPolicy ByPass -File onefactory.ps1
EXCEPTION: Invalid script. Please download latest script for this machine.
EXCEPTION: Internal Server Error. Please contact 1factory admin.
EXCEPTION: More than 10 attempts to upload the same file. Please make sure the file is CLOSED by CMM program and restart the script.
The following errors can occur during mapping of plan, inspection and row number. They are shown in yellow.
- "Unsupported File Extension" - Unexpected file extension (.xlsx, .srt)
- "Invalid Program/File Name" - Trace field "program file" does not match required format
- "Plan Not Found" - Part number in file name does not match any plans in 1Factory
- "Invalid Inspection Type" - Inspection type is not FP, IP, or FINAL (See table above)
- "Job Not Defined" - Job field in file header is empty
- "Sequence Not Defined" - The sequence number in the file's header is empty
- "Multiple Inspections Found" - Multiple inspections with matching job numbers and inspection types were found in 1Factory
- "Inspection Not Found" - A plan matching the file header's job number and file name's inspection type could not be found
- "Inspection is Read Only" - Inspection has already been "approved" in 1Factory and cannot be edited unless brought back to "pendingr
- "CMM file does nor match selected inspection or balloon numbers are missing."
- "Balloon #: " + dim + " - all places must be either defined explicitly by A,B,C etc., or all undefined."
- "Balloon #" + bln + " has more places: (" + place + "), than in the spec: (" + spec_num_places + ")."