let s say i have a Brep ( closed Polysurface ) and i want to Feedback a selected Face to the user.
how to do this ?
what is missing ? what is wrong ? thanks for any help.
Hi @Tom_P , below is a python example which flashes a selected surface of a brep:
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def DoSomething():
obj_ref = rs.GetObject(filter=8, preselect=False, subobjects=True)
if obj_ref:
index = obj_ref.Surface().ComponentIndex()
obj = obj_ref.Object()
for x in xrange(4):
obj.HighlightSubObject(index, True)
scriptcontext.doc.Views.Redraw()
rs.Sleep(200)
obj.HighlightSubObject(index, False)
scriptcontext.doc.Views.Redraw()
rs.Sleep(200)
if __name__=="__main__":
DoSomething()
I remember asking a similar question in the past. Using this to “select a subobject” eg:
obj.SelectSubObject(index, True, True)
can be used, but the selection does only remain while the script is running and does not stay, so it cannot be used to make eg. a transformation with a pre-selected subobject after the script finished.
Dear Clement, I got lucky, and managed to solve as below. It was the SelectSubObject method for ObjRef objects, but from the API it looks like there might be a lot of ways to do it. I’m not sure whether mine was the best or quickest.