您好,masoud_123,
欢迎来到论坛
我希望这个文本框因素有意义?
- (defun [color="blue"]Mtext_fit[/color] (pt str / doc bb)
- ;hanhphuc 26/11/2014
- (setq doc (vlax-get-acad-object)
- [color="red"]str (substr str 1 (vl-string-search "\" str)) ;<-- added[/color]
- 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
- ([color="blue"]Mtext_fit[/color] pt str)
- ) ;_ end of if
- (princ)
- ) ;_ end of defun
通过手动拟合单线或多线,
只需在记事本中键入&*复制文本内容,然后在acad空间中右键单击->粘贴,或Crtl+v
*自动粘贴为多行文字
我可能错了,只有我的0.02美元 |