Hey Les,
Is there a way to have the post pop up requesting the user to input a variable when the post is run. Like when I run the post, I want a popup to ask for the job name. We are having a problem with programmers not saving the job file and thus the job name doesn’t get into the nc code. If I specifically ask for it, maybe it will increase the chance it will make it in there.
Thanks,
You can do that. Outside of any function add this:
post.DefineCustomOption("Job name","jobName",sc.unitTEXT)
You will now have a variable ‘jobName’ that holds whatever text has been entered.
To show the options add this to function OnInit()
post.ShowCustomOptions("Check job name")
Another option would be to add this to function OnInit()
sc.wxActionManager.Get():Execute(sc.actSAVEAS_JOB)
That will do the equivalent of selecting File->save job as when you run the post processor. You could also use actSAVE_JOB instead of actSAVEAS_JOB. That would just save the job without asking for a file name.
Hey Les, This has been working but I am getting complaints from some of our people that this added an unnecessary step. I can fix it, but i need some way for the post to get the sheetcam job name. Is there a variable for that? I see variables for partName, g code fileName and such, but i am not seeing one for the sheetcam job file name or file path.
One option would be:
sc.Parts:Get():AskSave("Save job")
This will only pop up a save dialog box if the job has changed since the last save/load.
If you want the job file name:
local path = sc.Parts:Get():GetFileName()
This is the full path to the file.
If you want to extract the file name without path or extension:
local fileName = wx.wxFileName(path):GetName()
If you want to extract the file name without path but with extension:
local fileName = wx.wxFileName(path):GetFullName()
Thanks Les! The full file path works fine. However, these two throws an error:
local fileName = wx.wxFileName(path):GetName()
local fileName = wx.wxFileName(path):GetFullName()
Did you call sc.Parts:Get():GetFileName() first? For example:
local path = sc.Parts:Get():GetFileName()
local fileName = wx.wxFileName(path):GetName()
Yep, here’s the section of the post. Its inside the function OnInit()
rapidX = 0
rapidY = 0
postFileName = fileNameOnly
scamJobPath = sc.Parts:Get():GetFileName()
scamJobName = wx.wxFileName(path):GetFullName()
initialized = 0
Try
scamJobPath = sc.Parts:Get():GetFileName()
scamJobName = wx.wxFileName(scamJobPath ):GetFullName()
Oh i see whats happing now… sorry, i’m such a rookie. That works perfect.
Thanks for all the help Les! Best customer service of anything i have ever purchased.