TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Luke on September 02, 2009, 04:34:26 PM
-
I currently have a text style called LCC. It is used all over the place... my standard notes, in my dimension styles and within my title block.
The font type is Romans. I need to change it to Ariel. Changing my template so a new drawing is correct is no problem. But all my old drawings need to be changed.
Is this a job for a script / lisp or do I need to font map something? I do not want the romans font totaly replaced by Ariel, I just want to change the fone used in my text style.
Thanks
-
I work in autocad 2000 but, if ALL your text is extremely similar, justifications etc., you can use SSX from express tools to create a selection set of the text you want to change, create or insert one piece of text with your new font and MATCHPROP previous.
if they don't call it SSX anymore:
(setq ss1 (ssget "X" '((7 . "LCC"))))
should get a similar selection set.
then create the similar style with ariel font type and name it something different, like LCC1.
then modify the text entities with SUBST and ENTMOD.
but the lisp might look like this:
(defun c:foo ( / ss1 count)
(setq ss1 (ssget "X" '((7 . "LLC")))
count 0
)
(repeat (sslength ss1)
(entmod
(subst '(7 . "LLC1")
(assoc 7 (setq ent (entget (ssname ss1 count))))
ent
)
)
(setq count (+ count 1))
)
)
of course, if you have text in a block, like your title block, the lisp gets more complex, or you can explode your blocks with text in them, foo them, and redefine the block(s).
hope this helps.
roy
-
Maybe this will help: http://www.theswamp.org/index.php?topic=15317.msg186284#msg186284
-
if all you need to do is change the font for the specific text style, this will work:
(vl-catch-all-apply
'(lambda ()
(vla-put-fontfile
(vla-item
(vla-get-textstyles
(vla-get-activedocument
(vlax-get-acad-object)
) ;_ vla-get-activedocument
) ;_ vla-get-textstyles
"LCC"
) ;_ vla-item
"Arial.ttf"
) ;_ vla-put-fontfile
) ;_ lambda
) ;_ vl-catch-all-apply
-
Also keep in mind, if mtext contains embedded font formatting, changing the text style will not change the appearance of the text. You would have to remove the embedded format codes from the text string.
-
Also keep in mind, if mtext contains embedded font formatting, changing the text style will not change the appearance of the text. You would have to remove the embedded format codes from the text string.
tag, you're it.
-
Okay,
Attached is my current beta version of StripFormat.
Example: strip only embedded font formatting from an mtext string:
(StripFormat <string> (list "F"))
BTW, "your" is a possessive pronoun. The correct syntax is "you're". A contraction of "you are".
-
Okay,
Attached is my current beta version of StripFormat.
Example: strip only embedded font formatting from an mtext string:
(StripFormat <string> (list "F"))
BTW, "your" is a possessive pronoun. The correct syntax is "you're". A contraction of "you are".
you're absolutely correct. fast typing and not thinking about what i was saying, but is that really relevant?
-
Okay,
Attached is my current beta version of StripFormat.
Example: strip only embedded font formatting from an mtext string:
(StripFormat <string> (list "F"))
BTW, "your" is a possessive pronoun. The correct syntax is "you're". A contraction of "you are".
you're absolutely correct. fast typing and not thinking about what i was saying, but is that really relevant?
From my viewpoint, it's relevant if you want me to pay attention to your comments. Bad English tends to be ignored.
Let's try to refocus on the issues at hand.
-
Okay,
Attached is my current beta version of StripFormat.
Example: strip only embedded font formatting from an mtext string:
(StripFormat <string> (list "F"))
BTW, "your" is a possessive pronoun. The correct syntax is "you're". A contraction of "you are".
you're absolutely correct. fast typing and not thinking about what i was saying, but is that really relevant?
From my viewpoint, it's relevant if you want me to pay attention to your comments. Bad English tends to be ignored.
Let's try to refocus on the issues at hand.
my sentiments exactly.
-
If you set it up correctly, then you can use the code here ( link below ) to run through drawings without opening them in the editor.
[ http://www.theswamp.org/index.php?topic=29933.0 ]
-
If you set it up correctly, then you can use the code here ( link below ) to run through drawings without opening them in the editor.
[ http://www.theswamp.org/index.php?topic=29933.0 ]
great idea Tim.