dirkvandonkelaar Posted January 2, 2012 Posted January 2, 2012 Hi all, I have a problem with my list, according to the code below. (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 When I run this LISP, AutoCAD says: ; error: bad DXF group: (2 . TEKSTHOOGTE) So, my question is: how can i get the variable "teksthoogte" working in this list? Quote
fuccaro Posted January 2, 2012 Posted January 2, 2012 I can not test this right now, but try to use some quotation marks around the name. Quote
GP_ Posted January 2, 2012 Posted January 2, 2012 (edited) (cons 2 teksthoogte); Style nome Edited January 2, 2012 by GP_ Quote
dirkvandonkelaar Posted January 2, 2012 Author Posted January 2, 2012 That's not the solution, when you wrap quotes arrount it, AutoCAD sees it as text, while it needs to be an variable which is set earlier in the LISP. Quote
fixo Posted January 2, 2012 Posted January 2, 2012 Why not? See if this works (possible problems is non-english letters, if I remember that right, I have a got same problem once with german "A" umlaut letter) Copy paste this snip: (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 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 Quote
Lee Mac Posted January 2, 2012 Posted January 2, 2012 This may help with your understanding: http://www.cadtutor.net/forum/showpost.php?p=258390&postcount=20 Quote
dirkvandonkelaar Posted January 7, 2012 Author Posted January 7, 2012 Hi all, Thanks for the replies. Lee Mac, your thread did not really helped me understanding (maybe 'cause my English is not great). BUT, i've found a solution for my problem. This is my code now: (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 The one thing i did was just replace '(2 . teksthoogte) with '(2 . (strcat teksthoogte)) Now, i just wanted to know if it's the right wat to do this. Quote
Lee Mac Posted January 7, 2012 Posted January 7, 2012 The one thing i did was just replace '(2 . teksthoogte) with '(2 . (strcat teksthoogte)) The strcat expression will not be evaluated (although strcat is no actually required) since the list is quoted and hence not evaluated (as explained in my thread). Instead, use: (cons 2 teksthoogte) Quote
dirkvandonkelaar Posted January 7, 2012 Author Posted January 7, 2012 Instead, use: (cons 2 teksthoogte) Haven't tried that yet, will try it monday at the office. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.