My definition scans the whole Rhino file for blocks and their attributes.
This can take a very long time, specially because I also measure volumes, areas, centroids,…
When I open a new Rhino file, I get error messages such as this one :
(I get a similar message for the standard GH component “Match text”.)
But… this doesn’t trigger a recompute of the definition.
How can I achieve this without using a method that will force a recompute at every little change in the current file ?
if Recompute:
def recomputeCanvas(e):
for obj in ghenv.Component.OnPingDocument().Objects:
if not obj.InstanceGuid == ghenv.Component.InstanceGuid:
obj.ExpireSolution(False)
If you find a script that checks when new file is loaded and acts like a trigger for what I just gave you, then you are set. Every time you load a new file it will recompute.
David, this is the real issue.
Once I get a trigger for when the file is changed, I can expire a root component in my definition with Metahopper for instance.
I know. But at least you have a solution for one part of the problem. I will try and find the other part of the puzzle, but it will take me some time. With a bit of luck someone on the forum knows how to do it.
Here is the component if you have issues creating it. recompute.gh (1.6 KB)
The C# component does the job, but I realize that expiring the solution isn’t enough.
There’s a lot of data that remain stored and needs to be flushed.
What would be really great is if the output “A” could briefly send a “true” boolean.
I could use that trigger to force the relevant components to update.
I tried to fiddle a bit with the C# code, but I almost threw the laptop out the window…
Exactly the same situation here. We need to make it work like a normal button just for a split second. I am pulling my hairs out Should have learned to code…
Of course, you are right.
Learning Grasshopper earned me a Tesla ; learning C# would probably earn me a ticket to Mars on the Starship.
Anyways, I’m realizing that GH can’t really deal efficiently with large amouts of data.
I’m bracing myself for the climb of the C# learning curve to make an actual Rhino plugin instead of a Grasshopper definition for my “Block attributes visualization and management” project.