Author Topic: Text width for attribute value within Dynamic block  (Read 5373 times)

0 Members and 1 Guest are viewing this topic.

OcCad

  • Guest
Re: Text width for attribute value within Dynamic block
« Reply #15 on: November 27, 2007, 04:42:20 PM »
Thanks for your help guys. Here it is if anyone likes...

Code: [Select]
(defun c:setw (/ ss n index obj atts blkname)

  (setq txw (getreal (strcat "\n[color=red]PROMPT[/color] <" (rtos txw_default 2) ">: ")))
    (if (= txw nil)
      (setq txw txw_default)
      (setq txw_default txw)
    );if

  (vl-load-com)

  (setq ss nil)
  (setq ss (ssget '((0 . "INSERT") (66 . 1))))
    (if ss
      (progn
        (setq n (sslength ss))
        (setq index 0)
          (repeat n
            (setq obj (vlax-ename->vla-object (ssname ss index)))
            (setq index (1+ index))
            (setq atts (vlax-invoke obj 'getattributes))
            (setq blkname (strcase (vla-get-effectivename obj) t))       
              (if (member blkname
       '("[color=red]block1[/color]"
         "[color=red]block2[/color]"
         "[color=red]block3[/color]"
         "[color=red]block4[/color]"
        )
      );if
                (progn
                  (foreach att atts
                     (cond
                       ((= "[color=red]TAG[/color]" (vla-get-tagstring att))
                       (vla-put-scalefactor att txw))
                     );cond
                  );foreach
                );progn
              );if
          );repeat
      );progn
    );if
 
  (setq ss nil)
  (princ)
);end defun