LISP To Change QNEW, make new DWG, then change QNEW back to previous
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm creating a lisp that allows users to start multiple drawings from different templates with a button. Ultimately, I want to change the new variable temporarily and back.
The below LISP works to change the qnew and start a new drawing (SET1), where I run into issues is then I try to set the qnew back to the original setting (SET2).
If I remove set 2, the qnew changes and a new drawing from the rick-la-sht.dwt opens, but the qnew stays set to rick-la-sht.dwt. If I have set2 in the LISP a new dwg from _rec-ncs-with-styles-2018.dwt is created, so its like set 2 is overwriting set1. I want the qnew to be set back to _rec-ncs-with-styles-2018.dwt once the command is finished.
Anyone see what I'm doing wrong?
; DNew.lsp to Open New drawing with set default Template
(defun c:set1 (/ keystuff1)
; keystuff function to send command using vlisp to the command line
(defun keystuff1 (cmd-arg) (vl-load-com)(vla-Sendcommand(vla-Get-ActiveDocument(vlax-Get-Acad-Object))cmd-arg))
; set default dwg template for QNew command
(setenv "QnewTemplate" "c:\\rick\\projects\\rickstandards\\autodesk\\c3d_rick_ncs_2018\\templates\\landscape\\rick-la-sht.dwt")
; send QNew to command line
(keystuff1"_.QNEW\n")
(princ "This is set1")
)
(defun c:set2()
(setenv "QnewTemplate" "c:\\rick\\projects\\rickstandards\\autodesk\\c3d_rick_ncs_2018\\templates\\_rec-ncs-with-styles-2018.dwt")
(princ "This is set2")
)
(defun c:newlscapesht-new ()
(c:set1)
(C:set2)
)