Model Surface being read as Model Brep

Hi,

I have a Model Object who’s geometry is a surface. For some reason the object is called a Model Brep. When I deconstruct the object to get a surface and construct a new Model Object I get a Model Surface. I’m assuming this is a bug?

Version 8 SR21
(8.21.25168.13001, 2025-06-17)

model surface issue.gh (47.8 KB)

it’s weird because if I bake the content of the initial Data and re-reference it to the appropriate Model Object Parameter, it’s indeed recognized as Model Surface

where does that Data initial parameter come from, in terms of where does it gather its content from?

I think I found the culprit

Extrude seems to create a surface that is being read as a brep unless I specifically cast it to a surface param. I guess something strange is happening under the hood with the extrusion class?
extrusion creates model brep.gh (29.7 KB)

please note that all parameters in grasshopper are casted nearly all time / at every input.
and … if you plug a wire to a panel - a “toString()” override is called (implicit or explicit)…

if you add an object to the document, also some tests are performed…

private void RunScript(object x, ref object a, ref object b, ref object c)
    {
        a = null;
        b = null;
        c = null;
        // Write your logic here
        string info = $"GetType: {x.GetType()}";
        if (x is Grasshopper.Rhinoceros.Model.ModelObject modelObj)
        {
            info = info + System.Environment.NewLine + $"ObjectType: {modelObj.ObjectType}";
            info = info + System.Environment.NewLine + $"TypeName: {modelObj.TypeName}";
            Brep brep;
            Surface srf;
            if (modelObj.CastTo<Brep>(out brep))
            {
                info = info + System.Environment.NewLine + $"...is a brep with {brep.Faces.Count} faces";
                info = info + System.Environment.NewLine + $"...is a brep with {brep.Edges.Count} edges";
                info = info + System.Environment.NewLine + $"...is a brep with {brep.Curves3D.Count} curves 3d";
                b = brep;
            }
            if (modelObj.CastTo<Surface>(out srf))
            {
                c = srf;
            }
        }
        a = info;
    }

… your data can be casted to both - a Surface and a Brep with 1 Face.

model surface issue_tp.gh (46.9 KB)

see also - should be possible to create a brep, that is a single surface / extrusion:
https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.brepface/createextrusion

… and adding objects to the doc - some checking / adaption be be taking place.

splitKinkySurfaces

for AddBrep for example

1 Like

Extrusions caused a few headaches in the recent past indeed :+1:

https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.extrusion?version=8.x#constructors