@EBDBC3D ,
I'm glad you got it working, but I'm worried that you're just kicking the can down the line.
This note from ChatGPT makes me think you overwrote your 'close' function somewhere else (not in this lisp file, but ANY other one you're running)...
;; Skip the problematic close function - let AutoLISP handle cleanup
;; In Civil 3D 2025, the close function appears to have a different signature
;; The file will be closed automatically when the variable goes out of scope
(setq file-handle nil)
You should try to find the error instead of avoiding it. The code I wrote will be MUCH better than AI's when you start using it regularly.
Try this simple code and tell us if the successful text file pops up. If it is successful, then it's not your 'close' function like I suspect, but probably another function that was overwritten. Be sure to always declare proper local variables and not to overwrite default function symbols.
(defun c:TEST ( / fPath f)
(setq fPath (vl-filename-mktemp "XX.txt"))
(setq f (open fPath "w"))
(write-line "Success" f)
(close f)
(startapp "notepad" fPath)
(princ)
)
Just my thoughts on it.. but what would I know..
~DD