Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4131

Select mesh faces with naked edges, select vertices

$
0
0

My goal is to select all the vertices of each upper edge in a collection of meshes, so only the uppermost vertices that make up the top edge of a surface that is a mesh. My approach so far is to check which faces have naked edges. While trying to do this I ran into not being able to select them: this question is two-fold. How would I be able to select a mesh face from a mesh? A starter attempt below:

import Rhino as rh
import rhinoscriptsyntax as rs

def Selufaces():

arrObjs = rh.Input.RhinoGet.GetMultipleObjects("Select meshes",False,rh.DocObjects.ObjectType.Mesh)
for x in arrObjs[1]:
    rhino_object = x.Object()
    cind = rhino_object.SubobjectMaterialComponents
    faces = rhino_object.MeshGeometry.Faces
    
    for count,y in enumerate(faces):
        nface = rhino_object.MeshGeometry.Faces.HasNakedEdges(count)
        ftype = y.GetType
        fguid = ftype.DeclaringType.GUID
        rhino_object.SelectSubObject(cind, True, True)

I tried using the GUID to select the face using rs.SelectObject(fguid), but this throws an error as the GUID is not found in the document object list. Using subobjects throws an error that states I fed it an array. I’m assuming I’m doing something very simple in a stupidly complex manner?

Second, is there an easy way of selecting all of the vertices that I’m after? The ultimate goal is to use SetPt to set all of the vertices to a single z coordinate.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4131

Trending Articles