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

Find polysurface guid from sub-surface selection?

$
0
0

@egradman wrote:

Using Rhino.Common, I can prompt the user to select a sub-surface of a polysurface (which I'm adding to the document for further manipulation). How can I obtain a reference to the polysurface that contains this subsurface?

Here's my code for sub-surface selection.

import Rhino
import System.Guid
import scriptcontext
import rhinoscriptsyntax as rs

def GetSubSurface(prompt="select subsurface"):
  # get a surface of an object
  go=Rhino.Input.Custom.GetObject()
  go.GeometryFilter=Rhino.DocObjects.ObjectType.Surface
  go.SetCommandPrompt(prompt)
  go.Get()
  print go
  objref = go.Object(0)
  go.Dispose()

  brep = objref.Face().DuplicateFace(True)
  guid = scriptcontext.doc.Objects.AddBrep(brep)

  if (guid != System.Guid.Empty):
    rc = Rhino.Commands.Result.Success
    scriptcontext.doc.Views.Redraw()
  return guid

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5793

Trending Articles