How can I create hyperlink for View (View Manger - View of This Drawings) ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
[CommandMethod("createHLink")]
static public void CmdCreateHyperLink()
{
Editor ed = Application.DocumentManager.
MdiActiveDocument.Editor;
Database db = Application.DocumentManager.
MdiActiveDocument.Database;
PromptEntityResult selectedEntity =
ed.GetEntity("Please Select an Entity: ");
ObjectId objectId = selectedEntity.ObjectId;
try
{
using (Transaction trans =
db.TransactionManager.StartTransaction())
{
//Get the entity
Entity ent = trans.GetObject(objectId,
OpenMode.ForWrite) as Entity;
//Get the hyperlink collection from the entity
HyperLinkCollection linkCollection = ent.Hyperlinks;
//Create a new hyperlink
HyperLink hyperLink = new HyperLink();
hyperLink.Description = "A1";
hyperLink.Name = "A1";
hyperLink.SubLocation ="";
//Add the hyperlink to the collection
linkCollection.Add(hyperLink);
trans.Commit();
}
}
catch (System.Exception ex)
{
ed.WriteMessage(ex.Message);
}
}