Code Red > .NET

Rotating MLeader text to match UCS

(1/2) > >>

Atook:
I've got a routine inserting mleaders with text.

I want to be able to rotate the text on the mleader to match the UCS.

So far I've tried setting the rotation of the mtext object, .TransformBy, and .SetDogLeg with no results.


--- Code - C#: ---MLeader label = new MLeader();MText mText = new MText();//...label.MText = mText;//...// rotate the mtext to UCSVector3d xdir = (Point3d)Application.GetSystemVariable("UCSXDIR") - Point3d.Origin;double ucsRotation = Vector3d.XAxis.GetAngleTo(xdir, Vector3d.ZAxis);// this seems to be returning the correct angle // none of these work :(mText.Rotation = ucsRotation; // nope mText.TransformBy(Matrix3d.Rotation(ucsRotation, Vector3d.ZAxis, textPoint));  // nada int idx = label.AddLeaderLine(leaderPoint);label.SetDogleg(idx,xdir); // nothing 
What's the best way to accomplish this?

MickD:
Only guessing here but maybe you need to rotate the MLeader entity not just the MText?

Atook:

--- Quote from: MickD on October 20, 2016, 11:14:00 PM ---Only guessing here but maybe you need to rotate the MLeader entity not just the MText?

--- End quote ---

I thought the .SetDogLeg method might do that.

The leader part of the mleader is aligned like I want, I just need the text rotated so it's readable in the rotated view (UCS is set to view)

When done manually, I'm setting the rotation on the text part of the mleader in the properties dialog, so my guess was the the mtext is what needs adjusting. Hence the .Rotation and .Transform methods.

MickD:
That makes sense to change it in the properties after creation but on creation, the 'entity' itself (the MLeader) will be placed at the current ucs therefore all it's geometry will be placed at that ucs also, including MText. So, if you set the UCS of the MLeader object as you create it everything it owns should follow.

Another option maybe to set/return the UCS via sysvars in your routine.

SamR:
set label.MText = mText after mText.Rotation = ucsRotation

So
MLeader label = new MLeader()
MText mText = new MText()
mText.Rotation = ucsRotation
label.MText = mText


label.MText.Rotation doesn't work as expected

Navigation

[0] Message Index

[#] Next page

Go to full version