I know I am making this harder than it is.
Probably would be better just to create one wipeout, but for starting out just trying to get the bounding box for each fragment.
Am I correct assuming this?
MTextFragment.Location will give me the bottom left corner of the fragment.
I have the direction from MTextFragment.Direction
I have the distance in X and Y diretion with MTextFragment.Extents.X & MTextFragment.Extents.Y
What is the eaiset way to get the four corners or bounding box.
I am drawing a blank but I thought with direction vector and distance I could find the 3 other points?
Would it be easier to get the botttom 2 then move them a distance with MTextFragment.Extents.Y or MTextFragment.CapsHeight?
For starters here this will just get the bottom left.
[CommandMethod("ExplodeFragments")]
static public void ExplodeFragments()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
PromptEntityOptions peo = new PromptEntityOptions("\nSelect a Mtext");
peo.SetRejectMessage("\nSelect only Mtext");
peo.AddAllowedClass(typeof(MText), false);
PromptEntityResult per = ed.GetEntity(peo);
if (per.Status != PromptStatus.OK)
return;
using (Transaction trx = db.TransactionManager.StartTransaction())
{
MText text = trx.GetObject(per.ObjectId, OpenMode.ForRead) as MText;
text.ExplodeFragments(Fragments);
trx.Commit();
}
}
static public MTextFragmentCallbackStatus Fragments(MTextFragment frag, object data)
{
createWipeOut(frag);
return MTextFragmentCallbackStatus.Continue;
}
static void createWipeOut(MTextFragment frag)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
Point3dCollection pnts = new Point3dCollection();
pnts.Add(frag.Location);
foreach (Point3d pnt in pnts)
{
ed.WriteLine(pnt.ToString());
}
}