I’m using doc.Group.Delete in my plug-in. After this command runs and I use “Undo” the groups are still deleted, but everything else is undone.
//test for group and if true, Delete all of PointOnObject's groups.
if (gp1.PointOnObject().Object().GetGroupList() != null)
int groupArray = gp1.PointOnObject().Object().GetGroupList();
for (int i = 0; i < groupArray.Length; i++)
int Index = groupArray[i];
Any Help would be great. I’ve searched in forum.
Go easy on me. I’m just a Brick Layer addicted to Rhino.
Groups are no undo-tracked.
Is there a particular problem you are trying to solve?
. I didn’t realize this. I thought I was using the wrong method or Table.
The Documentation shows:
Deletes a group from this table.
Deleted groups are kept in the runtime group table so that undo will work with groups. Call IsDeleted() to determine if a group is deleted.
“Runtime” must refer to command runtime?
What is call .IsDelete() used for?
I’m using ObjectTable.FindByWindowRegion, but if Objects are grouped and one is outside of Region and one inside, neither are returned. I can live without undo of deleted Group.
Thank you again for a quick response.
No fault of yours - the document isn’t correct. I’ll see to fixing this in Rhino 6.
When you delete a group, any member objects are removed and then the group is marked as deleted. When you save 3dm files, stuff marked as deleted is not saved.
Perhaps you should use
FindByCrossingWindowRegion instead? Or, iterated the objects returned by
FindByWindowRegion, get their groups and, subsequently, the group objects.
I strongly suggest Groups should support undo.
I create a set of objects in a command and then group them.
when the command is undone, I expect the document to be in previous state.
otherwise the groups are invalid.
If doc.objects are undone, why not doc.groups…
I would appreciate if this is implemented.
I’m confused. Try this:
1.) Use the
Group command to group some objects
2.) Use the
Ungroup command to ungroup the objects
3.) Use the
Undo command to undo the un-grouping
4.) Notice how the objects are grouped.
What am I missing?
in a run command, create objects (say 5) and group them.
[view has 5 objects created and grouped]
Undo the run command.
I would expect the objects and group to be removed from the document.
The objects are not present in doc.objects
But the Group is still present in doc.Groups.
the IsDeleted property too is false which makes it that the group is still valid even though the creation of the group was undone.
hope I am clear.
This this causing a problem, by not removing them?
Command A: creates objects and groups them.
Command B: deletes the objects and the group.
When command B is undone, I need the grouping of members back.
This is not the current case.
How do I achieve this?
Can you provide the code behind your
Command A and
Command A: SampleGroupAdd
Command B: SampleGroupRemove
Run command A and then command B.
Undo command B.
The objects are back but they are not grouped
SampleGroup.cs (2.1 KB)
Like I mentioned above, Groups are not undo-tracked. Thus, if you want to delete grouped objects and then run Undo and have the objects re-grouped, do not delete the group.