Save drawing to new name in Visual Lisp reactor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Been attempting this for weeks now, learned a lot from the internet. Getting the impression this can only be done one way. I don't like the visual outcome. Hoping someone might know a better way, or at least how to suppress visual appearance on the command history.
As being in the reactor, cannot use "COMMAND" or "VL-CMDF" to do "SAVE".
Visual Lisp programmers messed up. They created "VLA-SAVEAS" & "VLA-SAVE". "VLA-SAVE" is actually "QSAVE" and there is no function for "SAVE" in Visual Lisp, that I have found.
Yes. I need to do a "SAVE" as I do not want to "QSAVE" the current drawing. I may not wish to save the changes when I close the drawing.
So, in my search I found one post on the forums where it was suggested to use "VLA-SENDCOMMAND". This function would be fine except by the nature of the function, everything sent is displayed on the command history. And as the SAVE command issues the browse dialog, it is required to turn off the sysvar "filedia" before sending the command "SAVE". In addition, the "VLA-SENDCOMMAND" is asynchronous and therefore does not always execute as laid out in the LISP code. I have found that this works (but sometimes the vla-sendcommand function fails) so I would rather find another way.
(vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "(setvar \"filedia\" 0) ")
(vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) (strcat "_.save " "\"" STR:FOLDER STR:SFNAME "\"" "\r"))
(vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "(setvar \"filedia\" 1) ")
But everything else I have tried, does not work.
Something I have tried is:
(setvar "filedia" 0)
(vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) (strcat "_.save " "\"" STR:FOLDER STR:SFNAME "\"" "\r"))
(setvar "filedia" 1)Result is "fildia" being set out of order.
I found a suggestion to use a reactor for control of the "filedia".
(vlr-lisp-reactor (cons FD (getvar "filedia")) '((:vlr-lispended . SG-RESTORE-FD)))However, it did not fire as expected.
Windows 10 Pro, x64, Nvidia Quadro P1000
Intel Core i9-11900k; 3.50GHz, 32 GB RAM, 500GB WD BLACK M.2