Sub-object vbscript

in Vbscript
how to use GetObject to select the surface from polysurface, or other sub-object

I’m afraid you can’t with VBScript, none of the subobject selection methods are exposed yet. The only way I know of to get to a sub-surface with scripting is with Python and RhinoCommon. Otherwise, the common workaround is to explode a copy of the polysurface in question, isolate the surface(s) you need, and throw away the rest…


Below is an example with Python… --Mitch

import Rhino, scriptcontext
import rhinoscriptsyntax as rs
#Example adapted from Python forum post, thanks to Vittorio and Emilio

def DuplicateBRepSrfs():
    prompt="Select BRep surface(s) to duplicate"
    rc, subsurf_refs = Rhino.Input.RhinoGet.GetMultipleObjects(prompt, True, srf_type)
    if rc != Rhino.Commands.Result.Success: return
    if subsurf_refs:
        #breps will contain the duplicate surface *geometry*
        for srf in subsurf_refs:
    #if you actually want to add the objects to the document:
    dupsrf_IDs=[scriptcontext.doc.Objects.AddBrep(brep) for brep in breps]

Thanks for help

It is also worth noting that the GetObject function in rhinoscriptsyntax does support subobject selection (note the subobjects optional parameter in the function)