Postprocessor Popup input box
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Postprocessor Popup input box
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,
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,
- Les Newell
- Site Admin
- Posts: 3661
- Joined: Thu May 11, 2006 8:12 pm
Re: Postprocessor Popup input box
You can do that. Outside of any function add this:
You will now have a variable 'jobName' that holds whatever text has been entered.
To show the options add this to function OnInit()
Another option would be to add this to function OnInit()
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.
Code: Select all
post.DefineCustomOption("Job name","jobName",sc.unitTEXT)
To show the options add this to function OnInit()
Code: Select all
post.ShowCustomOptions("Check job name")
Code: Select all
sc.wxActionManager.Get():Execute(sc.actSAVEAS_JOB)
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Postprocessor Popup input box
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.
- Les Newell
- Site Admin
- Posts: 3661
- Joined: Thu May 11, 2006 8:12 pm
Re: Postprocessor Popup input box
One option would be:
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:
This is the full path to the file.
If you want to extract the file name without path or extension:
If you want to extract the file name without path but with extension:
Code: Select all
sc.Parts:Get():AskSave("Save job")
If you want the job file name:
Code: Select all
local path = sc.Parts:Get():GetFileName()
If you want to extract the file name without path or extension:
Code: Select all
local fileName = wx.wxFileName(path):GetName()
Code: Select all
local fileName = wx.wxFileName(path):GetFullName()
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Postprocessor Popup input box
Thanks Les! The full file path works fine. However, these two throws an error:
Code: Select all
local fileName = wx.wxFileName(path):GetName()
local fileName = wx.wxFileName(path):GetFullName()
- Les Newell
- Site Admin
- Posts: 3661
- Joined: Thu May 11, 2006 8:12 pm
Re: Postprocessor Popup input box
Did you call sc.Parts:Get():GetFileName() first? For example:
Code: Select all
local path = sc.Parts:Get():GetFileName()
local fileName = wx.wxFileName(path):GetName()
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Postprocessor Popup input box
Yep, here's the section of the post. Its inside the function OnInit()
Code: Select all
rapidX = 0
rapidY = 0
postFileName = fileNameOnly
scamJobPath = sc.Parts:Get():GetFileName()
scamJobName = wx.wxFileName(path):GetFullName()
initialized = 0
- Les Newell
- Site Admin
- Posts: 3661
- Joined: Thu May 11, 2006 8:12 pm
Re: Postprocessor Popup input box
Try
Code: Select all
scamJobPath = sc.Parts:Get():GetFileName()
scamJobName = wx.wxFileName(scamJobPath ):GetFullName()
-
- Posts: 452
- Joined: Wed Sep 12, 2018 8:18 pm
- Location: South Carolina, USA
- Contact:
Re: Postprocessor Popup input box
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.
Thanks for all the help Les! Best customer service of anything i have ever purchased.