LISP function works in BricsCad - Not AutoCad
Comments
-
Does the folder exist? Do you have rights to create a file in that folder?
To help with debugging add a 'print' here:
[code](print (setq fileout (open filelast "a")))[/code]
I suspect that fileout is nil.0 -
Dear Doug,
at least I can confirm, that there is a strange bug in AutoCAD, I noticed in Acad 2008 ... 2016 :
sometimes, for simply unknown reason, AutoCAD/AutoLISP fails to open files ...
I encountered this with my Lisp Benchmarks, benching (open) function ...
AutoLISP is rather old, and Autodesk loves to replace OS functions with their own (try installing AutoCAD from DVD - always failed for me, until copied to HDD);
good chances, that there are such old own functions still alive in AutoLISP.
potential candidates :
- filename too long
- path too long
- to many files are / were opened
I never found a solution to bypass that strange bug :-(
many greetings !0 -
Roy,
You are correct.
From BricsCAd
!Fileout = #
From AutoCAD
!Fileout = nil
Torsten,
"AutoLISP is rather old", yes it is and so am I. Don't know if I am up to learning VLisp. This Lisp function is just a modified version of one that I used from R13 through 2004. It used to work fine as it is. Since coming back to this business, I have had AutoCAD LT, and BricsCad. The boss is not up to buying new full versions of AutoCAD, so I test LISP functions in BricsCad, then find out if they work or not in AutoCAD when other people here who have Acad full versions try them out.
Thanks for the replies,
Doug
Does the folder exist? Do you have rights to create a file in that folder?
To help with debugging add a 'print' here:(print (setq fileout (open filelast "a")))
I suspect that fileout is nil.0 -
I think that one thing was modified as HTML code or something. I will put quotes around the BricsCad response to see if it looks closer to normal. At any rate. Fileout is a thing in BricsCad and Nil in AutoCAD.
!fileout: "#"
0 -
Here is a graphic that explains it better
BricsAutoCad.png0 -
Dear Doug,
yes, the question is - why it that file handle NIL in AutoCAD ? :-)
In worst case it is that bug as I noticed ... but that happened after opening + closing a file hundreds of times ...
in normal usage (few open + close) there should be no problem, of course.
So I can only guess :
- search pathes ? is the filename given with full specification ?
- run AutoCAD with admin rights ("run as admin" in desktop icon)
I hope you can identify what causes AutoCAD/AutoLISP to fail here ...
many greetings !0 -
Torsten,
One guy was sick today so I logged onto his computer, to check things out. I am a local administrator on the CAD computers only. The LISP file worked with AutoCAD Electrical 12, when I was logged on as me (the administrator). Not sure yet but it may be a "Windows Permission" thing.
Doug
0 -
Doug, that was my first hunch as well (see post #2).0
-
Dear Doug,
yes, very likely this indicates a permisson problem (as Roy pointed to as well) ...
so it seems, the Lisp code needs to be reviewed, especially where the Lisp code wants to open the file ...
Usually, thanks MS, the standard program folders are usually not enabled for writing, for standard user rights ...
Installing applications to non-default folder then allows this :-)
So far for MS' security strategy - installing into other than suggested folder "breaks" the security :-)
Or, in other words, allows you to work properly :-)
Especially, if no path is specified with LISP's (open) statement, then the actual "OS current folder" will be used - than can widely vary;
normally, it is specified in desktop shortcut ...
many greetings !0 -
Roy and Torsten,
Thank you both for your responses. They were both helpful in figuring out AutoCad here On the BricsCad site.
Thanks,
Doug
0