AutoLisp:AutoLisp实现对AutoCAD进行输入命令,选择对象,实现不同方向进行缩放

AutoLisp:AutoLisp实现对AutoCAD进行输入命令,选择对象,实现不同方向进行缩放


AutoLisp实践

实践案例1:输入命令,选择对象,实现不同方向进行缩放

实现结果

实现代码

;x,y方向不同比例缩放
; ***  XSCALE   [Version 1.0] 6/22/2005  ***
;
;Copyleft Gu Wenwei
;
; ***************************************
; ****  Author:  Apooollo            ****
; ****                               ****
; ****  Wuxi Jiangsu China           ****
; ***************************************
;
;
; This program takes selected objects, defines an anonymous block,
; then inserts the block at the original location, Scale by X,Y

(defun C:XSCALE(/ bp ss xscal yscal entL)

  (defun errexit (s)
    (princ "\nError:  ")
    (princ s)
    (restore)
  )

  (defun restore ()
    (setvar "CMDECHO" (car oldvar))
    (setq *error* olderr)
    (princ)
  )

(defun MAKEUNBLOCK (ss ip / tmp errexit mbx BLAYER)

  (setq T (not nil))
  (setq olderr  *error*
        *error* errexit
  )
  (setq oldvar
    (list
      (getvar "CMDECHO")
    )
  )
  (setvar "CMDECHO" 0)
  (terpri)
  (if BLAYER
    (command "._LAYER"
      (if (tblsearch "LAYER" BLAYER) "_S" "_M")
      BLAYER
      ""
    )
  )
(0)

相关推荐