I swore having dealt with this so many years when I had a better mousetrap I would post the code:
So the Code (Below?) substituted with REGEX:
Attribute VB_Name = "ACAD_TEXT" ''AutoCAD VBA 2010 ''Routine to strip formatting in ALL Autocad MTEXT (Translating Revit ''"text" to autocad drawings dumps as MTEXT with some odd formatting ''issues) try this: Option Explicit Sub Make_Mtext_StyleDependant() Dim oAcadObj As AcadObject Dim ObjBlock As AcadBlock Dim ObjBlocks As AcadBlockReference Dim ObjTxt As AcadMText Dim ObjAcad As AcadObject Dim x Dim re As New RegExp Set re = CreateObject("VBScript.RegExp") For Each ObjBlock In ThisDrawing.Blocks If InStr(1, LCase(ObjBlock.Name), "seal") < 1 Then ''don't mess with the seals! For Each ObjAcad In ObjBlock If InStr(1, LCase(ObjAcad.ObjectName), "mtext") > 0 Then Set ObjTxt = ObjAcad x = UnformatMtext(ObjTxt.TextString) ObjTxt.TextString = x End If Next ObjAcad End If Next ObjBlock End Sub Function ReReplace(str As String, pat As String, repl As String) As String Dim re As New RegExp Dim Found As Boolean Set re = CreateObject("VBScript.RegExp") re.IgnoreCase = False re.Pattern = pat re.Global = True Found = re.Test(str) ReReplace = re.Replace(str, repl) End Function Function UnformatMtext(S As String) As String ''https://forums.autodesk.com/t5/visual-basic-customization/mtext-format-codes/td-p/356713 Dim P1 As Integer Dim P2 As Integer, P3 As Integer Dim intStart As Integer Dim strCom As String Dim strReplace As String S = ReReplace(S, "\\A[012]\;", "") S = ReReplace(S, "\%\%P", "+or-") S = ReReplace(S, "\%\%D", "+or-") S = ReReplace(S, "\\P", Chr(10)) S = ReReplace(S, "\\[ACfFQTWHp].*?\;", "") S = ReReplace(S, "\\[LO].*\;", "") S = ReReplace(S, "\\[S](.*?)\;", "$1") S = ReReplace(S, "\\U2248", "ALMOST EQUAL") S = ReReplace(S, "\\U2220", "ANGLE") S = ReReplace(S, "\\U2104", "CENTER LINE") S = ReReplace(S, "\\U0394", "DELTA") S = ReReplace(S, "\\U0278", "ELECTRIC PHASE") S = ReReplace(S, "\\UE101", "FLOW LINE") S = ReReplace(S, "\\U2261", "IDENTITY") S = ReReplace(S, "\\UE200", "INITIAL LENGTH") S = ReReplace(S, "\\UE102", "MONUMENT LINE") S = ReReplace(S, "\\U2260", "NOT EQUAL") S = ReReplace(S, "\\U2126", "OHM") S = ReReplace(S, "\\U03A9", "OMEGA") S = ReReplace(S, "\\U214A", "PROPERTY LINE") S = ReReplace(S, "\\U2082", "SUBSCRIPT2") S = ReReplace(S, "\\U00B2", "SQUARED") S = ReReplace(S, "\\U00B3", "CUBED") S = Replace(S, "\\\~", " ") S = Replace(S, "\\", "\") UnformatMtext = S End Function
\fhelvetica lt com|b1|i0|c0|p2|;\W.8;?
Hi can someone help whats that context
Thanks
You can find a list of the format codes here.
the issue with a specific drawings. The text displays as "?" can't show properly inside the cloud in the attached drawing,
Tried installing the font still the issue persists.
tried the steps from the below knowledge base article, but still issue persists
I also installed the online-downloaded font that is below, but unfortunately this did not prevent the text from displaying "? " The font is attached for your reference.
Attaching the drawing file ,, please someone look into drawing and give me solution, whats inside that cloud with "?"
Thank you in advance
There's a missing xref that looks like it was from a Revit title block. So I would say that the Revit user used some codes that did not translate to AutoCAD or they used a character in a special font that is not present in the fonts that are currently used in the dwg. Or they literally used a ?. Anyway, from the dwg you sent, it's impossible to tell now. You would have to contact the original creator to find out what it is supposed to be. I didn't get any missing font errors, so maybe if you sent the file you got I could tell.
Thank you @Ed.Jobe for the insights on this. But the sources where I received the only this drawings. Also I don't have any other xref with me. Please let me know Is there a way to get rid of this error. I have tried all the above steps from knowledge articles I have shared in my original post. Thank you again for looking into the drawings.
Can you post the original dwg so that I can get the same error? I did not get any errors with the file you posted. I can't duplicate your problem, so at this point, all I can say is that the information is missing.
I cannot share the drawings on the public channel due to privacy and confidentiality concern. I'm really sorry for this. Please if you other alternates kindly suggest me.
If you edit the mtext and select all the contents, then right click and select Remove All Formatting, you will see that the contents are just a "?". You are missing information. It's possible that it was that way in the original Revit file. Drafters sometimes copy text that way, intending to come back and fix it later when they know what to use.
Thank you for very quick response. @Ed.Jobe
Exactly after removing formatting I still get "?". The original revit file may carry the missing information. Also with that revit file we cannot come an conclusion what's that content available. Is that correct @Ed.Jobe .please confirm.
Thank you @Ed.Jobe for your valuable inputs.
Yes, that's what I was saying. You need to look at the original file, even a pdf will do.
Thank you for re confirmation @Ed.Jobe . The sources I obtained the drawings are not ready to share any other information for me. This making to annoy a lot. But I still insists my sources to get pdf or revit drawings and check with it. Thank you for valuable feedback. Plea
It may be a special font or your font substitution file doesn't account for that font as well!
@WM_Ron_Allen Thanks, but I checked for that. Either the original Revit file contents was a "?" or the info was lost during export to dwg due to missing font/etc. The font specified in this uploaded file is just Helvetica.
@BhaskarMurari One of the texts has mtext formatting codes applied to the context, referencing time.shx. This is a standard font that ships with AutoCAD. If your pc was missing this font file, that would explain why you got errors. The rest of the fonts used by this file are Windows standard ttf files.
Try Arial - it is the most ubiquitous font followed by arial MT(The only font that shows up in schedules, text, tags, symbols) in revit and Autocad correctly. Also check the font substitute is available.
I suspect if you do a test with a sheet converted to arial the issue will subside.
Thank you @WM_Ron_Allen , I have changed to each and every font and font style available in AutoCAD, and also copied the drawings to new sheet and tested , what ever I do I ended with "?" .
@BhaskarMurari this may help. Note you may see formatting from the external editor as well. This may be picked up or ignored- guessing on the styles between the "|" Symbols...
@Ed.Jobe - the Autodesk reference is incomplete. The original mtext editor substituted those common codes with text for that reason : )
If you want to maintain consistency - I suggest turning off the external editor, using Autocad mtext out of the box, and if you have heavy formatting in text/documents; convert the text from E.G. Word to images or PDFs to link into pages to maintain sheets with heavy formatting.
A font defined in the inline Mtext is the most likely culprit. Stripping those out will do the trick.
One VBA I recall used a rich text box in a form to post and copy back from to break it back to the basic Bold/Italic/Underline and I think numbered and bullet lists.
Thank you @WM_Ron_Allen Please let me know how to do that trick. I am not aware of VB