是要类似的功能吗? 使用前先给定wlsamdir-wl- ;填加包含字符串的线形 作者 懒虫 应用于 StrAModel 一个利用AutoCAD输入复杂结构的计算模型的工具
- ;name 线形名称
- ;str 线形内字符串
- ;style 字符串用的文字样式
- (defun add_ltype (name str style / box box1 lis fil linetypes_Sel)
- ;(setq name "SayzEz" style "wltools")
- (if (null (tblsearch "ltype" name))
- (progn
- ;(alert (vl-princ-to-string name))
- (if (tblsearch "style" style)
- (setq lis (list (cons 7 style)))
- (setq lis (list '(7 . "STANDARD"))
- style "standard"
- )
- )
- (setq box (textbox
- (append (list (cons 1 str) '(40 . 2) '(41 . 1) '(10 0.0 0.0 0.0))
- lis
- )
- )
- )
- (setq box1 (textbox
- (append (list (cons 1 "<->") '(40 . 2) '(41 . 1) '(10 0.0 0.0 0.0))
- lis
- )
- )
- )
- (setq fil (open (strcat wlsamdir-wl "temltype.lin") "w"))
- (princ ";;这是临时线型文件,会被程序随时修改,不要在此定义自己的线型\n"
- fil
- )
- (princ "*" fil)
- (princ name fil)
- (princ "," fil)
- ;(princ name)
- (repeat 3 (princ (strcat "--" str "--") fil))
- (princ "\n" fil)
- (princ "A,3,-.1,[" fil)
- (princ (strcat """ str "",") fil)
- (princ style fil)
- (princ ",S=2,R=0.0,X=" fil)
- (princ (rtos (* -1.0 (+ 0.1 (caar box))) 2 3) fil)
- (princ ",Y=" fil)
- (princ (rtos (* -0.5 (+ (cadadr box1) (cadar box1))) 2 3)
- fil
- )
- (princ "]," fil)
- (princ (rtos (- (caar box) (caadr box) -0.1) 2 3) fil)
- (close fil)
- (setq linetypes_Sel (vla-get-Linetypes
- (vla-get-ActiveDocument (vlax-get-acad-object))
- )
- )
- (vlax-invoke-method linetypes_Sel
- 'Load
- name
- (strcat wlsamdir-wl "temltype.lin")
- )
- )
- )
- )
|