你好
试试这个程序,让我知道你做得怎么样。
- (defun c:test (/ doc scl sel int pnt ent lst mvs)
- ;;------------------------------------;;
- ;; Tharwat - Date: 26.07.2017 ;;
- ;; Move objects from Paper Space to ;;
- ;; Model Space and scale them as per ;;
- ;; the scale factor specified from ;;
- ;; the user. ;;
- ;;------------------------------------;;
- (if (and (or (/= (getvar 'ctab) "Model")
- (alert "Command is not allowed in Model Space <!>")
- )
- (setq scl (getdist "\nSpecify the scale factor :"))
- (princ "\nSelect objects to move to Model space then to scale :")
- (setq doc (vla-get-activedocument (vlax-get-acad-object))
- int -1
- pnt (vlax-3d-point '(0. 0. 0.))
- sel (ssget "_:L" '((0 . "~VIEWPORT")))
- )
- )
- (progn
- (while (setq ent (ssname sel (setq int (1+ int))))
- (setq lst (cons (vlax-ename->vla-object ent) lst))
- )
- (if (apply 'and
- (setq mvs (vlax-invoke
- doc
- 'copyobjects
- lst
- (vla-get-modelspace doc)
- )
- )
- )
- (progn
- (mapcar '(lambda (obj) (vla-scaleentity obj pnt scl)) mvs)
- (mapcar 'vla-delete lst)
- )
- )
- )
- )
- (princ)
- ) (vl-load-com)
|