Grrr Posted February 2, 2018 Posted February 2, 2018 thanx Grrr. In the end (or should I say begin) the problem was the difference between vla-get-block or vla-get-blocks... one stupid letter... Doh, even I didn't saw it.. maybe next time before implementing the mapping routine into odbx, to test it first on the active dwg (for easier error-tracing). Yeah , my void only goes so many levels deep in an empty string that was because I wrote it before vlisp existed and before vl-string->list / -trim etc existed. And still it has served me well all the these years , pure nostalgia Ah, I see... altho I liked that subfoo, so I use it /a rewritten version/ in some of my DCL routines (to check for a valid edit_box input). Still solvable without vl-* : ; _$ (mapcar 'valid-p (list nil "" " " " " 123 "str" " ")) >> (nil nil nil nil 123 T nil) (defun valid-p ( s / c ) (cond ( (not (eq 'STR (type s))) s) ( (= s "") nil) ( (/= (setq c (substr s 1 1)) " ") t) ( (valid-p (substr s 2)) ) ) ); defun valid-p Quote
rlx Posted February 2, 2018 Posted February 2, 2018 Ah, I see... altho I liked that subfoo, so I use it /a rewritten version/ in some of my DCL routines (to check for a valid edit_box input). I realy like my 'tiny-lisp' functions , one-liners etc. but... only if they're stable else my code must read like a good book so I can understand what I meant a year later. I also like to put as much information on one line in my vlisp editor so I use 140 character lines in my code. It's a disaster when printing but I rarely print anyway and that way I can have allmost double the code in my window then when I would limit my lines to lets say 80 characters. And if anyone has a problem with that , just use format code in the vlisp editor. Only downside of my 'tiny-lisp'functions is that now and again I forget to include them when I post a code on a thread because they are spread out over all my lisp routines so if one routine hasn't got them I will always have another function that loads it. Well... it has been a long day so.... Quote
wimal Posted April 6, 2018 Posted April 6, 2018 This is a great code. Can you add one more option to change width factor of texts to 1. Quote
rlx Posted April 6, 2018 Posted April 6, 2018 This is a great code. Can you add one more option to change width factor of texts to 1. not tested (no time) but replace the following section : (defun change_text_style ( $dwg / odbxdoc acstyles style-obj fnt layout obj o-name bn bn-list ent) (if (and (setq odbxdoc (odbx_open $dwg)) (setq acstyles (vla-get-textstyles odbxdoc)) (setq style-obj (vla-add acstyles "Company_Name")) (setq fnt (findfile "C:\\Windows\\Fonts\\arialn.ttf"))) (progn (vla-put-fontfile style-obj fnt) (vlax-for layout (vla-get-layouts odbxdoc) (vlax-for obj (vla-get-block layout) (cond ; remove "AcDbText" "AcDbMText" to NOT update (m)text's ((member (vla-get-objectname obj) '("AcDbText" "AcDbMText" "AcDbAttributeDefinition")) (vla-put-StyleName obj "Company_Name")) ((= (vla-get-objectname obj) "AcDbBlockReference") (mapcar '(lambda(x) (vla-put-StyleName x "Company_Name") [color=red](vla-put-ScaleFactor x <put your width here>)[/color] ) (get-block-ent obj))) ) ) ) (vl-catch-all-error-p (vl-catch-all-apply 'vla-saveas (list odbxdoc $dwg))) ) ) ) have to start with my new project now , so I'll check later... gr. Rlx 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.