Jump to content

Recommended Posts

Posted

i need modify a lisp that i found : http://forums.augi.com/showthread.php?133428-Polyline-width-within-blocks

 

to change polylines width to 0 in nested blocks

 

(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 x (mapcar (function cadr)

(ssnamex (ssget "_x" (list (cons 2 s))))

) ;_ mapcar

(vla-update (vlax-ename->vla-object x))

) ;_ foreach

) ;_ progn

) ;_ if

(princ)

)

 

 

but i want to work with nested blocks is it possible?

 

thanks

Posted

Two things that you may have been spoken to about already but bear repeating.

 

1. Code written by someone other than yourself should, where known (and in this case it's known), be attributed to the originator which in this case is Lee Mac.

2. Code posted in the forum, unless it is an image of the code, should be contained within code tags.

 

If you don't understand then ask.

Posted

sorry if I omitted the name of the code author:

 

the code was written by :Lee Mac

 

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)

Posted

[/NOPARSE][/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 x (mapcar (function cadr)
                     (ssnamex (ssget "_x" (list (cons 2 s))))
             ) ;_  mapcar
   (vla-update (vlax-ename->vla-object x))
  ) ;_  foreach
 ) ;_  progn
) ;_  if
(princ)
)

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