本帖最后由 梦想家-DING 于 2022-10-5 14:09 编辑
- ;;代码来源于明经 start4444
- (defun c:tt5 (/ d p1 p2 p3 p4 px py)
- (if (not DD) (setq DD 8))
- (setq DD (if (setq D (getdist (strcat "\n输入标注间距<" (rtos DD 2 2) ">:"))) D DD) p1 (getpoint "\n起点:") p2 (getcorner p1 "\n终点:") p3 (list (car p2) (cadr p1)) p4 (list (car p1) (cadr p2)))
- (cond
- ((and (> (car p2) (car p1)) (> (cadr p1) (cadr p2)) (setq py (polar p1 (* 0.5 pi) dd) px (polar p1 (* 1 pi) dd))))
- ((and (> (car p2) (car p1)) (< (cadr p1) (cadr p2)) (setq py (polar p1 (* 1.5 pi) dd) px (polar p1 (* 1 pi) dd))))
- ((and (< (car p2) (car p1)) (> (cadr p1) (cadr p2)) (setq py (polar p1 (* 0.5 pi) dd) px (polar p1 (* 0 pi) dd))))
- ((and (< (car p2) (car p1)) (< (cadr p1) (cadr p2)) (setq py (polar p1 (* 1.5 pi) dd) px (polar p1 (* 0 pi) dd))))
- )
- (command "DIMLINEAR" "non" p1 "non" p3 "non" py "DIMLINEAR" "non" p1 "non" p4 "non" px)
- (princ)
- )
各位前辈,怎样根据这个代码改成拉动一定距离(等于需放置的距离 )后,框选图形标注最大外形。
实现像下图这样的效果
|