activeDoc.Objects.Delete doesn’t work

activeDoc.Objects.Delete(object1, true, true);

In my active doc I have two breps. On the one with object1 as rhinoobject , I have done some transformations and prepared a new brep from it. I want to keep the transformed brep and delete the old brep. But its not working. Ay idea why?

Hi @Rushank ,

we would probably need more information to get to the bottom of why it does not work the way you want it to work. However, from your description of the problem it seems like you actually want the Replace method:

https://developer.rhino3d.com/api/rhinocommon/rhino.docobjects.tables.objecttable/replace

Check out all of the constructors (it has like 39 of them) to find the one you need. For example:

Boolean Replace(
Guid objectId,
Brep brep
)