Author Topic: Adjust the scale of multy block  (Read 706 times)

0 Members and 1 Guest are viewing this topic.

PM

  • Guest
Adjust the scale of multy block
« on: October 31, 2021, 03:37:35 AM »
I use this lisp to change the scale of the blocks i use, but i have a problem

for exomple I use block for :

1) points (POINT1,POINT2,POINT,3,etc)
2) symbols  (symbol1,symbol2,symbol3,etc)
3) trees (Tree1,tree2,tree3,etc)

for points i use this scale   -->  (setq scf (* scl 0.0025))

for symbols  i use this scale   -->  (setq scf (* scl 0.015))

for trees  i use this scale   -->  (setq scf (* scl 0.002))

Is ant way when i select all blocks to filter them and  change the scale correct ?

Code - Auto/Visual Lisp: [Select]
  1.  
  2. (defun C:BS ( / SS ent vla-obj )
  3.         (vl-load-com)
  4.     (setq scl (getint "\n Select scale  (50,100,200,250,500,etc) :"))
  5.     (setq scf (* scl 0.0025))
  6.         (setq SS (ssget (list (cons 0 "INSERT"))))
  7.                 (repeat (setq i (sslength SS))
  8.                         (setq ent (ssname SS (setq i (1- i))))
  9.                         (setq vla-obj (vlax-ename->vla-object ent))
  10.                         (if
  11.                                 (and
  12.                                         (or
  13.                                                 (not (= (vla-get-XScaleFactor vla-obj) scf))
  14.                                                 (not (= (vla-get-YScaleFactor vla-obj) scf))
  15.                                                 (not (= (vla-get-ZScaleFactor vla-obj) scf))
  16.                                         )
  17.                                         (vlax-property-available-p vla-obj 'EffectiveName)
  18.                                 )
  19.                                 (progn
  20.                                         (vla-put-XScaleFactor vla-obj scf)
  21.                                         (vlax-put-property vla-obj 'YScaleFactor scf)
  22.                                         (vlax-put vla-obj 'ZScaleFactor scf)
  23.                                 )
  24.                     )
  25.                 );repeat
  26.                 (vla-Regen (vla-get-ActiveDocument (vlax-get-acad-object)) acActiveViewport)
  27.         (princ)
  28. );defun
  29.  
  30.  
  31.  

Thanks