Hi. I am trying to write a code that looks at all the surface components on the GH-canvas and collects their GUID. As output i want all the GUIDs in one list.
I got some help earlier, so i know that i must use this path:
gh.Kernel.Parameters.Param_Guid
I have tried to write a little code, but would apriciate your help to finish it. I am new to Python in GH so i am not familiar with how i refer to objects on the canvas
It’s a bit unclear which GUIDs you are referring to. If you mean the InstanceGuid of all Surface parameters on the active Grasshopper canvas, you can do something like this:
Your code works perfectly! However it did not serve my purpose. Maybe the thing i am looking to collect is the object id within every collection of surfaces rather than the GUID. As you can see here i have different collections of surfaces all containing multiple referenced surfaces from Rhino. I want to make sure that no surface is included more than one time regardless of which surface component it is within. I am referencing surfaces manually and sorting them by using different surface components. i want to prevent any potential double-counting mistakes. Hope this explains what i am trying to achieve.
I’m not quite following the higher level problem. But if your sub-problem here is to get the Rhino document GUID for a list of referenced surfaces, you can pass the referenced surfaces through a Guid (ID) parameter:
Not quite. I want to reference the surfaces manually by using “set multiple surfaces” in GH, and use python to control/check that i have not referenced the same surface multiple times.
As of now i am doing it like this. However when i have up to 100 different surface components to connect to the entwine component it is very time consuming
My GUID component does not let me connect multiple items to the input therefore i am using the entwine function.
However your solution does not solve my problem. Connecting 3 different surface components to the GUID like in your example is no problem. However when i have up to 100 surface components i want to avoid having to connect the 100 surface components to the GUID component.
I am not using one surface component per surface in rhino. Rather one component per collection of surfaces (in my case surfaces with the same orientation.)
I’d still question the logic of structuring/manually inputting these using that many surface parameters. In this case, you might write a script that automates the sorting by orientation maybe? Or use Rhino layers or attribute user text to add metadata to your surfaces. But anywho, here’s a script that does what you want, I think:
As for you suggestion of automatically sorting the surfaces i have already tried that. But there are some issues by doing this. First of all the normal vector of the surfaces that i import are sometimes 180 degrees wrong. And i have not found a way to exclude internal surfaces yet. (i am starting with a bunch of block components in rhino imported from BIM=rooms in a building, and i only want to evaluate the external surfaces of theese blocks). But this is a much bigger task to do so i will not ask you for any help here. As of now i am pleased by doing the job manually.