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

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.
  • 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....

  •  http://docs.autodesk.com/acd/2013/enu/index.html?url=files/GUID-AD65DF88-5218-4655-B877-B4D33B9FB6D1.htm,topicNumber=d30e615733

    By 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.  
  • Thank you guys, worked like a charm!!

    Small details ;)

    Have a great day!!
  • @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 !
  • 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 Concepts
  • 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 !
This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!