|
发表于 2015-6-19 23:09:52
|
显示全部楼层
那些烦人的事情让我每画一幅画都慢下来。这是我的哀悼。我最终把它们放在自己的图层上,然后基本上在它们上面粘贴MLeader。然后我从隔离层中删除了它(defun c:foo (/ _dxf lp lp2 lpe ml ss txt x)
(defun _dxf (code ename)
(if ename
(cdr (assoc code (entget ename)))
)
)
;; Single pick cleanup
;; Requires all of the following items -->
(cond ((null (and (setq ss (ssget ":L" (list '(0 . "text,line,solid"))))
(setq ss (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
)
)
(print "Bye...")
)
((not (setq
lp (_dxf 12 (setq lpe (car (vl-remove-if-not '(lambda (x) (= "SOLID" (_dxf 0 x))) ss))))
)
)
(print "Leader point not found...")
)
((not (setq lp2
(car (vl-sort (apply 'append
(mapcar '(lambda (x) (list (_dxf 10 x) (_dxf 11 x)))
(vl-remove-if-not '(lambda (x) (= "LINE" (_dxf 0 x))) ss)
)
)
'(lambda (a b) (> (distance a lp) (distance b lp)))
)
)
)
)
(print "Lines not selected...")
)
((not (setq txt (vl-sort (vl-remove-if-not '(lambda (x) (= "TEXT" (_dxf 0 x))) ss)
'(lambda (a b) (> (cadr (_dxf 10 a)) (cadr (_dxf 10 b))))
)
)
)
(print "Text not selected...")
)
(t
(command "._mleader" lp lp2 "")
(setq ml (vlax-ename->vla-object (entlast)))
(vla-put-textstring
ml
(vl-string-right-trim
"\\P"
(apply 'strcat (mapcar '(lambda (x) (strcat (_dxf 1 x) "\\P")) txt))
)
)
(vla-put-layer ml (_dxf 8 (car txt)))
;; Suggest using an mleader style rather than these hardcoded values below :)
;; may Sh!+ the bed depending on the CMLEADERSTYLE
(vla-put-textstylename ml (_dxf 7 (car txt)))
(vla-put-textheight ml (_dxf 40 (car txt)))
(vla-put-arrowheadsize ml (distance lp (_dxf 10 lpe)))
(mapcar 'entdel ss)
)
)
(princ)
)[/code] |
|