Unable to cast Rhino Brep to GH_Brep

Hi, I am writing a custom class which implements GH_GeometricGoo. I am overwriting the CastTo method to cast to a Brep. First of all, it does not seem that GH_Brep is assignable from Brep. Secondly, if I change the type to GH_Brep it will not cast from Brep to GH_Brep. In the example code I have found the approach below should work or is there something I am missing?

//Cast to Brep.
            if (typeof(Q).IsAssignableFrom(typeof(Brep)))
            {
                if (Value == null)
                    target = default(Q);
                else if (Value.Shape == null)
                    target = default(Q);
                else
                    target = (Q)(object)Value.Shape;
                return true;
            }
1 Like

@Esbras I have the exact same question. Did you solve it? :pray: