CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.092.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator. New AutoCAD 2026 commands and variables.
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

?
CAD discussions, advices, exchange of experience

CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search Search  Events Events  Register Register  Login Login

Topic ClosedHelp for reading MTEXT of DXF file

 Post Reply Post Reply
Author
Harbin View Drop Down
Newbie
Newbie


Joined: 24.Jan.2011
Location: United States
Using: AutoCad2008
Status: Offline
Points: 3
Direct Link To This Post Topic: Help for reading MTEXT of DXF file
    Posted: 24.Jan.2011 at 19:57

Can anyone help for reading DXF MTEXT file? When dxf file is opened by notepad, MTEXT block is as following.

MTEXT
  5
430
102
{ACAD_XDICTIONARY
360
78D
102
}
330
1F
100
AcDbEntity
  8
TEXT
100
AcDbMText
 10
5.704296354278894
 20
4.855478660749818
 30
0.000000000024344
 40
0.0625
 41
1.0
 71
     1
 72
     5
  1
{\W5.6142;  }Starts From \P{\W6.96748; }INDICATOR ABC
 73
     1
 44
1.0
1001
ACAD
1000
MTEXTBEGIN
1070
    73
1070
     1
1070
    44
1040
1.0
1070
    74
1070
     0
1000
MTEXTEND
 
Here is the issue:
group code 71, 1 means this MTEXT is aligned at Top Left.
But actually this MTEXT is aligned at Center. When I open this file by AutoCAD, the contents of property start with "\pxqc;". I think it means "align center" and these special characters are not shown when openning by notepad. So, {\W5.6142;  } must be related to "\pxqc;".
 
Can anyone help to find the actual MTEXT starting location by using:
10
5.704296354278894
 20
4.855478660749818

 1
{\W5.6142;  }Starts From \P{\W6.96748; }INDICATOR ABC
Thank you very much, any help is appreciated.
 
Harbin
Back to Top
CarlB View Drop Down
Senior Member
Senior Member


Joined: 16.Oct.2009
Location: United States
Status: Offline
Points: 321
Direct Link To This Post Posted: 24.Jan.2011 at 22:53
Well 10 & 11 are supposed to be X & Y values of insertion point.
Value of 1 for code 71 is supposed to be Top left justification. So I don't see anything to explain why you found different justification..
 
 
Here are some mtext formatting codes that may expalin some things:
Format code        Purpose                                                                
\0...\o            Turns overline on and off
\L...\l           Turns underline on and off
\~                        Inserts a nonbreaking space
\\                          Inserts a backslash
\{...\}               Inserts an opening and closing brace
\File name;    Changes to the specified font file
\Hvalue;            Changes to the text height specified in drawing units
\Hvaluex;          Changes the text height to a multiple of the current text height
\S...^...;       Stacks the subsequent text at the \, #, or ^ symbol
\Tvalue;            Adjusts the space between characters, from.75 to 4 times
\Qangle;            Changes obliquing angle
\Wvalue;            Changes width factor to produce wide text
\A                          Sets the alignment value; valid values: 0, 1, 2 (bottom, center, top)

Note: Use curly braces ({ }) to apply a format change only to the text within the braces. You can nest braces up to eight levels deep.
Back to Top
Harbin View Drop Down
Newbie
Newbie


Joined: 24.Jan.2011
Location: United States
Using: AutoCad2008
Status: Offline
Points: 3
Direct Link To This Post Posted: 25.Jan.2011 at 07:52

Hi CarlB,

 

Thank you for your reply. Actually I am C# programmer and know only a little about AutoCAD.

Just like you said: Code 71 =1 means Top Left justification. But, do you know what {\w5.6142;} means?

 

When I open that DXF file in AutoCAD and check the property of that particular MTEXT part:

Contents : \pxqc;Starts From\P and so on.

Justification: Top Left   ---- this matches code 71=1

 

When I click the particular MTEXT ( for modification purpose???, I can modify the MTEXT contents), I found “Align Center ” is selected in the pop-up window(text editing window?). I tried to select “Align left” in that pop-up window. The contents of MTEXT property changed to “\pxql;Starts From\P and so on.

 

When I open that DXF by notepad, code 1 contents start with {\w5.6142;}. So, I said {\w5.6142;} was related to \pxqc; . Do you have any idea about it?

 MTEXT top left coordinate can be retreived from code 10 and 20. Since the actual justification is top center, the value {\w5.6142;} should be used to move text contents to right a little bit. I tried to add 5.6142 to x coordinate. It was incorrect.
 
Please forgive me my unprofessional terminology. I hope you can understand what I am trying to explain. Maybe I need to provide some screen shots.
 
TIA.
 
Harbin

 



Edited by Harbin - 25.Jan.2011 at 07:54
Back to Top
CarlB View Drop Down
Senior Member
Senior Member


Joined: 16.Oct.2009
Location: United States
Status: Offline
Points: 321
Direct Link To This Post Posted: 25.Jan.2011 at 08:28
The \Wnnn is format code for adjusting the width factor.
The \pxnnn is format code for different paragraph formatting, such as centered, right/left justify, etc.
See this site for some examples:
 
It would be tough to figure actual text location after considering justification (71 code), text reference rectangle width (41 code), then paragraph formatting...
Back to Top
Harbin View Drop Down
Newbie
Newbie


Joined: 24.Jan.2011
Location: United States
Using: AutoCad2008
Status: Offline
Points: 3
Direct Link To This Post Posted: 25.Jan.2011 at 17:03
Thanks anyway.
 
Looks like it is hard to calculate the acutual TEXT starting coordinates.
{\w5.6142;  }: insert two spaces with width value 5.6142 ? But the reference rectangle width is only 1.0.
 
Here is my solution:
If contents start with "{\w", change the justification of this TEXT to (Top/Middle/Bottom) Center.
 
CarlB, do you think it is going to work?
Thanks again,
 
Harbin
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,157 seconds.