DXF代码中的变量
大家好,根据下面的代码,我的列表有问题。
(if (null (tblsearch "style" teksthoogte))
(entmake
(list
'(0 . "STYLE")
'(-3 ;; Make the style annotative
("AcadAnnotative"
(1000 . "AnnotativeData")
(1002 . "{")
(1070 . 1)
(1070 . 1)
(1002 . "}")
)
)
'(100 . "AcDbSymbolTableRecord")
'(100 . "AcDbTextStyleTableRecord")
'(2 . teksthoogte) ;; Style name
'(70 . 0) ;; Standard flag values (bit-coded values)
'(40 . 1. ;; text height
'(41 . 1.0) ;; width factor
'(50 . 0.0) ;; oblique angle
'(71 . 0) ;; text generation "0" normal text
'(42 . 0) ;; last height used
'(3 . "Arial.ttf") ;; font file name
'(4 . "") ;; bigfont (blank for no)
) ;; end list
) ;; end entmake
) ;; end if
当我运行这个LISP时,AutoCAD说:
; error: bad DXF group: (2 . TEKSTHOOGTE)
所以,我的问题是:如何让变量“teksthoogte”在这个列表中工作? 我现在无法测试这一点,但尝试在名称周围使用一些引号。 (cons 2 teksthoogte);风格名称 这不是解决方案,当在其周围换行引号时,AutoCAD将其视为文本,而它需要是一个在LISP中较早设置的变量。 为什么不呢?
看看这是否有效(可能的问题是非英语字母,
如果我没记错的话,我也有过同样的问题
德语“A”元音字母)
复制粘贴此剪贴:
(setq teksthoogte "ANNO-Tekst 2.5")
(if (not (tblsearch "style" teksthoogte))
(entmake
(list
'(0 . "STYLE")
'(-3 ;; Make the style annotative
("AcadAnnotative"
(1000 . "AnnotativeData")
(1002 . "{")
(1070 . 1)
(1070 . 1)
(1002 . "}")
)
)
'(100 . "AcDbSymbolTableRecord")
'(100 . "AcDbTextStyleTableRecord")
(cons 2teksthoogte) ;; Style name
'(70 . 0) ;; Standard flag values (bit-coded values)
'(40 . 1. ;; text height
'(41 . 1.0) ;; width factor
'(50 . 0.0) ;; oblique angle
'(71 . 0) ;; text generation "0" normal text
'(42 . 0) ;; last height used
'(3 . "Arial.ttf") ;; font file name
'(4 . "") ;; bigfont (blank for no)
) ;; end list
) ;; end entmake
) ;; end if
这可能有助于您理解:
http://www.cadtutor.net/forum/showpost.php?p=258390&postcount=20 大家好,
谢谢你的回复。
李,你的帖子并没有真正帮助我理解(可能是因为我的英语不太好)。
但是,我已经找到了解决问题的方法。
这是我现在的代码:
(if (null (tblsearch "style" teksthoogte))
(entmake
(list
'(0 . "STYLE")
'(-3 ;; Make the style annotative
("AcadAnnotative"
(1000 . "AnnotativeData")
(1002 . "{")
(1070 . 1)
(1070 . 1)
(1002 . "}")
)
)
'(100 . "AcDbSymbolTableRecord")
'(100 . "AcDbTextStyleTableRecord")
'(2 . (strcat teksthoogte)) ;; Style name
'(70 . 0) ;; Standard flag values (bit-coded values)
'(40 . 1. ;; text height
'(41 . 1.0) ;; width factor
'(50 . 0.0) ;; oblique angle
'(71 . 0) ;; text generation "0" normal text
'(42 . 0) ;; last height used
'(3 . "Arial.ttf") ;; font file name
'(4 . "") ;; bigfont (blank for no)
) ;; end list
) ;; end entmake
) ;; end if
我做的一件事就是更换
'(2 . teksthoogte)
具有
'(2 . (strcat teksthoogte))
现在,我只是想知道这样做是否合适。
不会计算strcat表达式(尽管实际上不需要strcat),因为列表被引用,因此不会计算(如我的线程中所述)。
相反,请使用:
(cons 2 teksthoogte) 我还没试过,周一会在办公室试。
页:
[1]