WPerciful Posted November 13, 2013 Posted November 13, 2013 I was trying to change the shade plot of a view port by lisp but I didn't see any way to do that through the change properties or through the dxf codes. (progn (setq ss1 (ssget "x" '((0 . "VIEWPORT")))) (command "change" ss1 "" "p") ) Quote
Tharwat Posted November 13, 2013 Posted November 13, 2013 I guess with vla functions would do the trick since that I also could not get it working with DXF codes . (defun c:test (/ ss in ) (if (setq ss (ssget "_:L" '((0 . "VIEWPORT")))) (repeat (setq in (sslength ss)) (vla-put-shadeplot (vlax-ename->vla-object (ssname ss (setq in (1- in)))) acShadePlotAsDisplayed ) ) ) (princ) ) (vl-load-com) Quote
Lee Mac Posted November 13, 2013 Posted November 13, 2013 I guess with vla functions would do the trick since that I also could not get it working with DXF codes See the third bullet point in this documentation. Quote
Tharwat Posted November 14, 2013 Posted November 14, 2013 See the third bullet point in this documentation. Yeah , that's what I realized after a few tries of ENTMODing a viewport in this thread and another one a few days a go I believe . Quote
Dacca_J Posted December 13, 2013 Posted December 13, 2013 Tharwat, I have been playing with the command that you wrote up (very handy by the way), to do something very similar which I have been trying to figure out for a while... Have got it working "partially" & came up with a workaround for the other issues I was having, but you may be able to assist with a solution..? I am trying to: 1 - select all viewports on a given layer (ie "VP_Hidden") 2 - change the shade plot of these viewports to Legacy Hidden 3 (which I can add seperatley) - run print command Your command works when I modify it, but I am wondering what the "_:L" & the sslength ss does..? Something to do with finding a length..? I was trying to use this to get around the problem of some viewports reverting back to "as displayed" occasionally... Any help would be appreciated... Thanks... Quote
Tharwat Posted December 13, 2013 Posted December 13, 2013 Your command works when I modify it, but I am wondering what the "_:L" & the sslength ss does..? Something to do with finding a length..? "_:L" to avoid selecting objects on Locked layers . (sslength ss) is the quantity of selection set to be given to Repeat function to run accordingly . Tharwat,I am trying to: 1 - select all viewports on a given layer (ie "VP_Hidden") 2 - change the shade plot of these viewports to Legacy Hidden 3 (which I can add seperatley) - run print command (defun c:Test (/ ss in ) (if (setq ss (ssget "_:L" '((0 . "VIEWPORT")(8 . "VP_Hidden")))) (repeat (setq in (sslength ss)) (vla-put-shadeplot (vlax-ename->vla-object (ssname ss (setq in (1- in)))) acShadePlotHidden ) ) ) (princ) ) (vl-load-com) Quote
Lee Mac Posted December 13, 2013 Posted December 13, 2013 I am wondering what the "_:L" & the sslength ss does..? Here is a complete ssget reference detailing all mode strings & filter list operators: ssget function reference Here is a tutorial on selection set processing: Selection Set Processing I hope this helps! Lee Quote
jberns Posted December 5, 2018 Posted December 5, 2018 I know this is an old thread, but perhaps someone can offer assistance. In the code above, ShadePlot settings are modified for PaperSpace viewports. Is it possible with code to set ShadePlot = 0 (As displayed) in the Model layout? Thanks, Jerry Quote
Roy_043 Posted December 6, 2018 Posted December 6, 2018 (edited) @jberns Try: (defun c:test ( / enm) (setq elst (entget (vlax-vla-object->ename (vla-get-layout (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) ) ) ) (entmod (subst '(76 . 0) ; Gc 76 occurs twice in elst. This will change the 1st occurence. (assoc 76 elst) elst ) ) (princ "\nDone! ") (princ) ) Edited December 6, 2018 by Roy_043 Quote
jberns Posted December 6, 2018 Posted December 6, 2018 @Roy_043, Thanks for the reply and the code. Success! I am curious what was wrong with this code that I was using: ;;; Function to get a collection of all layouts in the drawing (defun LayoutGet (name) (dictsearch (cdr (assoc -1 (dictsearch (namedobjdict) "ACAD_LAYOUT"))) name ) ;_dictsearch ) ;_LayoutGet (defun C:TEST ( / cmps) ;; get Model layout plot info and then store as Current Modelspace Page Setup (cmps) (setq cmps (LayoutGet "Model")) ;; set Shade Plot (76) to 0 = As Displayed, Shade Plot Resolution (77) to 2 = Normal (setq cmps (subst (cons 76 0) (assoc 76 cmps) cmps)) (setq cmps (subst (cons 77 2) (assoc 77 cmps) cmps)) ;; Modify and then update the modelspace layout (entmod cmps) (entupd (cdr (assoc -1 cmps))) ) ;_C:TEST Executing the 'entmod' line returned the list. Executing the entupd line returned nil, which failed to update the entity (page setup). Regards, Jerry Quote
Roy_043 Posted December 6, 2018 Posted December 6, 2018 I think entupd can only be used for graphical entities. Other than that your code works fine here. Quote
jberns Posted December 6, 2018 Posted December 6, 2018 Interesting. Yes, my posted code 'works' (runs), but the settings in the Plot dialog box are not effected. I will test again next week, but that was the trouble I encountered. When I made a new named page setup, the shade plot defaulted to legacy wireframe. When I ran the code, the settings did not change in the PLOT or PAGESETUP dialog box. I was certain the 'entupd' failure was causing the problem. Either way, your code works. Awesome! Thanks again. Kind regards, Jerry Quote
jonathann3891 Posted December 13, 2018 Posted December 13, 2018 (edited) This one will set all viewports shade plot to hidden, it even works with multiple layouts. (defun c:test (/) (vl-load-com) (setq doc (vlax-get-object "AutoCad.Application") adoc (vla-get-ActiveDocument doc) lao (vla-get-Layouts adoc) cnt (vla-get-Count lao) inc 0 ) (repeat cnt (setq cvprt (vla-item lao inc) inc (+ inc 1) blk (vla-get-Block cvprt) ) (vlax-for itm blk (if (vlax-property-available-p itm 'ShadePlot) (progn (vla-put-ShadePlot itm acShadePlotHidden) (vla-update itm) ) ) ) ) (princ) ) Edited December 13, 2018 by jonathann3891 1 Quote
jberns Posted December 13, 2018 Posted December 13, 2018 Thank you, @jonathann3891. My request was to change the shade plot setting in model space (Model tab), but your code could prove useful for others. Thank you for sharing. Much appreciated. Kind regards, Jerry Quote
Paul Li Posted June 13, 2022 Posted June 13, 2022 This page contains exactly the code I'm looking for to adjust Model tab ShadePlot options. Is there a way also to set it to one of the Visual Styles ie: Conceptual, Hidden, Realistic, Shaded, Shaded with Edges, Shades of Grey, SKetchy, X-Ray, Wireframe I tried changing (cons 76 0) to (cons 76 4) but the setting stays the same. Any assistance would be helpful. Thanks. Quote
BIGAL Posted June 14, 2022 Posted June 14, 2022 (edited) You need to look at the code by Johnathon the thing I found is that model does not have a shadeplot but does have a visualstyle. (defun c:test (/) (vl-load-com) (setq adoc (vla-get-ActiveDocument (vlax-get-acad-object)) lao (vla-get-Layouts adoc) cnt (vla-get-Count lao) inc 0 ) (repeat cnt (setq cvprt (vla-item lao inc) inc (+ inc 1) blk (vla-get-Block cvprt) ) (vlax-for itm blk (if (vlax-property-available-p itm 'ShadePlot) (progn (vla-put-ShadePlot itm 6) (vla-put-Visualstyle itm 6) (vla-update itm) ) ) ) ) (princ) ) (c:test) Edited June 14, 2022 by BIGAL Quote
Paul Li Posted June 14, 2022 Posted June 14, 2022 Thanks for your reply. I tried Johnathon's code but that only works for pspace vports and does nothing to Shade Plot options in Model tab. I also don't see a "visualstyle" property when I do a dump of the Model object: Command: (vlax-dump-object (vla-item (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object))) "Model")) ; IAcadLayout: The plot settings and visual properties of a model space or paper space block ; Property values: ; Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff73841d990> ; Block (RO) = #<VLA-OBJECT IAcadModelSpace 0000018d62bb3ef8> ; CanonicalMediaName = "ANSI_A_(8.50_x_11.00_Inches)" ; CenterPlot = 0 ; ConfigName = "None" ; Document (RO) = #<VLA-OBJECT IAcadDocument 0000018d3a06b3a8> ; Handle (RO) = "22" ; HasExtensionDictionary (RO) = -1 ; ModelType (RO) = -1 ; Name = "Model" ; ObjectID (RO) = 42 ; ObjectName (RO) = "AcDbLayout" ; OwnerID (RO) = 43 ; PaperUnits = 0 ; PlotHidden = 0 ; PlotOrigin = (0.0 0.0) ; PlotRotation = 1 ; PlotType = 0 ; PlotViewportBorders = 0 ; PlotViewportsFirst = -1 ; PlotWithLineweights = -1 ; PlotWithPlotStyles = -1 ; ScaleLineweights = 0 ; ShowPlotStyles = 0 ; StandardScale = 0 ; StyleSheet = "" ; TabOrder = 0 ; UseStandardScale = -1 ; ViewToPlot = "" Quote
ronjonp Posted June 14, 2022 Posted June 14, 2022 Any reason you cannot call the shademode command in modelspace? 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.