masoud_123 发表于 2022-7-5 22:10:39

如何适应多行文字?

我想知道通过知道一个地方的高度和宽度,是否可以将多行文字实体放在一个地方?
我们如何调整多行文字高度以适应entmake多行文字中的位置?
(entmake
(list
        '(0 . "MTEXT")
        '(102 . "{ACAD_REACTORS")
        '(102 . "}")
        '(100 . "AcDbEntity")
        '(100 . "AcDbMText")
       (cons 10 insertion_point)
        (cons 40 text_height)
               (cons 62 4)
        (cons 41 refrence_rectangle_width)
        '(42 . 2.55)
        '(43 . 0.18)
        '(44 . 1.0)
        '(71 . 5)
        '(72 . 1)
        (cons 1"Your string hear")
        '(7 . "Text Style")
        '(210 0.0 0.0 1.0)
        '(11 1.0 0.0 0.0)
        '(50 . 0.0)
        '(73 . 1)
      )
)

hanhphuc 发表于 2022-7-5 22:36:57

 
您好,masoud_123,
欢迎来到论坛
 
我希望这个文本框因素有意义?
 

(defun Mtext_fit (pt str / doc bb)
;hanhphuc 26/11/2014
(setq        doc (vlax-get-acad-object)
       str (substr str 1 (vl-string-search "\\" str));<-- added   
bb(apply 'mapcar
           (cons '- (reverse (mapcar ''((x) (cdr (reverse x))) (textbox (list (cons 1 str))))))
           ) ;_ end of apply
) ;_ end of setq
(vla-AddMText
   (foreach x '(ActiveDocument ActiveLayout Block) (setq doc (vlax-get doc x)))
   (vlax-3d-point pt)
   (* (car bb) (apply '/ (reverse bb)))
   str
   ) ;_ end of vla-AddMText
) ;_ end of defun

 
例子:

(defun c:test (/ *error* pt str var)
(set'var (getvar 'dynmode))
(defun *error* (msg)
   (if        var
   (setvar 'dynmode var)
   ) ;_ end of if
(princ ":-(")
   ) ;_ end of defun
(if (and (setq pt (getpoint "\nInsertion Point.."))
   (setvar 'dynmode 1)
   (setq str (getstring "\nInput text:" t))
   (setvar 'dynmode var)
   ) ;_ end of and
   (Mtext_fit pt str)
   ) ;_ end of if
(princ)
) ;_ end of defun

 
通过手动拟合单线或多线,
只需在记事本中键入&*复制文本内容,然后在acad空间中右键单击->粘贴,或Crtl+v
*自动粘贴为多行文字
我可能错了,只有我的0.02美元

BIGAL 发表于 2022-7-5 22:49:15

你好,hanhphuc
 
我对文本框一无所知。。。感谢您提及:-)

hanhphuc 发表于 2022-7-5 23:02:52

masoud_123 发表于 2022-7-5 23:12:37

Hi hanhphuc
 
I didn't know anything about textbox... Thank you for mentioning :-)
页: [1]
查看完整版本: 如何适应多行文字?