Jump to content

Change object/entity line type scale by layer name in nested blocks


tive29

Recommended Posts

Googles this lisp sometime back. Was by Tharwat & Kent Cooper.

 

Works well but I now need it to change those in nested blocks too.

 

Need help with the changes to include objects & entities inside nested blocks.

 

(defun c:test (/ ly ss)
 ;; Tharwat 06.May.2014  ;;
 ;; altered for list-of-lists approach by Kent Cooper 14 May 2014 ;;
 (setq ly '(("Layer1" 0.5) ("Layer2" 0.75) ("Layer3" 1.5)))
 (if
   (setq ss
     (ssget "_X"
       (list
         '(0 . "CIRCLE,ARC,ELLIPSE,*LINE,RAY,HATCH,REGION")

           ;; [added RAY,HATCH,REGION (people should avoid Hatching on non-continuous-linetype

           ;; Layers, but they do honor linetypes and linetype scale) -- any other possibilities? Leaders

           ;; and Dimensions honor linetypes, but for some reason not linetype scale.]
         (cons 8 (apply 'strcat (mapcar '(lambda (u) (strcat (car u) ",")) ly)))
       ); list
     ); ssget
   ); setq
   ( (lambda (i / sn v)
       (while (setq sn (ssname ss (setq i (1+ i))))
         (if (vlax-write-enabled-p (setq v (vlax-ename->vla-object sn)))
           (vla-put-linetypescale v (cadr (assoc (cdr (assoc 8 (entget sn))) ly)))
         ); if
       ); while
     ); lambda
     -1
   )
 ); if
 (princ)
); defun
(vl-load-com)

Link to comment
Share on other sites

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