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.
How to get the angle of a M-Text Entity
Moderators: SDS, support, admin
Re: How to get the angle of a M-Text Entity
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
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
Chat support on Skype: cadsofttools.support
-
- Posts: 4
- Joined: 13 Apr 2021, 13:09
Re: How to get the angle of a M-Text Entity
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
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
-
- Posts: 4
- Joined: 13 Apr 2021, 13:09
Re: How to get the angle of a M-Text Entity
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
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