回复 669423907 的帖子
- (defun c:tabdim (/ loop i ss dimstyles gr cnt)
- (setq dimstyles (vl-sort (gxl-table "dimstyle") '(lambda (a b) (> (atoi a) (atoi b))))
- cnt (length dimstyles)
- i -1
- loop t
- )
- (setq ss (ssget '((0 . "DIMENSION"))))
- (if ss
- (progn
- (princ "\n*** 键入 A 或 S 切换标注样式 , 回车键或右键结束 *** ")
- (princ "\n")
- (while loop
- (setq gr (grread t 5 1))
- (if (= 2 (car gr))
- (cond ((or (= 97 (cadr gr)) (= 65 (cadr gr)))
- (setq i (1+ i)
- i (rem i cnt)
- )
- (setq style (nth i dimstyles))
- (princ (strcat "\r***当前标注样式为: " style " "))
- (gxl-sel-mapcar ss '(lambda (x) (GXL-CH_ENT x 3 style)))
- )
- ((or (= 83 (cadr gr)) (= 115 (cadr gr)))
- (setq i (1- i))
- (if (MINUSP i) (setq i (+ i cnt)))
- (setq style (nth i dimstyles))
- (princ (strcat "\r***当前标注样式为: " style " "))
- (gxl-sel-mapcar ss '(lambda (x) (GXL-CH_ENT x 3 style)))
- )
- ((= 13 (cadr gr)) (setq loop nil))
- ) ;_ cond
- (if (= 25 (car gr))
- (setq loop nil)
- )
- )
- )
-
- )
- )
- (princ)
- )
- ;;;gxl-table 返回包含在指定符号表中的所有元素
- (defun gxl-table (s / d r)
- (while (setq d (tblnext s (null d)))
- (setq r (cons (cdr (assoc 2 d)) r))
- )
- )
- ;;;(gxl-CH_Ent ent i pt) 用新值pt更新图元ent索引i对应的值
- (defun gxl-CH_Ent (ent i pt / en)
- (if (assoc i (setq en (entget ent)))
- (setq en (subst (cons i pt) (assoc i en) en))
- (setq en (append en (list (cons i pt))))
- )
- (entmod en)
- )
- ;;;(gxl-Sel-Mapcar ss Fun) 遍历选择集对所包含的图元进行指定函数操作,返回操作后的表
- (defun gxl-Sel-Mapcar (ss Fun / nn rtn)
- (repeat (setq nn (sslength ss))
- (setq rtn (cons (apply Fun (list (ssname ss (setq nn (1- nn))))) rtn))
- )
- )
|