天天看點

AutoLisp:AutoLisp實作對AutoCAD進行輸入指令,選擇對象,實作不同方向進行縮放

AutoLisp實踐

實踐案例1:輸入指令,選擇對象,實作不同方向進行縮放

實作結果

AutoLisp:AutoLisp實作對AutoCAD進行輸入指令,選擇對象,實作不同方向進行縮放

實作代碼

;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

     ""

繼續閱讀