jim78b Posted March 23, 2017 Share Posted March 23, 2017 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 Quote Link to comment Share on other sites More sharing options...
ReMark Posted March 23, 2017 Share Posted March 23, 2017 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. Quote Link to comment Share on other sites More sharing options...
jim78b Posted March 23, 2017 Author Share Posted March 23, 2017 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) Quote Link to comment Share on other sites More sharing options...
SLW210 Posted March 23, 2017 Share Posted March 23, 2017 Please read the Code Posting Guidelines and edit your Code to be included in Code Tags.[NOPARSE] Your Code Here[/NOPARSE] = Your Code Here Quote Link to comment Share on other sites More sharing options...
jim78b Posted March 24, 2017 Author Share Posted March 24, 2017 [/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) ) Quote Link to comment Share on other sites More sharing options...
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.