本帖最后由 ZZXXQQ 于 2014-4-27 07:33 编辑
- ;改线型比例 明经 2014.4.27
- (defun c:tt ();/ ltsold ss en dxf celtsold celtsnew)
- (setvar "CMDECHO" 0)
- (setq ltsold (getvar "ltscale"));获取当前全局比例因子
- ; (setq ss (ssget "X" '((0 . "ARC,CIRCLE,ELLIPSE,LINE,*POLYLINE"))));选择所有的线
- (while (setq ss (ssget ":s"))
- (repeat (setq n (sslength ss))
- (setq en (ssname ss (setq n (1- n))))
- (setq dxf (entget en))
- (if (assoc 48 dxf)
- (setq celtsold (cdr(assoc 48 dxf)));获取当前线段的比例因子,因为现在要将图纸的全局比例因子改成1000,所以现在线型的celtscale要变成(1000/lsold )*celtsold
- (setq celtsold 1)
- )
- (setq celtsnew (/ (* ltsold celtsold) 1000.0))
- (if (assoc 6 dxf)
- (if (/= (cdr(assoc 6 dxf)) "Continuous")
- (command "chprop" en "" "s" celtsnew "")
- )
- (if (/= (cdr(assoc 6 (tblsearch "LAYER" (cdr(assoc 8 dxf))))) "Continuous")
- (command "chprop" en "" "s" celtsnew "")
- )
- )
- )
- )
- (setvar "ltscale" 1000)
- (setvar "CMDECHO" 1)
- (princ (strcat "\n---已经将所选对象全部比例因子即lts从" (rtos (* ltsold celtsold) 2) "改为1000"))
- (princ)
- )
-
|