Open thomthom opened 9 years ago
It would be nice if this feature was documented in the Developer docs.
I'm confused. Are you talking about UI.savepanel
? If so, I don't think you can specify both a default filename and a list of extensions, can you?
Looks like you're right. :( So the question becomes, is default filename more valuable over extension filter drop down?
I think I lean toward dropping the default filename until the API is improved. At least for SketchUp versions that support file filters.
Except that the API issue was supposedly fixed (on the PC,) 10 months before this issue was posted (when SU 2014 M0 was released.)
In reality, the openpanel()
and savepanel()
leverage the same Win32 common dialog, but just change the window caption. All it does is return a pathstring or nil
on cancel.
So the API docs are again wrong, as the UI::savepanel()
filename argument description should mimic that of the UI::openpanel()
(or refer to it.)
stlpath = UI.savepanel(
"Save STL File",
File::dirname(prevstl),
"#{File::basename(prevstl)}|#{File::basename(prevstl)};|STL Files|*.stl;||"
)
That almost works, but it makes the user actually click on the stl file in the folder. (It doesn't appear in the filename textbox until the user does this.)
You could ask the user to use the default filename, or use a inputbox to get it, then use UI.select_directory
to ask where to put it ? (For newer versions of SU)
There appear to not be any STL file extension in the file dialog drop down list.