Lee Mac 发表于 2022-7-6 13:26:06

不知道你会爆炸得到那个艾伦,嗯,那么也许:
 

(defun c:fract (/ tEnt1 tEnt2 tEnt)
(vl-load-com)
(and (setq tEnt1 (car (entsel "\nSelect Upper Text: ")))
      (eq "TEXT" (cdadr (entget tEnt1)))
      (setq tEnt2 (car (entsel "\nSelect Lower Text: ")))
      (eq "TEXT" (cdadr (entget tEnt2)))
      (setq tEnt
      (M-Text '(0 0 0)
          (strcat "\{\\H0.7x;\\S"
            (cdr (assoc 1 (entget tEnt1))) "/"
            (cdr (assoc 1 (entget tEnt2))) ";}")))
      (not (command "_.move" tEnt "" '(0 0 0) pause))
      (command "_.explode" tEnt))
(princ))            

(defun M-Text (pt val)
(entmakex
   (list
   (cons 0 "MTEXT")         
   (cons 100 "AcDbEntity")         
   (cons 100 "AcDbMText")   
   (cons 10 pt)      
   (cons 1 val))))

alanjt 发表于 2022-7-6 13:29:18

 
哈哈,我从没想过我会引用自己的话。
不太好看,但这样行得通。
(defun c:fract (/ tEnt1 tEnt2 tEnt)
(and (setq tEnt1 (car (entsel "\nSelect Upper Text: ")))
      (eq "TEXT" (cdadr (entget tEnt1)))
      (setq tEnt2 (car (entsel "\nSelect Lower Text: ")))
      (eq "TEXT" (cdadr (entget tEnt2)))
      (setq tEnt
      (M-Text '(0 0 0)
          (strcat "\{\\H0.7x;\\S"
            (cdr (assoc 1 (entget tEnt1))) "/"
            (cdr (assoc 1 (entget tEnt2))) ";}")))
      (not (command "_.move" tEnt "" '(0 0 0) pause))
       (command "_.explode" tEnt))
(princ))            

(defun M-Text (pt val)
(entmakex
   (list
   (cons 0 "MTEXT")         
   (cons 100 "AcDbEntity")         
   (cons 100 "AcDbMText")   
   (cons 10 pt)      
   (cons 1 val))))我还取出了(vl负载com)

alanjt 发表于 2022-7-6 13:33:56

哈哈,我没看到你发了回复。
我觉得这可能是一条很好的捷径。
 

Lee Mac 发表于 2022-7-6 13:35:21

哈哈。。两者几乎相同。。。英雄所见略同。。
 
不知道为什么我在那里有vl load com。。。我想有一次我打算使用vla addMText,但忘了把它取出来

goldy2000 发表于 2022-7-6 13:39:01

 
这个lisp是我朋友几年前写的,所以他给我用,但它不适合我,所以我不能给你关于它的答案,因为我不知道写lisp,对不起,但我的问题是选择文本并放在准确的位置(用鼠标指针)。我喜欢你的lisp开始,当选择下来的文字,它把线,谢谢你的努力!!!

alanjt 发表于 2022-7-6 13:42:56

 
事实上,哈哈。我想是的。
 
我以为你本来是要走那条路的,只是觉得我会把它去掉。

goldy2000 发表于 2022-7-6 13:44:51

谢谢很多人,你帮了我很多!!!
 
文字大小如何,在lisp中可以更改吗?每次它显示在0.07高度?嗯。。。

goldy2000 发表于 2022-7-6 13:49:44

但很好的解决方案,爆炸它,我从来没有想过,多行文字可以爆炸的方式。。。。好主意。。

Lee Mac 发表于 2022-7-6 13:51:43

 
它只是在标准文本样式中设置的TextSize上,如果您想偏离默认值,可以在entmakex列表中添加更多行。
 
 
我也没有意识到——不过很高兴知道

alanjt 发表于 2022-7-6 13:54:45

 
我知道这个帖子在很久以前就贴在这里了,但谁在乎呢:
(defun makeMTEXT (pt txt width txtsize / entl)
(setq entl (list
            '(0 . "MTEXT")
            '(100 . "AcDbEntity")
            '(100 . "AcDbMText")
            (cons 10 pt)
            (cons 40 txtsize)
            (cons 41 width)
            '(71 . 1) ; Attachment point
            '(72 . 5) ; Drawing Direction
            (cons 1 txt)
            (cons 7 (getvar "TEXTSTYLE"))
            '(11 1.0 0.0 0.0)
            (cons 42 txtsize)
            (cons 43 txtsize)
            '(50 . 0.0)
            )
)
(entmake entl)
)
页: 1 [2]
查看完整版本: Lisp需要修改。。。