Grasshopper

algorithmic modeling for Rhino

Just messing around with dynamically changing the light color from Grasshopper.

Tutorial: http://datable.net/modifying-rhino-object-attributes-from-gh/
Code: https://gist.github.com/4104781

Views: 882

Comment

You need to be a member of Grasshopper to add comments!

Comment by Christian Schmidts on November 19, 2012 at 7:39am

nice work Luis!

1+ for making this available in a plug in 

Comment by Luis Fraguada on November 17, 2012 at 3:04pm

Note, this has some implications on the UNDO stack...

Comment by Luis Fraguada on November 17, 2012 at 3:04pm

This is the actual code...can be used for anything.  I started using it with PointClouds to update them dynamically, but yes, it works with anything. 

Rhino.DocObjects.ObjRef obj = new Rhino.DocObjects.ObjRef(id);
Rhino.DocObjects.LightObject lobj = obj.Object() as Rhino.DocObjects.LightObject;
lobj.LightGeometry.Diffuse = col;
lobj.LightGeometry.Intensity = pow;
lobj.CommitChanges();

Comment by Andrew Heumann on November 17, 2012 at 2:17pm

And as Dhruv suggests, I would be interested to fold this direct-modification approach into some of the HDT tools. Would you be opposed to my shamelessly copying your brilliant technique?

Comment by Andrew Heumann on November 17, 2012 at 2:13pm

WHOA! did not know you could use set one guid to get non-GH-Friendly objects. Awesome!!!

Comment by Vicente Soler on November 17, 2012 at 1:58pm

Try this code in a VB component:


Dim objref As New docobjects.ObjRef(x)
Dim l As Light = objref.Light
l.Diffuse = y
l.Intensity = z
doc.Lights.Modify(x, l)

 

Connect the ID to the x input, set it as Guid, connect a color to the y input and a slider to the z input (add a third input).

Comment by Philipp on November 17, 2012 at 6:52am

is there any chance to see this as a plugin or component?

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service