Rhino.Geometry.SubD.ToBrep() not found

I’m running into a problem related to SubD.ToBrep() in Rhino 7, which I couldn’t solve myself: My code builds without errors, but when I run it I’m getting a System.MissingMethodException:

System.MissingMethodException: 'Method not found: “Rhino.Geometry.Brep Rhino.Geometry.SubD.ToBrep()”

This happens for Rhino 7.0.20314.3001, 11/09/2020, the latest available version.

The idea is to create a Brep which can then be meshed. I guess there must be a better way to get a mesh from a SubD object, without having to convert to a Brep first?

Try Mesh.CreateFromSubD()

The SubD.ToBrep() method is not a static method, it needs to be called with an instance of SubD.like this

:man_facepalming: many thanks for the hint about Mesh.CreateFromSubD(), that solved my issue

However about SubD.ToBrep() (which I didn’t try to call statically), there is still an issue in RhinoCommon as it seems, because the method signature as shown by VS is this:

        // Summary:
        //     Create a Brep based on this SubD geometry.
        // Returns:
        //     A new Brep if successful, or null on failure.
        public Brep ToBrep();

However this method doesn’t seem to exist, and I can confirm that it doesn’t show up in Grasshopper’s scripting component as well (the one you referred to above however does exist, using SubDToBrepOptions).

This looks like a version mismatch between your docs and RhinoCommon version. I get the correct signature for SubD.ToBrep(...) in the metadata of RhinoCommon.dll, in the same version you cite (7.0.20314). The online help also shows the up-to-date signature: https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_SubD_ToBrep.htm

This prompted me to open an issue for SubD.ToBrep(), with default options: https://mcneel.myjetbrains.com/youtrack/issue/RH-61886