How to get the angle of a M-Text Entity

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
bladewilson000
Posts: 4
Joined: 13 Apr 2021, 13:09

How to get the angle of a M-Text Entity

Post by bladewilson000 » 13 Apr 2021, 13:21

There are some Rotated M-Texts and normal M-Texts in CADDimensions.

I tried to use ((CADMText)entity).Angle. The results are correct most of the time, but sometimes the result came back is 0 even if the M-Text looks rotated why?

I just wanted to get the angle between the M-Text and the horizontal line.Could someone please tell me how to handle this?

Thanks in advance.

support
Posts: 3253
Joined: 30 Mar 2005, 11:36
Contact:

Re: How to get the angle of a M-Text Entity

Post by support » 16 Apr 2021, 00:25

Hello,

Rotation may be defined by the second alignment point (CADMText.Point1). In such cases the rotation angle can be calculated using values of Point1 and CADMText.Extrusion.

Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

bladewilson000
Posts: 4
Joined: 13 Apr 2021, 13:09

Re: How to get the angle of a M-Text Entity

Post by bladewilson000 » 18 Apr 2021, 06:33

Hello,

Thanks for your reply. But I didn't understand what did you mean.

Can you explain some detail by example?

Here is an example:
There is a M-Text in dimension that I can tell is absolutely 90° rotated. But when I tried to get its Angle preperty, I got 0. Its Point1 and Extrusion Property are like below:
t.Point = new DPoint(5476.4619, -4169.2730, 0), t.Point1 = new DPoint(1E-16, 1, 0), t.Extrusion=new DPoint(0, 0, 1)

How can I get its real angle? it's a 2D drawing BTW.

Wu

bladewilson000
Posts: 4
Joined: 13 Apr 2021, 13:09

Re: How to get the angle of a M-Text Entity

Post by bladewilson000 » 18 Apr 2021, 09:19

Hi Mikhail,

I tried by myself and worked out with CADMText.Point1 and CADMText.Extrusion.

double radian = Math.Atan((mText.Point1.Y - mText.Extrusion.Y) / (mText.Point1.X - mText.Extrusion.X));
double angle = radian / (Math.PI / 180);

it retrieves the real angle of an M-Text whether the CADMText.Angle is effective or not.

Thanks very much, you are so pro.

Wu

Post Reply