Display vector/value on canvas

Hi. I wonder if there is a way to display the direction of a vector directly on the GH canvas. (I know that it is possible to do in the rhino viewport) I will only be working in the xy-plane. I am hoping to achieve something like i have drawn below.

One can set a Control Knob value with a script. In this case, checking for a named Control Knob:


231221_SetKnobValue_00.gh (5.4 KB)

2 Likes

Thank you! I am trying to replicate your file to learn how this works, however i am not able to obtain the same result as you. I think it is because the renaming of the input parameters dont change the script variable in python. How can i fix this? as yuo can se the variable is still called x even though i changed the name to “Name”
image

I attached the file above. But just noticed I forgot to expire the knob after setting the value, so here’s an update:


231221_SetKnobValue_01.gh (5.6 KB)

1 Like

I saw that you attatched the file:) thank you for that. I was just trying to write the script myself to get a better understanding of it. What does “expire” mean? it was working fine without the expire added

Ah, nice learning exercise. I’m not sure what’s going with your component, but it looks like you’ve somehow edited both the name and nickname of the input parameter. I can have a look if you upload the file.

You can think of it as recomputing the component, but there’s a bit more to it.

Yes and no. It was working fine for visualising the knob turning, but the value output did not update:

So thought I would just add it for good measure. In case someone else comes along that needs to fiddle with their knob values in the future :wink:

2 Likes

I managed to make it work! I do not know what the issue was the first time. Thank you so much! Visualizing certain things on the canvas can be really helpful sometimes.

1 Like

Hello again. I am trying to write my own script, and i think you are the right person to ask. I want to get data from every GUID-component on the canvas. I have set up a script similar to the one you created, but i dont know the type of the GUID component. Where can i find out what to write after “if type(obj) is gh.kernel” to access the GUID components?

It would be nice to know the path all the different components as well if i were to reference a different object in the future.

It’s probably best to start a new topic, but I think it’s gh.Kernel.Parameters.Param_Guid you need.

Thank you. I have a thread for it already:)

Combine all data of same type in to one element in GH - Grasshopper - McNeel Forum