.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mirroring a Mleader

1 REPLY 1
Reply
Message 1 of 2
Anonymous
430 Views, 1 Reply

Mirroring a Mleader

Hi all,
I'm using the below code for mirroring a Mleader, it works but the issue is that the mleader's text to be mirrored.
I have tried setting system variable "MIRRTEXT" to zero but it still shows mirrored text.
Can somebody please help.
Thanks a lot

 

I'm using AutoCAD 2015 SP2.

Mleader mirroring.png

        [CommandMethod("MirrorMleader")]
        public void MirrorMleader()
        {
            Document doc = AcadApp.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            var result = ed.GetEntity(new PromptEntityOptions("\nSelect a mLeader: "));
            if (result.Status != PromptStatus.OK) return;

            if (result.ObjectId.ObjectClass != RXClass.GetClass(typeof(MLeader)))
                return;

            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                var space = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);

                var mleader = (MLeader)tr.GetObject(result.ObjectId, OpenMode.ForRead);
                Point3d sPt = mleader.GetFirstVertex(0);
                Line3d yAxis = new Line3d(sPt, sPt.Add(new Vector3d(0, 1, 0)));

                object mirrText = AcadApp.GetSystemVariable("MIRRTEXT");
                AcadApp.SetSystemVariable("MIRRTEXT", 0);

                MLeader clone = mleader.Clone() as MLeader;
                clone.TransformBy(Matrix3d.Mirroring(yAxis));
                space.AppendEntity(clone);
                tr.AddNewlyCreatedDBObject(clone, true);

                AcadApp.SetSystemVariable("MIRRTEXT", mirrText);
                tr.Commit();
            }
        }
1 REPLY 1
Message 2 of 2
tbrammer
in reply to: Anonymous

Try to modify the MLeader.MText property.

Either mirror it or change its Normal, Direction and Location.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost