Text used for context of MLeader does not annotate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I run into a problem creating an annotative MLeader with MText context . I am using a dialog box to construct the string, set the MLeader Style and layer on which to put my Mleader. The problem arises when the MLeader Style uses annotative Text Style, the MText doesn’t annotativly scales to the correct size, compared to creating the MLeader with the toolbar button. It seems to work fine if the Text Style is not annotative. I tried to make the MLeader Style and MText Style current so the newly created objects inherit the correct defaults, but this did not help.
Is it better to just change the MLeader Style of the Mleader object and MTex style of the mtext object, instead of making these style current and creating the objects.
In addition, I set the annotative property of the MText object to true and still without success.
if (mldTextStyle.Annotative == AnnotativeStates.True)
{
mtxt.Annotative = AnnotativeStates.True;
}
mtxt.TextHeight = mldTextStyle.TextSize;
Any ideas will be greatly appreciated.
This is the code which sets the current MLeader style to the one chosen by the user, current MText Style to the one used in the MLeader Style, and creating MLeader and MText.
DBDictionary mldict = trans.GetObject(db.MLeaderStyleDictionaryId, OpenMode.ForRead) as DBDictionary;
db.MLeaderstyle = mldict.GetAt(settings.MultileaderStyle);
MLeaderStyle mldStyle = trans.GetObject(db.MLeaderstyle, OpenMode.ForRead) as MLeaderStyle;
MLeader mld = new MLeader();
mld.SetDatabaseDefaults();
mld.Layer = settings.Layer;
mld.LeaderLineType = LeaderType.StraightLeader;
mld.AddLeader();
mld.AddLeaderLine(0);
mld.AddFirstVertex(0, ptFirst);
mld.AddLastVertex(0, ptSecond);
mld.EnableDogleg = true;
mld.EnableLanding = true;
mld.DoglegLength = mldStyle.DoglegLength;
mld.LandingGap = mldStyle.LandingGap;
if (ptFirst[0] > ptSecond[0])
{
mld.SetDogleg(0, new Vector3d(-1, 0, 0));
}
db.Textstyle = mld.TextStyleId;
MText mtxt = new MText();
mtxt.SetDatabaseDefaults();
mtxt.Contents = cunstructText();
TextStyleTableRecord mldTextStyle = trans.GetObject(mld.TextStyleId, OpenMode.ForRead) as TextStyleTableRecord;
if (mldTextStyle.Annotative == AnnotativeStates.True)
{
mtxt.Annotative = AnnotativeStates.True;
}
mtxt.TextHeight = mldTextStyle.TextSize;
mld.ContentType = ContentType.MTextContent;
mld.MText = mtxt;
I would also be greatfull for any suggestions how to optimize the above code.
Thank you.