Getting Brep or Mesh from instance block

Hello. I have some problem that I ran into recently. I am creating a plug-in for Rhino in which I need to get Brep or Mesh from objects in the scene. Objects for the plugin will not be created in Rhino, but in another program. As a result, when importing geometry into Rhino, I get one solid instance from which I cannot get either Brep or Mesh.

var brep = objRef.Brep ();
var mesh = objRef.Mesh ();
As a result, I only get null.
Using the standard Explode command, I can access the Brep and Mesh. Can I implement the logic of this command in my plugin to get the necessary data? Or are there easier ways to solve this problem?

I would be very grateful for any help))

I guess you’re looking for InstanceDefinition.GetObjects method.