Offset LISP

Discussion in 'AutoCAD' started by ~Jeff~, Jan 8, 2004.

  1. ~Jeff~

    ~Jeff~ Guest

    I would like this lisp (at end of this post) to offset a line to current
    layer (just what it does) but also offset the lines to BYLAYER for linetype
    and color

    Example I have a line that is named P-PIPE. The line color has been forced
    to yellow and forced to center2. Using this lisp, I would like to offset a
    line to my current layer, but the linetype and color of the offset line will
    change to BYLAYER if required.

    ....any help please?

    Thanks in advance,

    ~Jeff~
    [AutoCAD 2004]
    ----------------------------------


    ;LOffset -- Improved offset command (offsets to current layer)

    (defun C:LOffset ()
    (setq Ent1 (entlast))
    (command ".OFFSET")
    (while (< 0 (getvar "CMDACTIVE"))
    (command pause)
    (if (not (equal ent1 (entlast))) (progn
    (setq ent1 (entlast))
    (setq list1 (entget ent1))
    (setq list1 (subst
    (cons 8 (getvar "CLAYER")) (assoc 8 list1) list1))
    (entmod list1)
    )))
    (princ)
    )

    (if C:LOffset
    (command "UNDEFINE" "OFFSET"))
    (princ)
     
    ~Jeff~, Jan 8, 2004
    #1
  2. ~Jeff~

    Paul Turvill Guest

    (defun C:LOffset ()
    (setq Ent1 (entlast))
    (command ".OFFSET")
    (while (< 0 (getvar "CMDACTIVE"))
    (command pause)
    (if (not (equal ent1 (entlast))) (progn
    (setq ent1 (entlast))
    (setq list1 (entget ent1))
    (setq list1 (subst(cons 8 (getvar "CLAYER")) (assoc 8 list1) list1)
    list1 (subst '(6 . "BYLAYER")(assoc 6 list1) list1)
    list1 (append list1 '((62 . 256)))
    );;setq
    (entmod list1)
    )))
    (princ)
    )
    ___
     
    Paul Turvill, Jan 8, 2004
    #2
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.