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];
doc.Groups.Delete(Index);
}
}
Any Help would be great. I’ve searched in forum.
Go easy on me. I’m just a Brick Layer addicted to Rhino.
Rhino V5
RhinoCommon
C#
Thanks’ Dale
. I didn’t realize this. I thought I was using the wrong method or Table.
The Documentation shows:
GroupTable.Delete Method
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.
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 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.
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.
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.
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.