See the top rated post in this thread. Click here

Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Lisp to "Display plot styles" on open

  1. #11
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Lisp to "Display plot styles" on open

    BlockBox - could it be done as a toggle? (I'm thinking single icon on the tool palette to toggle back and forth). Thanks as always!

    Quote Originally Posted by BlackBox View Post
    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

  2. #12
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Lisp to "Display plot styles" on open

    Quote Originally Posted by jpcadconsulting347236 View Post
    BlockBox - could it be done as a toggle? (I'm thinking single icon on the tool palette to toggle back and forth). Thanks as always!
    Try this:
    Code:
    (defun c:ShowPlotStyles (/ acDoc ctab)
      (vl-load-com)
      (setq acDoc (vla-get-activedocument (vlax-get-acad-object))
            ctab (vla-Item (vla-get-layouts acDoc)(getvar "ctab"))
      )
      (vlax-for oLayout (vla-get-layouts acDoc)
    	(if (= (vla-get-ShowPlotStyles ctab) :vlax-true)
    	  (vla-put-showplotstyles oLayout :vlax-false)
    	  (vla-put-showplotstyles oLayout :vlax-true)
    	)
      )
      (vla-regen acDoc acAllViewports)
     (princ)
    )

  3. #13
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Lisp to "Display plot styles" on open

    Works like a charm! Thanks.

    BTW - reactors are making my head hurt...

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 8
    Last Post: 2012-08-18, 01:31 AM
  2. Plot Styles Change "Normal" globaly in layer dialog
    By elowe494 in forum VBA/COM Interop
    Replies: 14
    Last Post: 2012-01-11, 02:18 AM
  3. Replies: 5
    Last Post: 2009-04-17, 10:10 AM
  4. "SketchUp" like display styles
    By revit.wishlist1942 in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2008-07-04, 11:38 AM
  5. Replies: 8
    Last Post: 2007-04-04, 12:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •