Running into troubles with programatically created MLeaders.
If the angle is right to left, the leader will cross over the text, which I'm trying to avoid.
If the user grip edits the leader, it corrects it's self automatically. I can't use MgdDbg snoop to look for changes between the two, because it crashes on MLeaders for some reason
Leader creation code:
// create the MLeader
MLeader label
= new MLeader
();label.SetDatabaseDefaults();
label.ContentType = ContentType.MTextContent;
label.Layer = layerName;
int ldNum = label.AddLeader();
int idx = label.AddLeaderLine(ldNum);
label.AddFirstVertex(idx,leaderPoint);
#if ACAD_APP
label.AddLastVertex(idx, textPoint);//<-needed for AutoCAD, crashes BricsCAD
#endif
label.SetLastVertex(idx, textPoint);
// new Mtext for the text
MText mText
= new MText
();mText.SetDatabaseDefaults();
mText.Contents = labelString;
mText.Rotation = rotation;
mText.TextHeight = textHeight;
mText.TextStyleId = Styles.GetTextStyleID(AID_Strings.PipeSizeTextStyle);
mText.SetAttachmentMovingLocation(AttachmentPoint.MiddleCenter);
label.MText = mText;
// add the mleader to currspace
BlockTableRecord curSpace =
(BlockTableRecord)tr.GetObject(Active.Database.CurrentSpaceId, OpenMode.ForWrite);
curSpace.AppendEntity(label);
tr.AddNewlyCreatedDBObject(label, true);
I've looked in the MLeader events for a refresh method or something to call, but can't find anything.
In the attached sample drawing, both leaders were created with code, the lower leader was just grip edited.
Any ideas?