直接获取文本框四点坐标
(Defun MTEXTBOX (obj / B ENX H J N O R W)
(if (and (= "MTEXT" (cdr ...
问下怎么得到世界坐标的包围盒?发现这个包围盒是0点附近的 advksf 发表于 2024-8-29 23:33
楼上的代码要要怎样运行的?lisp吗
是的,,cad yaojing38 发表于 2024-8-30 12:18
问下怎么得到世界坐标的包围盒?发现这个包围盒是0点附近的
完整的函数
https://zhuanlan.zhihu.com/p/25228344 本帖最后由 yaojing38 于 2024-8-30 14:44 编辑
kozmosovia 发表于 2024-8-30 13:54
完整的函数
https://zhuanlan.zhihu.com/p/25228344
谢谢您的代码!<div class="blockcode"><blockquote>;Example
;(AQX: GETMTEXTBOX (car(entsel)) 0.0)
;((97346.9291.883)(61132.620869.7)(56983.413567.6)(93197.6-7010.23))
;直接获取文本框四点坐标
(Defun AQX:GETMTEXTBOX (obj off / MXV B ENX H J L M N O P R W)
(Defun mxv (m v)
(mapcar '(lambda (r) (apply '+ (mapcar '* r v))) m)
)
(setq enx (entget obj))
(if (null off)
(setq off 0.0)
)
(if
(setq l
(cond
((= "TEXT" (cdr (assoc 0 enx)))
(setq b (cdr (assoc 10 enx))
r (cdr (assoc 50 enx))
l (textbox enx)
)
(list
(list (- (caar l) off) (- (cadar l) off))
(list (+ (caadr l) off) (- (cadar l) off))
(list (+ (caadr l) off) (+ (cadadr l) off))
(list (- (caar l) off) (+ (cadadr l) off))
)
)
((= "MTEXT" (cdr (assoc 0 enx)))
(setq n (cdr (assoc 210 enx))
b (trans (cdr (assoc 10 enx)) 0 n)
r (angle '(0.0 0.0 0.0) (trans (cdr (assoc 11 enx)) 0 n))
w (cdr (assoc 42 enx))
h (cdr (assoc 43 enx))
j (cdr (assoc 71 enx))
o (list
(cond
((member j '(2 5 8)) (/ w -2.0))
((member j '(3 6 9)) (- w))
(0.0)
)
(cond
((member j '(1 2 3)) (- h))
((member j '(4 5 6)) (/ h -2.0))
(0.0)
)
)
)
(list
(list (- (car o) off) (- (cadr o) off))
(list (+ (car o) w off) (- (cadr o) off))
(list (+ (car o) w off) (+ (cadr o) h off))
(list (- (car o) off) (+ (cadr o) h off))
)
)
)
)
((lambda (m)
(mapcar '(lambda (p) (mapcar '+ (mxv m p) b)) l))
(list
(list (cos r) (sin (- r)) 0.0)
(list (sin r) (cos r) 0.0)
'(0.0 0.0 1.0)
)
)
)
)
页:
1
[2]