gilsoto13 Posted October 19, 2011 Posted October 19, 2011 Hi Guys: I've read this is hard to do, but maybe there a simple way someone knows and can share it with us. I want to merge styles named "*standard*" from bound drawings, to a previously created "standard" style. By doing this it is supposed that everything, including Dimension text, text, mtext and attributes will be updated automatically, regardless of particular object properties. There's an easy way to do it, by just changing the simplex font by the arial Narrow font and... I have checked some threads, and this one seem to work as I need...but the only problem is that is does not accept .ttf files. It has worked with .shx font files. Does anyone knw why? or how can I make it work for the Arial Narrow (arialn.ttf) http://www.cadtutor.net/forum/showthread.php?60673-need-an-emergency-lisp-changes-all-text-styles-to-one&p=411843&viewfull=1#post411843 (defun c:cgts6 nil (vl-load-com) ;; Tharwat 04. 07. 2011 (vlax-for x (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)) ) (if (eq (vla-get-fontfile x) "simplex.shx") (vlax-put-property x 'fontfile "[color=red]arialn.ttf[/color]") ) ) (vla-regen (vla-get-ActiveDocument (vlax-get-acad-object)) acAllViewports ) (princ) ) Quote
Lee Mac Posted October 19, 2011 Posted October 19, 2011 Would this program help you at all? (may need membership to access that section of the forum). Quote
gilsoto13 Posted October 19, 2011 Author Posted October 19, 2011 Would this program help you at all? (may need membership to access that section of the forum). I already use this great program since more than a year ago, but I wanted to make a specific lisp so the updates will not require any input from user. :S Basically I need a lisp to search over the fonts names for "Simplex.shx" and replace them by "Arialn.ttf", or another (more difficult) way (I guess) is to wildcard match all "*standard*" styles and merge them into a "standard" style without prompt. Quote
gilsoto13 Posted October 20, 2011 Author Posted October 20, 2011 gREAT it worked... Tharwat... you're a genious... and I am genious now too.... hahahah it worked. This is what I needed. (defun c:cgts9 nil (vl-load-com) ;; Tharwat 04. 07. 2011 (vlax-for x (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)) ) (if (eq (vla-get-fontfile x) "arialn.ttf") (vlax-put-property x 'width "1.0") ) ) (vla-regen (vla-get-ActiveDocument (vlax-get-acad-object)) acAllViewports ) (princ) ) Quote
Tharwat Posted October 20, 2011 Posted October 20, 2011 Damn' it worked... Tharwat... you're a genious... and I am genious now too.... hahahah it worked. This is what I needed. (defun c:cgts9 nil (vl-load-com) ;; Tharwat 04. 07. 2011 (vlax-for x (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)) ) (if (eq (vla-get-fontfile x) "arialn.ttf") (vlax-put-property x 'width "1.0") ) ) (vla-regen (vla-get-ActiveDocument (vlax-get-acad-object)) acAllViewports ) (princ) ) Thank you buddy . I am happy to have my routine worked for you . Tharwat Quote
gilsoto13 Posted October 25, 2011 Author Posted October 25, 2011 For other people to understand what I ended up doing... I just used the Tharwat routine to find and collect all styles using a specific font and then replace that font by another font, so all objects' properties remained the same and their style name remained, but with a new font. (the arialn.ttf was not working 'cause it was not as a File in any of my support File search path folders, so I downloaded it and placed it in my Fonts folder). And then with almost the same code in another subfunction, I collected all styles using a specific font and applied a new property to those style, which is setting Width to 1, as I required it. ;; (defun c:S2A (/) (defun SIMPLEX2ARIALN nil (vl-load-com) ;; Tharwat 04. 07. 2011 (vlax-for x (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)) ) (if (eq (vla-get-fontfile x) "simplex.shx") (vlax-put-property x 'fontfile "arialn.ttf") ) ) (vla-regen (vla-get-ActiveDocument (vlax-get-acad-object)) acAllViewports ) (princ) ) (defun ARIALNWIDTH nil (vl-load-com) ;; Tharwat 04. 07. 2011 (vlax-for x (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)) ) (if (eq (vla-get-fontfile x) "arialn.ttf") (vlax-put-property x 'width "1.0") ) ) (vla-regen (vla-get-ActiveDocument (vlax-get-acad-object)) acAllViewports ) (princ) ) (SIMPLEX2ARIALN) (ARIALNWIDTH) ) ;; Quote
Tharwat Posted October 25, 2011 Posted October 25, 2011 Would this work for you instead of that long and repeated one ? (defun c:TesT (/ acdoc) (vl-load-com) ;; Tharwat 25. Oct. 2011 (vlax-for x (vla-get-textstyles (setq acdoc (vla-get-activedocument (vlax-get-acad-object)) ) ) (if (eq (vla-get-fontfile x) "simplex.shx") (progn (vlax-put-property x 'fontfile "arialn.tff") (vlax-put-property x 'width "1.0") ) ) ) (vla-regen acdoc acAllViewports) (princ) ) Tharwat 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.