Hi Dale,
Sorry for being unclear.
I’m using a Grasshopper Script that uses Elefront’s ReferencebyName component to watch for changes in the Rhino document and update the referenced objects if changes are detected.
With the script below I am making a change to the usertext of an object that has the Name that the GH component should be ‘watching’. However although the usertext is successfully changed with the Python Script, it doesn’t lead to an update in GH. Only when I manually hit ‘Update’ on the Elefront component, the changes in usertext are recognized.
As a workaround I tried to simply move the object up and down back to the same place, and when I do that, the component in GH actually recognizes something was changed, and it also reads the new usertext.
I was wondering if there is a way to do it without this workaround.
filter = Rhino.DocObjects.ObjectType.Hatch
rc, objrefs = Rhino.Input.RhinoGet.GetMultipleObjects("Select Objects:", False, filter)
if rc != Rhino.Commands.Result.Success: return
objects = []
for objref in objrefs:
object = objref.Object()
if object:
objects.append(object)
for i in range(len(objects)):
objects[i].Attributes.SetUserString("height", str(dialogBuildingHeight))
#code until here doesn't update in GH, as a workaround the following works:
xform1 = Rhino.Geometry.Transform.Translation(0,0,1) #move up 1m
xform2 = Rhino.Geometry.Transform.Translation(0,0,-1) #move back down 1m
sc.doc.Objects.Transform(objects[i], xform1, True)
sc.doc.Objects.Transform(objects[i], xform2, True)
Thank you!