Jump to content

Recommended Posts

Posted

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...

Posted

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))

Posted

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...

Posted

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))

Posted

That is great, done in a blink.

Thanks so much!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...