Help with FILEOPEN Command in AutoLISP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone!
I'm working on an AutoLISP script to process multiple DWG files in AutoCAD. My goal is to open each file, perform certain operations with the SVAM-Todos command, and then return to the original file. I'm using the FILEOPEN command to activate each file, but I'm facing an issue: after executing FILEOPEN, I can't get back to the original drawing.
Here's my current code:
(defun c:SVAM-APP ()
(setq FILEPATH (getvar "dwgprefix"))
(setq FILES (vl-directory-files FILEPATH "*.dwg" 1))
(setq acadObject (vlax-get-acad-object))
(setq currentDoc (vla-get-ActiveDocument acadObject))
(foreach FILE FILES
(progn
(setq FILE_I_FILEPATH (strcat FILEPATH FILE))
(if (not (equal (strcase FILE) "SVAM.dwg"))
(progn
(command "FILEOPEN" FILE_I_FILEPATH)
(c:SVAM-Todos)
(vla-put-ActiveDocument acadObject currentDoc)
)
)
)
)
)
After running this code, I can't get back to the original file. Does anyone have any suggestions on how I can fix this or an alternative to the FILEOPEN command?
I appreciate any help or suggestions you can provide!
Thanks in advance.