Lee Mac Posted October 4, 2010 Share Posted October 4, 2010 Oh yeah, thanks - shame there isn't a way to retrieve the LWPolyline object through VL Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 5, 2010 Share Posted October 5, 2010 Oh yeah, thanks - shame there isn't a way to retrieve the LWPolyline object through VL True, but I'm just glad to have a seemingly easy way to actually access the data/object(s). Quote Link to comment Share on other sites More sharing options...
No1BroncoFan Posted November 2, 2011 Share Posted November 2, 2011 (edited) This a a great script as is, but can someone tell me how to get it to set the "Shade Plot" to "Hidden" along with the other changes it makes? Thanks, Ben Edit: Nevermind. I figured it out that adding (vla-put-ShadePlot vport 2) after (vla-put-VisualStyle vport 1) does exactly what I need. Ben Edited November 2, 2011 by No1BroncoFan Quote Link to comment Share on other sites More sharing options...
baker Posted November 3, 2011 Share Posted November 3, 2011 I am sorry, I did not read all 3 pages. this is the lisp i have been using to lock all the VP's in the drawing. (defun C:LockAllVp (/ ss otab) (setq otab (getvar "ctab")) (foreach item (layoutlist) (setvar "ctab" item) (setq ss (ssget "x" '((0 . "VIEWPORT")))) (command ".-vports" "Lock" "On" ss "") );foreach (setvar "ctab" otab) (princ) );defun i hope this can help someone out. Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 3, 2011 Share Posted November 3, 2011 I am sorry, I did not read all 3 pages. this is the lisp i have been using to lock all the VP's in the drawing. (defun C:LockAllVp (/ ss otab) (setq otab (getvar "ctab")) (foreach item (layoutlist) (setvar "ctab" item) (setq ss (ssget "x" '((0 . "VIEWPORT")))) (command ".-vports" "Lock" "On" ss "") );foreach (setvar "ctab" otab) (princ) );defun i hope this can help someone out. Baker, this may be of interest; it will be a lot faster since it doesn't have to cycle through each layout. It give the option to lock or unlock all viewports. (defun c:LV (/ ss) ;; Lock/Unlock all viewports ;; Alan J. Thompson, 09.10.09 (if (setq ss (ssget "_X" '((0 . "VIEWPORT")))) ((lambda (lock) (vlax-for x (setq ss (vla-get-activeselectionset (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object) ) ) ) ) ) ) (vla-put-displaylocked x lock) ) (vla-delete ss) (and (zerop (getvar 'tilemode)) (vla-put-mspace *AcadDoc* :vlax-false)) (princ (strcat "\nAll Viewports have been " (if (eq lock :vlax-true) "Locked!" "Unlocked!" ) ) ) ) (if (eq "Yes" (progn (initget 0 "Yes No") (cond ((getkword "\nLock Viewports? [Yes/No] <Yes>: ")) ("Yes") ) ) ) :vlax-true :vlax-false ) ) (alert "\nNo viewports in drawing.") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 3, 2011 Share Posted November 3, 2011 A few more that I posted at AUGI a while back... [color=GREEN];; Lock Selected Viewport[/color] ([color=BLUE]defun[/color] c:vpl [color=BLUE]nil[/color] ([color=BLUE]if[/color] (SSVPLock ([color=BLUE]ssget[/color] [color=MAROON]"_+.:E:S:L"[/color] '((0 . [color=MAROON]"VIEWPORT"[/color]))) [color=BLUE]:vlax-true[/color]) ([color=BLUE]princ[/color] [color=MAROON]"\n--> Viewport Locked."[/color]) ) ([color=BLUE]princ[/color]) ) [color=GREEN];; Unlock Selected Viewport[/color] ([color=BLUE]defun[/color] c:vpu [color=BLUE]nil[/color] ([color=BLUE]if[/color] (SSVPLock ([color=BLUE]ssget[/color] [color=MAROON]"_+.:E:S:L"[/color] '((0 . [color=MAROON]"VIEWPORT"[/color]))) [color=BLUE]:vlax-false[/color]) ([color=BLUE]princ[/color] [color=MAROON]"\n--> Viewport Unlocked."[/color]) ) ([color=BLUE]princ[/color]) ) [color=GREEN];; Lock All Viewports[/color] ([color=BLUE]defun[/color] c:vpla [color=BLUE]nil[/color] (SSVPLock ([color=BLUE]ssget[/color] [color=MAROON]"_X"[/color] '((0 . [color=MAROON]"VIEWPORT"[/color]))) [color=BLUE]:vlax-true[/color]) ([color=BLUE]princ[/color] [color=MAROON]"\n--> All Viewports Locked."[/color]) ([color=BLUE]princ[/color]) ) [color=GREEN];; Unlock All Viewports[/color] ([color=BLUE]defun[/color] c:vpua [color=BLUE]nil[/color] (SSVPLock ([color=BLUE]ssget[/color] [color=MAROON]"_X"[/color] '((0 . [color=MAROON]"VIEWPORT"[/color]))) [color=BLUE]:vlax-false[/color]) ([color=BLUE]princ[/color] [color=MAROON]"\n--> All Viewports UnLocked."[/color]) ([color=BLUE]princ[/color]) ) ([color=BLUE]defun[/color] SSVPLock ( ss lock [color=BLUE]/[/color] i ) ([color=BLUE]if[/color] ss ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i ([color=BLUE]sslength[/color] ss)) ([color=BLUE]vla-put-displaylocked[/color] ([color=BLUE]vlax-ename->vla-object[/color] ([color=BLUE]ssname[/color] ss ([color=BLUE]setq[/color] i ([color=BLUE]1-[/color] i)))) lock) [color=BLUE]t[/color] ) ) ) ([color=blue]vl-load-com[/color]) Quote Link to comment Share on other sites More sharing options...
N_461 Posted November 16, 2011 Share Posted November 16, 2011 (edited) I am sorry, I did not read all 3 pages. this is the lisp i have been using to lock all the VP's in the drawing. (defun C:LockAllVp (/ ss otab) (setq otab (getvar "ctab")) (foreach item (layoutlist) (setvar "ctab" item) (setq ss (ssget "x" '((0 . "VIEWPORT")))) (command ".-vports" "Lock" "On" ss "") );foreach (setvar "ctab" otab) (princ) );defun i hope this can help someone out. oK, SO THIS WORKS FOR ME (THANKS FOR POSTING) **sorry, allcaps*** Ok, I've been fighting to get this lisp to load auto via my acaddoc.lsp but its not working.... i basically have the following in my acaddoc.lsp (simplified): (load "[i]lisphere.lsp[/i]") (command "[i]commandhere.lsp[/i]") (setvar "[i]variablehere.lsp[/i]") Its pretty basic since my brain is pretty basic. I also tried autoload, verified the lisp is in the cad2010 directory, even tried throwing it into my local setting.....directory. nothing. My other lsp will work, just not this one. Any suggestions? (autoload "vplock" '("lv" "vplock")) ASIDE: I was also wondering is it possible for a file to autoload all lisps in a specific folder (local or network) without typing 100+ lines in the lsp?? I found some older posts but i wanted to avoid ressurrecting a 2year old post:shock:.... ***EDIT*** Lee, I was able to get yours to work... Edited November 16, 2011 by N_461 partial solution Quote Link to comment Share on other sites More sharing options...
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.