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

Get style name of mleader

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Rob.O
574 Views, 3 Replies

Get style name of mleader

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

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Rob.O

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()
  }
}

 

 

Message 3 of 4
Rob.O
in reply to: Anonymous

Ahhhh... a property I wasn't looking for!

 

Thanks Dan!  I have it working now!

Message 4 of 4
Anonymous
in reply to: Rob.O

Quite welcome.

 

Cheers!

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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report