Author Topic: [XDrX-PlugIn(100)] Objects are scaled in batches around their own specified base  (Read 458 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 527
Code: [Select]
(defun c:XDTB_EntSclByPnt (/ scl tf mat mats e box base cen)
  (if (not #xdtb_global_sclbypnt)
    (setq #xdtb_global_sclbypnt 5)
  )
  (if (not #xdtb_global_scale)
    (setq #xdtb_global_scale 1.0)
  )
  (if (setq scl (getreal
  (xdrx-string-formatex (xdrx-string-multilanguage "\n请输入缩放比例<%.2f>:"
   "\nInput Scale Factors<%.2f>:"
)
#xdtb_global_scale
  )
)
      )
    (setq #xdtb_global_scale scl)
  )
  (if (/= #xdtb_global_scale 1.0)
    (progn (xdrx-initget "0 1 2 3 4 5 6 7 8 9")
   (if (setq
   tf (getint
(xdrx-string-formatex (xdrx-string-multilanguage
  "\n请选择基点类型[插入点(0)/左下(1)/中下(2)/右下(3)/左中(4)/中心(5)/右中(6)/左上(7)/中上(8)/右上(9)]<5>:"
  "\nbase point [Ins(0)/BL(1)/BM(2)/BR(3)/ML(4)/Center(5)/MR(6)/TL(7)/TM(8)/TR(9)]<%d>:"
) #xdtb_global_sclbypnt)
      )
)
     (setq #xdtb_global_sclbypnt tf)
   )
   (while (setq ss (xdrx-ssget
     (xdrx-string-multilanguage "\r请选取要缩放的实体<结束>:"
"\rPlease select the entity to be scaled <Exit>:"
     )
   )
  )
     (xdrx_begin)
     (xdrx_setsstodb ss 0)
     (while (setq e (xdrx_getentdata 0))
       (setq box (xdrx-entity-box e))
       (if (= tf 0)
(setq base (xdrx-getpropertyvalue e "position"))
(setq base (xd::geom:get9pt box tf))
       )
       (if (and base
(setq mats (xdrx_matrix_setScale #xdtb_global_scale (trans base 1 0)))
   )
(xdrx_entity_transform e mats)
       )
     )
     (xdrx_end)
   )
    )
  )
  (princ)
)
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net