Couple of things....
Unless I am overlooking something (
which is entirely possible), there's no need to call
vl-Catch-All-Apply when setting an Object's Property (
in this case a Boolean), given that you've hard-coded an allowable value (
in this case :vlax-True).
I would, however, recommend that one do so (
that is, to use vl-Catch-All-Apply) if passing a parameter to the Object's Property as a value; just not needed here IMO.
Also, one need not release internal Object's; only external/interface Objects.
Code:
(defun c:ShowPlotStyles ( / acDoc)
(vlax-for oLayout
(vla-get-layouts
(setq acDoc
(vla-get-activedocument (vlax-get-acad-object))
)
)
(if (/= "Model" (vla-get-name oLayout))
(vla-put-showplotstyles oLayout :vlax-true)
)
)
(vla-regen acDoc acAllViewports)
(princ)
)
Separately, this could easily be expanded to incorporate a
bit-coded setting, either drawing data (
via XRecord?), or registry data to allow one to programmatically toggle the
ShowPlotStyles Property value at drawing open, and/or while in session if desired
Psuedo system variable:
Code:
0 = All Layouts do not display plot styles
1 = All Layouts display plot styles, except for Model
2 = All Layouts display plot styles, including Model