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,
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()