Is there a way to know the number of vertices present in a scene?

Hi, in a scene I can use the polycount command to know the number of polygonal triangles. I need to know the total amount of vertices present in the scene as well. Is there a way to get that info?
Regards.

i can get you close to the number in case you use mesh. i dont see anything which fulfills your exact wish… anyway on a single object you can call up the object properties or use what to display it, that works also on polysurfaces of course, selecting all objects lists up the vertices and polygons of each object separately.

using ReduceMesh at least gives you a number count which is only slightly less then the vertices i have no idea how this is calculated but its not the number of polygons but rather represents the number of vertices. that also works on all mesh objects in a scene which are not connected.

edit: well it seems my test object had unwelded polygons which seems to make it similar to the vertices, welding them displays the polygon count aftewards. so in case you have a welded object you can use unweld and then use reduce mesh to get close to the vertices.

1 Like

This might work:
Create a new layer and make it current
ExtractPt,make sure select OutputLayer=Current, select the mesh,enter
A point is created for each vertex. The command line will show how many points were created.
Delete the layer with the points

1 Like

If it is for only one object you can use the command What. The dialog that pops up will tell you the vertex count for the render mesh. You can do it for the entire scene too, but then there is no total amount, you have to tally yourself.

1 Like

The following scriptlet will get you the total number of meshes in the scene (they must be unlocked and visible) with the total number of vertices. It it of course possible to do it in more detail and output a text list with statistics for each mesh…

import rhinoscriptsyntax as rs

meshIDs=rs.ObjectsByType(32,state=1)
if meshIDs:
    t_count=0
    for meshID in meshIDs:
        mesh=rs.coercemesh(meshID)
        t_count+=mesh.Vertices.Count
    print "Found {} meshes with {} total vertices".format(len(meshIDs),t_count)
else: print "No meshes found"

–Mitch

1 Like

You probably could improve by creating meshes for any object if it hasn’t already such that you get total vertices of everything, not just mesh objects. Essentially getting render meshes from everything that can have one.

1 Like

Yep, certainly lots of things that can be done, but I wasn’t sure what the OP really needs, so I went with the minimum for now. --Mitch

2 Likes

Hi, thanks for all the responses. Mitch sorry for my late reply. Your script works great for meshes. Will be handy in future.

In Turbosquid, Even when I chose the geometry type as NURBS. they want to know the amount of polygons and vertices present in the scene.

I don’t think NURBS have any polygon or vertices. Do they?

Correct, but usually there is a ‘render mesh’ and/or ‘analysis mesh’ associated with surface objects in Rhino, used in shading/rendering the scene or of false color analysis modes like Zebra.

-Pascal

1 Like