I want to create a text file on our network storage from a product configurator. Basically I want to output some G-Code for one of our machines based on values selected in the configurator. But when I try to use System.IO I get blocked with a message stating “The following cannot be used in an Expression: System.IO”
Is there a way to do what I want?
(Using Epicor SaaS)
We know it’s possible to create files in SaaS because Epicor creates log files for various processes, electronic payment files, etc. There is probably a company-specific area where you can write to but you’ll need to know the routines that Epicor uses.
Another thought, depending on the size of your G-Code files, you may be able to store the results in the DB and then have a Customization read the blob and then save it on a local machine. You should be able to use System.IO features in customization. I’ve done it on-prem but never tried it on SaaS.
How would I have the customization run after the configurator closes?
I wouldn’t. I’d have a button that would run on Job Tracker or someplace else that has the G-Code stored in a UD field, or an Input, or wherever you can find to stuff it. How big are these files? I actually had a customization that ran a stamping machine though a serial port this way. And don’t forget the power of REST that you have now. You can write a BAQ that can return the data to ANY http client in your building. So you don’t have to use the Epicor client to provide the file.
The files are less than 10 kb. between 1 and 5 kb looks like. I think that would be too long for an input to hold. I am looking at the REST API documentation right now, looks great. How can I write to a UD field from the configurator code?
If it were me, I would write a local program that used the REST interface to download the values of the inputs and then put the code used to generate your G-Code in the local program instead of the Configurator. That way, you have full control of your environment and can save the file, transmit it to the machine, etc. and not have to worry about the restrictions of SaaS.
I have successfully retrieved the job comments for a Job via the REST api, which contains enough information for me to do the calculations. Right now someone would have to manually run my code to generate the G-Code when they go to make the part. I wonder if there is someway to trigger my code when the job is released instead?
Sure. I put my stamping code in Job Tracker and you could as well. I added a tab with all of the fields to be stamped and then added a Stamp button from there (one per serial number). This gave the operator to make any adjustments if necessary.