Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Replace part of Mtext with different font

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
AirportT1
956 Views, 8 Replies

Replace part of Mtext with different font

Dear CAD experts,

 

I'm relatively new to AutoCAD, and am still in a constant state of wonder at all the possibilities. However, for a current assigment my employer has a question I, uptill now, have been unable to answer, and I'm hoping someone here might know.

 

I export a number of annotations from a GIS environment to a DWG. There I change them from single- to multiline texts with the custom lisp TXT2MTXT. So far, so good. However, in the GIS data the text is formatted in two different fonts; Arial for readable text and Windings for a symbol or two. In the DWG, all text is representated with one font, giving us characters such as ä and ã where we would expect symbols. Individually selecting the text parts and formatting them to Windings again is not difficult, but very time consuming. So, what I'm looking for is a combination between the Find and Replace function, together with formatting to a different font.

 

Anybody got a suggestion? A tip, a trick, a lisp, anything! Thanks!

8 REPLIES 8
Message 2 of 9
doni49
in reply to: AirportT1

can you post a dwg file that contains two pieces of text:

 

One showing what you're getting and the other showing what you want. 

 

I *think* it should be fairly simple to do via autolisp.  But I need to know what to search for and what to replace it with.



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 3 of 9
doni49
in reply to: AirportT1

This should do what you need.  Since there are multiple things that you need to convert to wingdings, you'll have to run the command multiple times.

 

It will prompt you for a search string and then for the mtext elements you want to update.  Then it will search through those mtext elements and change every instance of that character to wingdings.

 

So the first time you run it, give it ä as the search string and the second time give it ã.

 

I've also attached the dwg that I used to test this (in 2012).

 

EDIT:  Here's a screenshot of my dwg.  The first line shows what the mtext looks like before and the second line shows what it looks like after running the command twice.

 

FixTxt.png

 



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 4 of 9
doni49
in reply to: doni49

I found out after trying to post, that the site doesn't allow lsp files to be attached (I could swear I've done it before).

 

I renamed it as a zip file.  Download it but save it with an LSP extension (do NOT try to open it like a zip file).

 



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 5 of 9
AirportT1
in reply to: AirportT1

Don, you're a lifesaver! Works like a charm, well done, sir!

Message 6 of 9
doni49
in reply to: AirportT1

Glad to help. 

 

I just realized one thing this morning that I should tell you.  If there is more than one instance of the search string within the same mtext element, then only the first instance will get changed.

 

So if you you have ABCABCABC and you tell it to change C then only the first C will be changed the other will not.

 

Unless you know each mtext element only has one instance of the errant character(s)m you might want to run the command a few times.



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 7 of 9
LyleHardin
in reply to: doni49

This is great Don!

 

I've found it works well for replacing the ISOCPEUR font that Autodesk uses for Symbols in AutoCAD.

We have moved to Arial instead of Romans for our standard font, so special symbols look crappy now.

I figured I'd mention it here because there are lots of people looking for a similar answer in many other threads.

 

I used your code (hope that's okay with you...) and replaced (hard coded) the user input with "\U+2104" (for centerline symbol) or "\U+214A" (for Property Line) and instead of using WINGDINGS for the replacement font, I used Romans_IV25.

Now I can just pick on text that contains those pesky tiny symbols and viola! they are replaced with a bigger version.

I've incorporated FixTxt-CL and FixTxt-PL into our menus.

 

Thanks!

 

Lyle

Message 8 of 9
doni49
in reply to: LyleHardin


@Anonymous wrote:

This is great Don!

 

I've found it works well for replacing the ISOCPEUR font that Autodesk uses for Symbols in AutoCAD.

We have moved to Arial instead of Romans for our standard font, so special symbols look crappy now.

I figured I'd mention it here because there are lots of people looking for a similar answer in many other threads.

 

I used your code (hope that's okay with you...) and replaced (hard coded) the user input with "\U+2104" (for centerline symbol) or "\U+214A" (for Property Line) and instead of using WINGDINGS for the replacement font, I used Romans_IV25.

Now I can just pick on text that contains those pesky tiny symbols and viola! they are replaced with a bigger version.

I've incorporated FixTxt-CL and FixTxt-PL into our menus.

 

Thanks!

 

Lyle


Of course you can use it as you see fit.  I'm glad to hear you found it helpful.



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 9 of 9
LyleHardin
in reply to: doni49

Thanks.

I did have to do a little more tweaking to replace the symbols in MLeaders as well as Mtext, but it should certainly help quell my users' complaints.

You should tweak it a bit youself and publish it to Exchange Apps. It would help the masses until Autodesk comes up with some system variable to give users a choice of font to use for symbols.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost