Created
August 28, 2017 20:41
-
-
Save sbaer/5d37c41dc40040f6367de8ca341bfaf1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rhinoscriptsyntax as rs | |
import Rhino | |
def ModifyInstancePiece(): | |
rs.UnselectAllObjects() | |
go = Rhino.Input.Custom.GetObject() | |
go.SubObjectSelect = True | |
go.Get() | |
if go.CommandResult() != Rhino.Commands.Result.Success: | |
return | |
objref = go.Object(0) | |
part = objref.InstanceDefinitionPart() | |
if part: | |
val = rs.GetUserText(part, "counter") | |
c = 1 | |
if val: | |
print val | |
c = int(val) + 1 | |
else: | |
print "no user text yet" | |
rs.SetUserText(part, "counter", c) | |
rs.UnselectAllObjects() | |
#hold down ctrl+shift to sub object select | |
ModifyInstancePiece() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment