;===========================================================; ; ; ; PLwid.LSP by Michael Bulatovich, Aug. 17, 2006 ; ; www.michaelbulatovich.com ; ; ; ; Changes the width of multiple polylines to a ; ; specified width. Prompts when ordinary lines are ; ; selected for permission to convert them to ploylines ; ; and then apply the specified width to them. ; ; ; ;===========================================================; (defun c:plwid ( / ss counter item ent ss2 ss3 plcounter choice linecounter nextpl nextline wid) ;(setvar "cmdecho" 0) (command "undo" "be") (prompt "Select polyline to change their width:") (setq ss (ssget)) (setq counter (1-(sslength ss))) (while (>= counter 0) (setq item (ssname ss counter)) (setq ent (entget item)) (if (=(cdr(assoc 0 ent)) "LINE") (progn (if (not ss2)(setq ss2 (ssadd item)) (ssadd item ss2) );end if );end progn (progn (if (=(cdr(assoc 0 ent)) "LWPOLYLINE") (progn (if (not ss3)(setq ss3 (ssadd item)) (ssadd item ss3) );end if );end progn );end if );end progn );end if (setq counter (1- counter)) );end while (setq plcounter (1-(sslength ss3))) (IF (= plcounter (or nil 0)) (progn (prompt "No polylines selected.") (quit) );end progn (progn (if ss2 (progn (initget 15 "Yes No") (if (=(sslength ss2)1) (progn (setq choice(getkword (strcat (itoa(sslength ss2)) " ordinary line was selected.\nDo you want to convert it to a polyline\nand apply the specified width? :"))))) (initget 15 "Yes No") (if (>(sslength ss2)1) (progn (setq choice(getkword (strcat (itoa(sslength ss2)) " ordinary lines were selected.\nDo you want to convert them to a polylines\nand apply the specified width? :")))) );end if (if (= choice "Yes") (progn (setq wid (getreal "Specify width for all polylines:")) (setq linecounter (1-(sslength ss2))) (while (> linecounter (1- 0)) (setq nextline (ssname ss2 linecounter)) (command "pedit" nextline "y" "w" wid "") (setq linecounter(1- linecounter)) );end while );end progn );end if );end progn );end if );end progn );end if (while (> plcounter (1- 0)) (if (not wid) (setq wid (getreal "Specify width for all polylines:")) );end if (setq nextpl (ssname ss3 plcounter)) (command "pedit" nextpl "w" wid "") (setq plcounter(1- plcounter)) );end while ;end if (command "undo" "end") );end defun