Originally Posted by
Wanderer
The owner will view either the pdf or a printout of the pdf. All of the drawings I am asked for are in color, so I'd like to keep it that way for the remaining users (vps, department heads, etc).
BlackBox, appreciate the offer, but, I work for a financial services company, my owner has never used anything remotely like cad.
I had to demand a full version when I got here, as the other users in my department are all on LT. But, you know, a diva like me, I'm not going without my automation.
No worries; that just simplifies the entire matter.
Here's an old LISP that essentially stores the current (temporary) layer state, restores a pre-existing 'plot' state, QSAVE's the drawing (which with AUTOMATICPUB == 1 here, also produces a PDF via named page setup; assumes same CTB, etc.), and then automagically restores the temporary layer state to continue working... Simply change the 'plot' and 'temp' global variable strings at the top, and ensure the former exists within the active document (added to your template?):
Code:
(vl-load-com)
;;;--------------------------------------------------------------------;
;;; Define layer state names:
(setq *cqs_plotLayerStateName* "Colorblind") ; Colorblind friendly
(setq *cqs_tempLayerStateName* "Temporary") ; Temporary
;;;--------------------------------------------------------------------;
;;; Check At Drawing Open:
(if (layerstate-has *cqs_tempLayerStateName*) ; If snapshot exists,
(layerstate-delete *cqs_tempLayerStateName*) ; Then, delete it
)
;;;--------------------------------------------------------------------;
;;; Main function:
(defun c:CQS () (c:ColorblindQuickSave))
(defun c:ColorblindQuickSave (/ *error* cmdecho)
(defun *error* (msg)
(and *cqs_tempLayerStateName*
(layerstate-restore *cqs_tempLayerStateName*)
(layerstate-delete *cqs_tempLayerStateName*)
(not
(vla-regen (vla-get-activedocument (vlax-get-acad-object))
acAllViewports
)
)
)
(and cmdecho (setvar 'cmdecho cmdecho))
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it
)
(princ)
)
(if (= 1 (getvar 'dwgtitled))
(if
(or
(layerstate-has *cqs_plotLayerStateName*) ; If plot state exists,
(layerstate-import ; Or plot state is imported
(strcat "YourFilePath\\" *cqs_plotLayerStateName* ".las")
)
)
(progn
(setq cmdecho (getvar 'cmdecho))
(setvar 'cmdecho 0)
(layerstate-save *cqs_tempLayerStateName* 255 nil)
(layerstate-restore *cqs_plotLayerStateName*)
(if (= 0 (getvar 'automaticpub))
(prompt "\n** Autopublish not enabled ** ")
)
(command "._qsave")
)
(prompt (strcat "\n** Layer state \""
*cqs_plotLayerStateName*
"\" not found ** "
)
)
)
(prompt "\n** Drawing not titled ** ")
)
(*error* nil)
)
;;;--------------------------------------------------------------------;
(princ)
Cheers