Lisp fails when it has to show the file browser
Hi, I'm trying a LISP routine in Bryscad which works perfectly, except when I want to save the results to a file, I get this error:
"Internal error, GetOpenFileName returned Error # 3002"
The lines which seem to be failing is:
(setq filename (getfiled "Create a New Gcode File" ".." "*" 1))
(setq filename (open filename "w"))
Any ideas on how to fix this? It works in ACAD, so not sure what goes on in here.
Have a nice day
"Internal error, GetOpenFileName returned Error # 3002"
The lines which seem to be failing is:
(setq filename (getfiled "Create a New Gcode File" ".." "*" 1))
(setq filename (open filename "w"))
Any ideas on how to fix this? It works in ACAD, so not sure what goes on in here.
Have a nice day
0
Comments
-
The problem seems to be with the filename ".."I'm not sure what this is supposed to do, but you better try " " or "" instead.0
-
I agree with Michael Rock. The ".." will give you problems. Try this:
(setq filename (getfiled "Create a New Gcode File" "" "" 1))
It worked for me....
0 -
http://docs.autodesk.com/acd/2013/enu/index.html?url=files/GUID-AD65DF88-5218-4655-B877-B4D33B9FB6D1.htm,topicNumber=d30e615733By having the two dots in the filename you are attempting to set the default file name to .. which is, for some reason, illegal. Replace ".." with "test" and note what happens when the dialog opens; the file name box will read test.0
-
Thank you guys, worked like a charm!!
Small details
Have a great day!!0 -
@Alfredo
As the other colleagues pointed to "." or ".." are not valid filenames at all (even under Linux/Mac).
Nevertheless, we made our implementation a bit more robust here, ignoring an invalid filename, which then defaults to "" empty name.
Many greetings to all !0 -
I believe "." , and ".." are valid :-), and useful!!
"." is a shortcut reference to the current folder.
".." is a shortcut reference to the parent folder.
This feature is common to both Windows and Linux. If you open a command window in either environment and run the DIR command (ls in Linux) you will see these two listed.
The difference is that BricsCAD uses a slightly different syntax to AutoCAD. I have a bit of a comparison table here
http://www.cadconcepts.co.nz/finding-your-start-in-folder-using-lisp/
This shows that BricsCAD actually provides a lot more options than AutoCAD. :-)
In Alfredo's case he would need to change the getfiled call to
[code](setq filename (getfiled "Create a New Gcode File" "../" "*" 1)) [/code]
or
[code](setq filename (getfiled "Create a New Gcode File" "..\\" "*" 1)) [/code]
The "../" call will open a dialogue in the parent folder of BricsCADs Start-In folder, which if you've launched BricsCAD by double clicking on a drawing in Windows Explorer will be the parent folder of the current drawing.
For these simple calls it would be good if BricsCAD worked in the same manner as AutoCAD. Would hate to see this functionality reduced as it's useful!
Example here https://forum.bricsys.com/discussion/20342
I think findfile might shed some light on why getfiled is throwing an error
In BricsCAD
[code](findfile ".")[/code]
Returns something like
"D:\\Users\\Jason\\Document\\."
Whereas in AutoCAD
[code](findfile ".")[/code]
Returns something like
"D:\\Users\\Jason\\Documents"
Regards,Jason Bourhill
CAD Concepts0 -
Dear Jason,
many thanks for your hints - of course, I know about those "." and ".." shortcuts;
but WinSDK GetOpenFileName/GetSaveFileName() reject such names ...
AutoCAD ignores the filename "." and "..", seems these special filenames must include the / resp. \\ path delimieter in AutoCAD.
But to keep your clever code running, I will review and improve to allow "." and ".." as "./" resp. "../" and so on ...
Many greetings !0
This discussion has been closed.