Grasshopper

algorithmic modeling for Rhino

Hey all - 

 

I'm curious - what are the conditions that cause a script component to update? I had previously assumed that, like other components, any upstream change will cause the script to re-run, but this does not seem to be the case in a script I am currently working on. Reconnecting a wire will trigger an update, but changing the position of one of the the input points with a slider will only trigger an update once, and after that changing the slider does nothing.

 

Is there any way to force the component to update on a change in value?

 

 

Views: 434

Replies to This Discussion

here's the file in question:
Attachments:

I'm running into all sorts of trouble with this file, but the update mechanism seems to be intact. It changes when I drag around the referenced geometry in Rhino at least. I'll dig a bit deeper, see what comes up.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Don't you get a load of errors when you change the slider?

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

I have found a problem, it seems that calling Rhino commands that use mouse input from within a Script Component causes a secondary MouseMove event, even though the cursor position hasn't changed. I don't know if this is a bug in Rhino, RhinoCommon, Windows, MFC or .NET. What I do know is that that second event got absorbed by the slider, which in turn thought it had to start another solution. This second solution was running 'inside' the first solution and the two conflicted, resulting in a boat-load of identical error messages. 

 

I fixed this issue (I think) by not responding to mouse-moves at all when a solution is currently running. I can find no more problems with the file you posted in this new setting, though there is quite a lot of flicker while dragging sliders.

 

You can reduce this by disabling the redraw while you're shuffling around breps:

 

doc.Views.RedrawEnabled = false;

Guid brepID = doc.Objects.AddBrep(b);

doc.Objects.UnselectAll();

 

Rhino.RhinoApp.RunScript(string.Format("-_SelID {0}", brepID), false);

Rhino.RhinoApp.RunScript(string.Format("-_Bend w{0} w{1} w{2} _Enter", coords(s1), coords(s2), coords(d)), false);


Rhino.DocObjects.ObjRef bakedObj = new Rhino.DocObjects.ObjRef(brepID);


A = bakedObj.Brep();    

doc.Objects.Delete(brepID, true);

doc.Views.RedrawEnabled = true;

 

The fix with the recursive mouse-events will be available come the next release. In the meantime, you can try refreshing your solution by pressing F5, so you won't have to mock about with re-connecting wires.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service