Polyline width to previous setting via LISP or macro

Discussion in 'AutoCAD' started by CadMAtt, Feb 11, 2005.

  1. CadMAtt

    CadMAtt Guest

    I would like to run a shortcut that sets the polyline width to 15 units and when I’m done drawing it would like the polyline width to return to the previous width (most likely zero).

    The basic LISP is as follows:
    (DEFUN C:QE ()
    (COMMAND "-LAYER" "S" "QUESTIONS" "" "PLINE" PAUSE "W" "15" "" PAUSE))

    This sets the width, but I don’t know how to get it back to what it was previously!

    A macro to run in a button would also work if that would be easier.

    Thanks,
    Matt
     
    CadMAtt, Feb 11, 2005
    #1
  2. (setvar "plinewid" 0)

    Or, if it might not always be zero you're setting it back to, start with

    (setq plwidth (getvar "plinewid"))

    before your (command) call, and afterward reset it with

    (setvar "plinewid" plwidth)
     
    Kent Cooper, AIA, Feb 11, 2005
    #2
  3. CadMAtt

    CadMAtt Guest

    I can't get that to work. I have tried a few things like using plinewid to set the width so I can test my usage and it does set the width but it does not set it back to zero (even when I used that line).

    (DEFUN C:QE ()
    (setq plwidth (getvar "plinewid"))(setvar "plinewid" 15)(COMMAND "-LAYER" "S" "QUESTIONS" "" "PLINE" PAUSE PAUSE)) (setvar "plinewid" 0)

    What have I done wrong?
     
    CadMAtt, Feb 15, 2005
    #3
  4. You have an extra right parenthesis. And assuming you mean the entire
    Polyline to be at the 15 width, you need to complete the Pline command
    before you set the width back. It looks to me like you're setting the width
    back to zero while Pline is still awaiting another point. But if what
    you're after is a first segment at 15 and subsequent ones at zero, that
    could be appropriate.

    (setq plwidth (getvar "plinewid"))
    (setvar "plinewid" 15)
    (COMMAND "-LAYER" "S" "QUESTIONS" "" "PLINE" PAUSE PAUSE);; <<< had an extra
    right parenthesis here
    (setvar "plinewid" 0)
     
    Kent Cooper, AIA, Feb 16, 2005
    #4
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.