这是我自己写的,你可以用这个修改一下- ;;;*****统一尺寸界线长度*****
- (defun c:w4 ( / ang d dim dist ent ent_data i pt10 pt11 pt13 pt14 ss xpt10 xpt11)
- (setvar "cmdecho" 0)
- (setq ss (ssget '((0 . "DIMENSION"))))
- (setq i 0)
- (repeat (sslength ss)
- (setq ent (ssname ss i))
- (setq ent_data (entget ent))
- (setq dim (cdr (assoc 3 ent_data)))
- (setq pt10 (cdr (assoc 10 ent_data)));pt后面对应的数字就是,图元列表中的组码
- (setq pt11 (cdr (assoc 11 ent_data)))
- (setq pt13 (cdr (assoc 13 ent_data)))
- (setq pt14 (cdr (assoc 14 ent_data)))
- ;;; --------------------------------------
- (setq dist (distance pt13 pt14));13和14可以求出当前标注界限长度
- (setq ang (angle pt14 pt10));10和14求出标注角度
- (setq d (* 6 (atof (substr dim 3))));截取标注样式名称"yq"后面的数字,在×6就是需要长度
- (setq xpt10 (polar pt14 ang d))
- (setq xpt11 (polar pt11 ang (- d dist)))
- (setq ent_data (subst (cons 10 xpt10) (assoc 10 ent_data) ent_data))
- (setq ent_data (subst (cons 11 xpt11) (assoc 11 ent_data) ent_data))
- (entmod ent_data)
- (setq i (1+ i))
- )
- (prin1)
- )
|