.NET

.NET

Reply
Active Contributor
absStructural
Posts: 37
Registered: ‎07-15-2010
Message 1 of 2 (267 Views)

AutoCAD Character Codes In Text String

267 Views, 1 Replies
11-23-2013 06:20 AM

I'm experiencing some inconsistent behavior with text (normal text, mtext, text in a table) and character codes.  I'll provide some examples of what I'm seeing... and hopefully someone can help me to understand what's going on.

 

We use a customized shx font that has stacked fractions in sixteenth increments from character 181 to 195 (1/16 to 15/16).  So, when entering 1/16, a user would typically type %%181 as the text value, and AutoCAD displays the correct stacked fraction.  This works in normal text, but not in mtext or in a table.  With mtext or a table, I can copy and paste character 181 (for instance) - which looks like [ µ ] - and the correct stacked fraction will show up.  Surely there is a way to do this without copy and paste, but I haven't gotten that far.

 

Ok, so - you're probably wondering why I am writing this in the .NET forum.  Well, here is where some code comes in.

 

With normal text, I can set DBText.TextString = "%%181".  This will display the correct stacked fraction (1/16).  If I then retrieve the text again - string myText = DBText.TextString), the value is as expected - "%%181".

 

BUT

 

If a user types "%%181" in a piece of text, and then I read the piece of text, the value is character 181.  This was not the case in AutoCAD 2006, where TextString would still reflect "%%181" - behavior that (to me) made sense, because it was consistent.

 

All of this becomes a problem when programmatically parsing text.  Sometimes it has %%[character code], and sometimes it has the character.

 

Can someone please shed some light on this?

Active Contributor
absStructural
Posts: 37
Registered: ‎07-15-2010
Message 2 of 2 (253 Views)

Re: AutoCAD Character Codes In Text String

11-23-2013 08:37 AM in reply to: absStructural

I should also note - that a significant problem is that we are currently still using AutoCAD 2006.  The ObjectArx code written for it doesn't use unicode.  When a drawing is made with AutoCAD 2012, saved to an older format, and opened in AutoCAD 2006 - the ObjectArx code is reading single byte chars, but AutoCAD 2012 has written multibyte chars.

 

Somehow AutoCAD 2006 is displaying them properly.  The ObjectArx code reading single byte chars isn't handling it so well (obviously).

 

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.