Message 1 of 2
Not applicable
07-20-2015
01:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to write a method that prompts the user to pick a group and returns the ObjectId of the group so I can use it later. Right now that method looks like this:
public static ObjectId PromptUserForGroup() { using (Transaction tr = _database.TransactionManager.StartTransaction()) using (DocumentLock docLock = _activeDocument.LockDocument()) { PromptSelectionResult activeSelectionPrompt = _editor.GetSelection(); if (activeSelectionPrompt.Status == PromptStatus.OK) { ObjectId[] ids = activeSelectionPrompt.Value.GetObjectIds(); foreach (ObjectId id in ids) { Group groupToCheck = tr.GetObject(id, OpenMode.ForWrite) as Group; if (groupToCheck != null) { return groupToCheck.Id; } } } else { throw new IOException(); } return ObjectId.Null; } }
When I call the method it prompts the user like I want it to. However, when I pick the group it always returns ObjectId.Null meaning it isn't realizing I'm picking a group. I don't know what's wrong or how to fix it.
Solved! Go to Solution.