MLeader and MText style
Hello All,
Im having an issue with creating a MLeader and setting the MText style. After creating the MLeader if we change the MLeader style the MText style doesnt update appropriately to match the default for the new MLeader style. I have a drawing attached showing the issue.
Also here is the code im using to generate the MLeader:
Im having an issue with creating a MLeader and setting the MText style. After creating the MLeader if we change the MLeader style the MText style doesnt update appropriately to match the default for the new MLeader style. I have a drawing attached showing the issue.
Also here is the code im using to generate the MLeader:
[CommandMethod("TestLabel")]
public void TestLabel()
{
using (Functions.Instance.doc.LockDocument())
{
using (Transaction tr = Functions.Instance.db.TransactionManager.StartTransaction())
{
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(Functions.Instance.db.CurrentSpaceId, OpenMode.ForWrite, false);
using (MLeader ml = new MLeader())
{
ml.ContentType = ContentType.MTextContent;
ml.MLeaderStyle = Functions.Instance.GetMLeaderStyleId(Configuration.Instance.RoofLabelMLeaderStyle);
//ml.SetFromStyle();
int leaderIndex = ml.AddLeader();
int ledearLineIndex = ml.AddLeaderLine(leaderIndex);
ml.AddFirstVertex(ledearLineIndex, new Point3d());
ml.AddLastVertex(ledearLineIndex, new Point3d(50, 50, 0));
MText mt = new MText();
mt.Color = ml.TextColor;
mt.TextStyleId = ml.TextStyleId;
mt.Contents = "Not Working";
ml.MText = mt;
ml.SetFromStyle();
btr.AppendEntity(ml);
tr.AddNewlyCreatedDBObject(ml, true);
tr.Commit();
}
}
}
}
0