When I make adjustments in my new component, I want to see the output (graphics) produced by another component (not the final result of all components) immediately, just as if I had clicked on that component , but not really going to click . What should I do, is it possible to simulate clicking on that component in my
new component?
Set GH_Component.Attributes.Selected
to true and use GH_Document.ExpirePreview
to redraw the preview mesh.
I would recommend to use DrawViewportMeshes
instead. There’s no need to simulate the selection behavior.
thanks Keyu Gan.
I means when I change values in 1 ,the ouput was created in 2 can be saw immediately , just like I click component in 2 like the picture.
there are many many component, how can i identify the component I want to ‘click’, and how to write code in 1 to simulate clicking. (the output in 2 was used to check value is right or false)
What exactly do you mean by “immediately”? I’m in general confused by the problem. Once the data is computed inside group 2 it can (and will) be shown as a preview. Unless the [Selected Only] preview mode is on and the component isn’t selected.
en, Forgot to say, preview mode is Selected Only:Don’t want to be disturbed by too many lines.
I advice against messing with the selection of objects behind people’s back, but if you must then @gankeyu’s advice is correct. From within a solution you don’t even have to expire any previews, since that will happen automatically when the solution completes.
That is up to you. You can either hard-code the GUID (probably a bad idea), or identify the component by position, or by nickname, or by membership of a specific group, or… How would you like to to mark these components?
I think I get what you mean. Because changing (1) defocuses (2) below, the preview mesh of (2) is gone. So you want to keep the previews in the viewport while you still can edit (1) freely.
A quick hack of GH_Attributes.Selected
should work, though it’s not a good idea to do so as mentioned by @DavidRutten. I recommend more systematic management of what components are visible and what is not.
You can control the visibility using MetaHopper (Set Component Visible and a butch of toggles). And the situation reminds me I could include a visibility state manager in the newer version of Pancake
Thanks David Rutten & Keyu Gan.
It’s difficulty for me to try this ,I’m a beginer. Mayber I’ll try later.
Thanks.
A simple and plugin-free implementation:
Code in C# component:
Component.Params.Input[1].Sources[0].Attributes.GetTopLevel.Selected = true;
PS: It should be written in AfterSolveInstance