Jadeous Posted March 19, 2009 Posted March 19, 2009 Good morning, evening, or night. Depending on what part of the world you live in. I need help finding a lisp that will set all of my VPs to Hidden and Lock them too. I'm not sure if this can be done with just one lisp or if two are required. Please let me know and thanks in advance. Quote
Lee Mac Posted March 19, 2009 Posted March 19, 2009 I am assuming you mean, Hidden linetype? and lock the viewport scale? Sorry if I am missing something, half asleep as usual Lee Quote
Jadeous Posted March 19, 2009 Author Posted March 19, 2009 I'm looking to do several VPs at once. Quote
Lee Mac Posted March 19, 2009 Posted March 19, 2009 This is a reactor that will lock all viewports upon saving - you cannot change the linetype of a viewport entity it seems... (defun Make_Reactor () (vl-load-com) (if (not vport:reactor) (setq vport:reactor (vlr-command-reactor nil '((:vlr-commandWillStart . vpPrompt))))) (princ)) (Make_Reactor) (defun vpPrompt (Reac args / ss i vp ent obj) (if (and (= (car args) "QSAVE") (setq ss (ssget "X" '((0 . "VIEWPORT")))) (not (zerop (setq i (sslength ss))))) (progn (setq vp i) (while (not (minusp (setq i (1- i)))) (setq ent (ssname ss i) obj (vlax-ename->vla-object ent)) (if (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-DisplayLocked (list obj 1)))) (princ))) (princ (strcat "\n" (rtos vp) " Viewport(s) Locked.")))) (princ)) REMEMBER: a reactor is to be "loaded" but not "run". - it Runs itself. Quote
Jadeous Posted March 19, 2009 Author Posted March 19, 2009 Very cool. Thanks. The Hidden part is was reffering to is the command that causes the the object in the VP to plot hidden. If you click the VP and then right click it, you have the options to define what the objects in the VP will plot like. It is under the SHADE PLOT menu. Quote
Lee Mac Posted March 19, 2009 Posted March 19, 2009 Will see what I can do - I think I could fit that into the reactor as well Quote
Lee Mac Posted March 19, 2009 Posted March 19, 2009 Ok, I have re-written the whole LISP to make it more efficient - hopfully it still works! (defun make_reactor () (vl-load-com) (if (not vport:reactor) (setq vport:reactor (vlr-command-reactor nil '((:vlr-commandwillstart . vpprompt))))) (princ)) (make_reactor) (defun vpPrompt (Reac args / ss Lck nLck) (if (and (= (car args) "QSAVE") (setq ss (ssget "X" '((0 . "VIEWPORT"))))) (progn (setq Lck 0 nLck 0) (foreach vp (mapcar 'vlax-ename->vla-object (mapcar 'cadr(ssnamex ss))) (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-DisplayLocked (list vp :vlax-true))) (setq nLck (1+ nLck)) (setq Lck (1+ Lck))) (vla-put-shadeplot vp acShadePlotHidden)) (princ (strcat "\n" (itoa nLck) " Vieport(s) locked" (if (/= 0 Lck) (strcat ", " (itoa Lck) " were on locked layer! ") ".")))) (princ "\n<!> No Viewports Found <!>")) (princ)) Also allows for any on Locked Layers. Quote
Jadeous Posted March 19, 2009 Author Posted March 19, 2009 You my friend are a an AutoCad GOD!!! Thank you so so much for bailing me out again. Quote
Lee Mac Posted March 19, 2009 Posted March 19, 2009 You my friend are a an AutoCad GOD!!! Thank you so so much for bailing me out again. Thanks Jadeous, glad it works for you Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.