GH_GeometricGoo: ReferenceID cannot be set

Hi All,

I am trying to a custom GH type based on GH_GeometricGoo<Brep>.
One problem that I found its ReferenceID cannot be set, when I try to pick up a referenced Rhino object.

Here is my example code:

 public HBRoom(Rhino.DocObjects.ObjRef objRef): this(objRef.Brep())
 {
      this.ReferenceID = objRef.ObjectId;
 }

ReferenceID is always Guid.Empty.

Could you please let me know if I am missing anything?
Thanks,

cc @DavidRutten

As you can see in the API:
“Gets or sets the Guid of the object that is referenced. Not all IGH_GeometricGoo implementations support referenced geometry. The default implementation is to always return Guid.Empty.”
https://developer.rhino3d.com/api/grasshopper/html/P_Grasshopper_Kernel_Types_GH_GeometricGoo_1_ReferenceID.htm

The default implementation returns Guid.Empty. If it return a default value, this surely does not have an internal variable to change/set. So, you have to override the property and manage it yourself.

Why not inherit from GH_Brep btw? It already has a constructor with an id as argument.

Thanks @Dani_Abalde, now I added a private field and override ReferenceID to make it work.

Inheriting from GH_Brep is the first thing I tried, but it always throws an exception about failed to cast gh objects, and cannot be addressed by overriding CastFrom() and CastTo()