
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
According to this http://adndevblog.typepad.com/autocad/2012/05/object-specific-context-menu-using-net.html article I tried to add context menu to my object:
ContextMenuExtension nodeContextMenu = new ContextMenuExtension();
....
Application.AddObjectContextMenuExtension(RXClass.GetClass(typeof(DBPoint)), nodeContextMenu);
Next, I found selected object:
private static ObjectId GetSelectedObject()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
PromptSelectionResultacSSPrompt = ed.SelectImplied();
if (acSSPrompt.Status != PromptStatus.OK)
return ObjectId.Null;
SelectionSetset = acSSPrompt.Value;
ObjectId[] ids = set.GetObjectIds();
if(ids.Length != 1)
returnObjectId.Null;
returnids[0];
}
Ok, I found it and tried to change properties of selected object:
using (Transactiontx = db.TransactionManager.StartTransaction())
{
DBPoint point = tx.GetObject(selectedObject, OpenMode.ForWrite) asDBPoint;
At this line Autocad has been crashed.
This line works if I open object ForRead, but I can't open it ForWrite or call
UpgradeOpen.
Is it possible to change object from context menu?
Thanks,
Pavel.
Solved! Go to Solution.