Welding and Normals / Rhinocommon

Hi,

I have a mesh, a box, which has 6 independent quad faces / 24 vertices.
I want to reduce it to 8 vertices and have that box looking like the original.
Is there a way to keep flat shading (normals) after welding all vertices ?

I use Mesh.Vertices.CombineIdentical. But If I understand Rhino structure, it seems unlikely to both reduce vertices and keep normals like I could do in Max or Blender.

Regards

I think you can reduce it to 24 vertices, 4 for each of the 6 faces. Then you can assign normals to each vertex according to its face orientation. It is not possible to reduce the vertices further without averaging normals on a vertex. The length of the vertex array and the vertex normal array must be the same.

If you want just 8 points, use Mesh.TopologyVertices instead of Mesh.Vertices.
Nothing forbid you to make a component that outputs Mesh TopologyVertices, the mesh face connection with Topology vertices and also have the “classical” vertices, normals …

My bad. I already have 24 vertices.
Thank you.

Hi,
Could you give me more details about what is a “component” ?

Regards

I mean a C# component or Python.

Hi @lahos,

This appears to work:

import Rhino

point0 = Rhino.Geometry.Point3d.Origin
point1 = Rhino.Geometry.Point3d(10, 10, 10)
bbox = Rhino.Geometry.BoundingBox(point0, point1)
box = Rhino.Geometry.Box(bbox)
mesh = Rhino.Geometry.Mesh.CreateFromBox(box, 1, 1, 1)
print("Vertex count: {0}".format(mesh.Vertices.Count))
mesh.Vertices.CombineIdentical(True, True)
print("Vertex count: {0}".format(mesh.Vertices.Count))

– Dale

Hi @dale,

I know CombineIdentical works but as soon it is converted to rhinoobject,
I can’t make faces look flat again.