I am able to get the objectID of an Mleader object, but I have not found a way to get the actual style name of that Mleader object.
I do not want the current style name, but rather the actual style name of each Mleader that has been placed in the drawing.
Any ideas?
TIA
Solved! Go to Solution.
Solved by dan.glassman. Go to Solution.
Given that you have the ObjectId of an mleader...
Open that ObjectId and cast to MLeader. The MLeader.MLeaderStyle will get you the ObjectId of the style. Open that, cast to MLeaderStyle, and read the MLeaderStyle.Name property.
untested:
private void PrintMLeaderStyleName(ObjectId mleaderId) { Database db = mleaderId.Database; using (Transaction t = db.TransactionManager.StartTransaction()) { MLeader mleader = t.GetObject(mleaderId, OpenMode.ForRead) as MLeader; MLeaderStyle mleaderStyle = t.GetObject(mleader.MLeaderStyle, OpenMode.ForRead) as MLeaderStyle; Editor ed = Application.DocumentManager.GetDocument(db).Editor; ed.WriteMessage("that was a {0}.\n", mleaderStyle.Name); t.Commit() } }
Ahhhh... a property I wasn't looking for!
Thanks Dan! I have it working now!