Author Topic: [XDrX-PlugIn(101)] partially scale(Keep the dim, text, and polyl width unchange)  (Read 252 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Bull Frog
  • Posts: 479
scaled or partially scaled selected objects,
Keep the dimensions, text, and polyline width unchanged

Code: [Select]
(defun c:XDTB_JBFD (/ e mat mat0 na pj pts scl ss ss1)
  (if (not
(setq e (car
  (xdrx_entsel (xdrx-string-multilanguage "\n选取边界曲线<手绘>:"
  "\nSelect boundary curve <hand drawn>:"
       )
       '((0 . "*polyline,circle,ellipse,spline"))
  )
)
)
      )
    (and (setq p1 (getpoint
    (xdrx-string-multilanguage "\n矩形框第一点<退出>:"
       "\nFirst point of rectangular box<Exit>:"
    )
  )
)
(setq p2 (xd::doc:getcorner p1
     (xdrx-string-multilanguage "\n第二点<退出>:"
"\nSecond Point<Exit>:"
     )
     7
     (getvar "ucsxdir")
  )
)
(setq e (xdrx-polyline-make (cadr p2) t))
    )
  )
  (if (and e
   (or (xdrx_object_isa e "AcDbCircle")
       (xdrx_object_isa e "AcDbEllipse")
       (xdrx-curve-isclosed e)
   )
      )
    (progn
      (if (and (setq pts (xdrx_getsamplept e))
       (setq ss (ssget "cp" pts))
  )
(progn (ssdel e ss)
       (if (> (sslength ss) 0)
(progn (setq pj   (xdrx-getpropertyvalue pts "centroid")
      mat0 (xdrx_matrix_identity 3)
)
(setq ss (xdrx_entity_copy ss))
(setq na (strcat "XD_JBFD_" (xdrx_getrandstr)))
(xdrx_block_make na ss pj t)
(apply 'xdrx_insert_clip (cons (entlast) pts))
(setq ss1 (ssadd))
(ssadd (entlast) ss1)
(ssadd e ss1)
(if (and (setq m (xdrx_drag_move (xdrx-string-multilanguage "\n插入点<退出>:"
    "\nInsert Point<Exit>:"
)
ss1
(trans pj 1 0)
)
)
(xdrx_entity_transform ss1 m)
(setq m (xdrx_drag_scale (xdrx-string-multilanguage "\n输入或拾取点确定缩放比例:"
     "\nEnter or pick points to determine scaling:"
  )
  ss1
  (trans (xdrx_drag_getlastpoint) 1 0)
)
)
    )
  (progn (xdrx_entity_transform ss1 m)
(setq mat (xdrx_drag_getlastMatrix)
       scl (xdrx_matrix_scalefactor mat)
)
(XD::Entity:SetOverRide (entlast) scl)
  )
)
)
       )
)
      )
    )
  )
  (princ)
)
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
[XDrx-Sub Forum]
https://www.theswamp.org/index.php?board=78.0
https://github.com/xdcad/XDrx-API
http://bbs.xdcad.net