.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AutoCAD Character Codes In Text String

1 REPLY 1
Reply
Message 1 of 2
absStructural
748 Views, 1 Reply

AutoCAD Character Codes In Text String

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?

Tags (1)
1 REPLY 1
Message 2 of 2

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).

 

 

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost