How to select a subd vertex with python

Hi,
how can I select a subd vertex with python in rhino8?

import Rhino
import rhinoscriptsyntax as rs

def edit_subd_verts():
    filter = Rhino.DocObjects.ObjectType.SubD
    rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select SubD", False, filter)
    if not objref or rc != Rhino.Commands.Result.Success: return
    
    subd = objref.SubD()
    if not subd: return
        
    vertex1 = rs.get?????????

Hi @enzo_molinari,

A sample:

import Rhino

def test_subdvertex_faceat():
    filter = Rhino.DocObjects.ObjectType.MeshVertex
    rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select subd vertex", False, filter)
    if rc == Rhino.Commands.Result.Success:
        subd = objref.SubD()
        if subd:
            ci = objref.GeometryComponentIndex
            vtx = subd.Vertices.Find(ci.Index)
            if vtx:
                for fi in range(0, vtx.FaceCount):
                    face = vtx.FaceAt(fi)
                    if face:
                        print(face)

if __name__ == "__main__":
    test_subdvertex_faceat()

– Dale

2 Likes

Thank you for your help @dale!