yrnomad Posted January 15, 2010 Posted January 15, 2010 Anyone have a routine that has the ability to globally redefine the width of plines within blocks? Like a colorbylayer lisp I already use. I was given a background file the the walls and columns are made up of plines that have widths. So there is a separate block defined for each column, wall section, window... Quote
Lee Mac Posted January 15, 2010 Posted January 15, 2010 This will change it within the Block Definition in the drawing: (defun c:test (/ *error* PolyChng str wid uFlag) (vl-load-com) ;; Lee Mac ~ 15.01.10 (defun *error* (msg) (and uFlag (vla-EndUndoMark doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (defun PolyChng (blk wid) (vlax-for obj (vla-item (vla-get-Blocks doc) blk) (if (eq "AcDbPolyline" (vla-get-Objectname obj)) (vla-put-ConstantWidth obj wid)))) (setq doc (cond (doc) ((vla-get-ActiveDocument (vlax-get-acad-object))))) (while (progn (setq str (getstring t "\nSpecify Block Name: ")) (cond ( (not (snvalid str)) (princ "\n** Invalid Block Name **")) ( (tblsearch "BLOCK" str) (initget 4) (setq wid (cond ((getdist "\nSpecify New Width <0.0> : ")) (0.0))) (setq uFlag (not (vla-StartUndoMark doc))) (PolyChng str wid) (setq uFlag (vla-EndUndoMark doc))) ( (princ "\n** Block Not Found **"))))) (vla-regen doc acActiveViewport) (princ)) Quote
yrnomad Posted January 15, 2010 Author Posted January 15, 2010 Anyway to get that to be global? If I start with the column blocks that would be 53 different defined blocks to do. Maybe I should just explode all blocks in the drawing... Quote
Lee Mac Posted January 15, 2010 Posted January 15, 2010 Sure, try this: (defun c:test (/ *error* wid uFlag) (vl-load-com) ;; Lee Mac ~ 15.01.10 (defun *error* (msg) (and uFlag (vla-EndUndoMark doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq doc (cond (doc) ((vla-get-ActiveDocument (vlax-get-acad-object))))) (initget 4) (setq wid (cond ((getdist "\nSpecify New Width <0.0> : ")) (0.0))) (setq uFlag (not (vla-StartUndoMark doc))) (vlax-for blk (vla-get-Blocks doc) (vlax-for obj blk (if (eq "AcDbPolyline" (vla-get-Objectname obj)) (vla-put-ConstantWidth obj wid)))) (setq uFlag (vla-EndUndoMark doc)) (vla-regen doc acActiveViewport) (princ)) Quote
yrnomad Posted January 15, 2010 Author Posted January 15, 2010 That is great, done in a blink. Thanks so much! Quote
Lee Mac Posted January 15, 2010 Posted January 15, 2010 That is great, done in a blink.Thanks so much! You're welcome Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.