Message 1 of 6
Not applicable
04-15-2014
10:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a command, it can group the selected objects, but it has some problem.
For example:
Select A B C entities, the first execution of the command, so these entities are gouped together after the first execution, then Select D E F entities and execute the command again, the result is D E F will be a group, but the A B C won't still be a group, I need the A B C keep the group still.
How should I modify the code so that it will maintain the original grouping after each time run this command?
There is a piece of code as follows
private void Group(Database acurrentDataBase, ObjectIdCollection entityObjectIdCollection)
{
//Grouping them
using (Transaction acTrans = acurrentDataBase.TransactionManager.StartTransaction())
{
DBDictionary DBDictionaryDataBase = (DBDictionary)acTrans.GetObject(acurrentDataBase.GroupDictionaryId, OpenMode.ForWrite);
Group groupObj = new Group("Test group", true);
DBDictionaryDataBase.SetAt("myGroupName", groupObj);
acTrans.AddNewlyCreatedDBObject(groupObj, true);
groupObj.InsertAt(0, entityObjectIdCollection);
acTrans.Commit();
}
}
Any help much appreciate, very thanks.
Solved! Go to Solution.