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?
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
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.