我来看MM的 发表于 2013-6-26 22:46:02

【求助】请高手看看我的代码

(defun c:mjj()
(setvar "cmdecho" 0)
(command "style" "宋体" "宋体" "0" "1" "0" "" "")         ;设定字体

(setq en (entsel "请选择对象:"))

(command "area" "o" en)
(setq a (getvar "area"))
(redraw (car en) 3)
(setq s (strcat "S=" (rtos a 2 2)))

(setq #Final (grread T 4 4))

(setq bb (cadr #final))

(entmake
       (list
       '(0 . "text")
       '(100 . "AcDbEntity")
       '(100 . "AcDbText")
       '(7 . "宋体")          
          (cons 1 s)
          (cons 10 bb)                        
          ;(cons 50 ang)
       '(72 . 1)
       '(40 . 3)
       (cons 11 bb)
       );end list
   );end entmake
(setq en1 (entlast))
(while (eq 5 (car (setq #Final (grread T 4 4))))

(setq b (cadr #final))
   
(setq en_data (entgeten1))   
(setq oh (assoc 10 en_data))
(setq ol (cons 10 b))

(setq en_data (subst ol oh en_data))
(entmod en_data)
   
);end while

);end

我来看MM的 发表于 2013-6-26 22:47:55

(entmake
17.       (list
18.         '(0 . "text")
19.         '(100 . "AcDbEntity")
20.         '(100 . "AcDbText")
21.         '(7 . "宋体")         
22.          (cons 1 s)
23.          (cons 10 bb)                        
24.          ;(cons 50 ang)
25.         '(72 . 1)
26.         '(40 . 3)
27.         (cons 11 bb)
28.       );end list
29.   );end entmake
30.(setq en1 (entlast))

我本想利用这段代码生成文字后再获取文字的对象名称,但好像这句(setq en1 (entlast))
不起作用啊。

我来看MM的 发表于 2013-6-26 22:48:59

求高手指正

我来看MM的 发表于 2013-6-26 23:29:03

我来看MM的 发表于 2013-6-26 22:47 static/image/common/back.gif
(entmake
17.       (list
18.         '(0 . "text")


好吧,研究了下,这句没问题。只是不懂为什么接下来没起到更新的作用

ZZXXQQ 发表于 2013-6-27 00:01:25

(setq en1 (entmakex
   (list
    '(0 . "TEXT")
    '(100 . "AcDbEntity")
    '(67 . 0)
    '(100 . "AcDbText")
    (cons 10 bb)
    '(40 . 3)
    (cons 1 s)
    (cons 50 0)
    '(41 . 1)
    '(51 . 0.0)
    '(7 . "宋体")         
    '(72 . 1)
    (cons 11 bb)
    '(210 0.0 0.0 1.0)
    '(100 . "AcDbText")
    (cons 73 0)
   );list
);entmakex
)

我来看MM的 发表于 2013-6-27 00:35:46

ZZXXQQ 发表于 2013-6-27 00:01 static/image/common/back.gif


谢谢斑竹了,解决了。问题是不是出在文字创建的时候,属性列表没弄全而导致,最好没办法更新?
页: [1]
查看完整版本: 【求助】请高手看看我的代码