Hi @f.kato,
Just after successfully getting the Box, you could use RhinoDoc.ActiveDoc.Objects.MostRecentObject(), which would be the box you just added, and then delete it using RhinoDoc.ActiveDoc.Objects.Delete()
I tried the way but the geometry box was not recognized by MostRecentObject().
VS2017 said it returned null.
I guess the geometry box is not on Rhinodoc because of not being instanced.
Do you know how to set geometry object on Rhinodoc?
I need the box remains invisible, so I do not use the line of
doc.Objects.AddBox(box).
Box is a Rhino.Geometry type. Unless you add it to the document using “doc.Objects.AddBox(box)”, it is not added to the document, so basically there is nothing to delete from the document.
If you want it in the document, then you can add it to the document, and to keep it invisible, you can use doc.Objects.Hide(). And then later delete it from the document.