algorithmic modeling for Rhino
I am developing a custom component by C#.
I added custom MenuItems to the context menu.
When a MenuItem is clicked, a state of the component is changed and so, SolveInstance should be called.
Now I am struggling with this problem, calling the SolveInstance from an event handler.
How can I get an appropriate Grasshopper.Kernel.IGH_DataAccess object for my custom component?
Tags:
Don't call SolveInstance. Even if you managed to provide a valid IGH_DataAccess object it still wouldn't work. You need to call ExpireSolution(true) when you want the component to recompute.
Basically, your event handler should look something like this:
private void MenuHandler(object sender, EventArgs e)
{
RecordUndoEvent("Relevant Property Name");
RelevantProperty = !RelevantProperty;
ExpireSolution(true);
}
--
David Rutten
david@mcneel.com
Tirol, Austria
Thanks, David. I will try.
wow, it worked finally.
ExpireSolution(true) was a member function of the GH_Component.
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by