See the top rated post in this thread. Click here

Results 1 to 5 of 5

Thread: Polyline width within blocks

  1. #1
    Member
    Join Date
    2011-06
    Posts
    11
    Login to Give a bone
    0

    Default Polyline width within blocks

    Hello,

    I hope you can help me with this.

    For example if I have in a single drawing large number of polylines with different width, large number of blocks with polylines (with different width), and I want for all of polylines width to be set to 0, how can I do that. For those polylines that are not in block is easy, but for those polylines in block .... I got a problem.

    On some other forum I found this code that works fine for block, but one at the time ...

    How can we tweak this code to work for number of blocks?
    code:
    PHP Code:
    (defun c:pib (/ s)
     (
    vl-load-com)
     (
    princ "\n Select the block with a polyline")
     (if (and (
    setq s (ssget "_+.:S" '((0 . "insert"))))
              (setq s (cdr (assoc 2 (entget (ssname s 0)))))
         ) ;_  and
      (progn
       (vlax-for
                o
                (vla-item (vla-get-blocks
                           (vla-get-ActiveDocument (vlax-get-acad-object))
                          ) ;_  vla-get-blocks
                          s
                ) ;_  vla-item
        ;;(setq o (vla-item (vla-item (vla-get-blocks (vla-get-ActiveDocument(vlax-get-acad-object))) s)0))
        (if (= (vla-get-objectname o) "AcDbPolyline")
         (vl-catch-all-apply '
    vla-put-ConstantWidth (list o 0.))
        ) ;
    _  if
       ) ;
    _  vlax-for
       (foreach 
    (mapcar (function cadr)
                          (
    ssnamex (ssget "_x" (list (cons 2 s))))
                  ) ;
    _  mapcar
        
    (vla-update (vlax-ename->vla-object x))
       ) ;
    _  foreach
      ) ;
    _  progn
     
    ) ;_  if
     (
    princ)


  2. #2
    I could stop if I wanted to
    Join Date
    2009-03
    Location
    London, England
    Posts
    304
    Login to Give a bone
    1

    Default Re: Polyline width within blocks

    A quick one to set all LWPolyline Width to zero in all blocks and layouts:

    Code:
    (defun c:polywidthzero ( / doc )
        (vlax-for block (vla-get-blocks (setq doc (vla-get-activedocument (vlax-get-acad-object))))
            (if (eq :vlax-false (vla-get-isxref block))
                (vlax-for obj block
                    (if (eq "AcDbPolyline" (vla-get-objectname obj))
                        (vl-catch-all-apply 'vla-put-constantwidth (list obj 0.0))
                    )
                )
            )
        )
        (vla-regen doc acallviewports)
        (princ)
    )
    (vl-load-com) (princ)

  3. #3
    Member
    Join Date
    2011-06
    Posts
    11
    Login to Give a bone
    0

    Default Re: Polyline width within blocks

    Exactly what I was thinking of.

    Thank you Lee Mac.


  4. #4
    I could stop if I wanted to
    Join Date
    2009-03
    Location
    London, England
    Posts
    304
    Login to Give a bone
    0

    Default Re: Polyline width within blocks

    Good stuff, you're welcome

  5. #5
    Woo! Hoo! my 1st post
    Join Date
    2017-06
    Posts
    1
    Login to Give a bone
    0

    Thumbs up Re: Polyline width within blocks

    Quote Originally Posted by Lee Mac View Post
    Good stuff, you're welcome
    Your script is almost 6 years old and it is still needed. I just used this one and works perfect. Thank you!

Similar Threads

  1. Annotative Polyline Width
    By Wish List System in forum AutoCAD Wish List
    Replies: 3
    Last Post: 2013-12-09, 05:26 PM
  2. Polyline multi-width
    By bball in forum AutoCAD General
    Replies: 12
    Last Post: 2008-09-17, 08:08 PM
  3. Polyline width issue
    By maq10 in forum AutoCAD General
    Replies: 1
    Last Post: 2007-09-20, 11:01 AM
  4. Polyline Width
    By robert.1.hall72202 in forum AutoLISP
    Replies: 8
    Last Post: 2004-09-28, 07:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •