pline width change routine not working on 2d polylines

Discussion in 'AutoCAD' started by Tom Hanley, Feb 2, 2005.

  1. Tom Hanley

    Tom Hanley Guest

    How can this be modified to change pline widths for "2d polylines" as well
    as "lwpolylines"?

    (defun c:pLW () ;Enter PL width at command prompt
    (setq plw (getreal "Enter PL Width: ")
    ss1 (ssget "X" '((0 . "LWPOLYLINE")))
    ctr (sslength ss1)
    N (SSLENGTH ss1)
    index 0
    )
    (REPEAT N
    (SETQ B1 (ENTGET (SSNAME ss1 INDEX)))
    (SETQ INDEX (1+ INDEX))
    (SETQ B (ASSOC 0 B1))
    (IF (= "LWPOLYLINE" (CDR B))
    (PROGN
    (entmod (subst (CONS 43 plw) (ASSOC 43 B1) B1))
    (PRINC "\nDone.")
    (PRINC)
    )
    )
    )
    )
     
    Tom Hanley, Feb 2, 2005
    #1
  2. Tom Hanley

    Jeff Mishler Guest

    Here ya go......

    (defun c:pLW () ;Enter PL width at command prompt
    (setq plw (getreal "Enter PL Width: ")
    ss1 (ssget "X" '((0 . "LWPOLYLINE,POLYLINE")))
    ctr (sslength ss1)
    N (SSLENGTH ss1)
    index 0
    )
    (REPEAT N
    (SETQ B1 (ENTGET (SSNAME ss1 INDEX)))
    (SETQ B (ASSOC 0 B1))
    (IF (= "LWPOLYLINE" (CDR B))
    (PROGN
    (entmod (subst (CONS 43 plw) (ASSOC 43 B1) B1))
    )
    (progn
    (while
    (eq
    "VERTEX"
    (cdr
    (assoc 0 (setq B1 (entget (entnext (cdr (assoc -1 B1))))))
    )
    )
    (entmod (setq B1 (subst (CONS 40 plw) (ASSOC 40 B1) B1)))
    (entmod (setq B1 (subst (CONS 41 plw) (ASSOC 41 B1) B1)))
    )
    )
    )
    (entupd (SSNAME ss1 INDEX))
    (SETQ INDEX (1+ INDEX))
    )
    (PRINC "\nDone.")
    (PRINC)
    )
     
    Jeff Mishler, Feb 2, 2005
    #2
  3. Tom Hanley

    Tom Hanley Guest

    Thanks, that did the trick...

     
    Tom Hanley, Feb 2, 2005
    #3
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.