Toggle "Display plot styles"

Discussion in 'AutoCAD' started by TRJ, Oct 30, 2004.

  1. TRJ

    TRJ Guest

    Several months ago I requested of this group a routine to automate turning
    on and off the diplay of plot styles in a layout.

    The following code is what resulted. Can anyone suggest how to combine the
    two functions so that a single function would "toggle" the display? I know
    to write a "toggle" in straight AutoLISP but don't know to do it in this
    code.


    ;;; Turns on "Display plot styles" for the current layout
    (defun C:DPS ()
    (vla-put-showplotstyles
    (vla-get-activelayout
    (vla-get-activedocument
    (vlax-get-acad-object)
    )
    )
    :vlax-true
    )
    (command "regenall")
    )
    ;;; Turns off "Display plot styles" for the current layout
    (defun C:DDPS ()
    (vla-put-showplotstyles
    (vla-get-activelayout
    (vla-get-activedocument
    (vlax-get-acad-object)
    )
    )
    :vlax-false
    )
    (command "regenall")
     
    TRJ, Oct 30, 2004
    #1
  2. TRJ

    Joe Burke Guest

    Maybe like this? Though I must admit, I'm not familiar with what's going on here.

    (defun c:ToggleDPS ( / layout)
    (setq layout (vla-get-activelayout
    (vla-get-activedocument (vlax-get-acad-object))))
    (if (eq :vlax-true (vla-get-showplotstyles layout))
    (vla-put-showplotstyles layout :vlax-false)
    (vla-put-showplotstyles layout :vlax-true)
    )
    ;(vla-get-showplotstyles layout) ;test status
    )

    Joe Burke
     
    Joe Burke, Oct 30, 2004
    #2
  3. TRJ

    TRJ Guest

    Works like a charm. Thanks.

     
    TRJ, Oct 30, 2004
    #3
  4. TRJ

    Joe Burke Guest

    You're welcome.

    Joe
     
    Joe Burke, Oct 31, 2004
    #4
  5. TRJ

    ShoeTim Guest

    This is great code does anyone have any idea how you might attach it to a new toggle button to place in the tray right next to the lineweight toggle. I am surprised this isn't a built in feature.

    Tim
     
    ShoeTim, Nov 20, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.