Copying room names from Pollination to Rhino breps

Hi all, I’ve been struggling with this for a few days on what I think should be a pretty simple problem. I want to populate the ObjectName of the Rhino brep associated with the Pollination rooms with the room’s name. I’m able to get and set each field, but can’t seem to associate them even though it appears in Rhino that they’re directly associated with each other. Any ideas?

Hi @jonathancox,

If I understand correctly, you are trying to assign the room names to Rhino Brep geometries. Is that correct? Which part are you struggling with? Can you share your current solution?

Hi Mostapha,
I’ve only gotten as far as getting and writing the name of each type of element. I’m getting stuck on associating the two pieces of geometry. All I can think of is finding the centroid of the room, then getting the closest brep and assigning them that way. But seeing as they’re directly associated I was hoping there was a simpler solution.

Regards,
Jon

Hi @jonathancox, thanks! Now I see the challenge here. Since you have to get access to the referenced Brep geometry in Rhino, you will need some geometry check to sort the list of Pollination rooms with the Rhino Breps to be able to modify the attributes of the referenced geometry. It is easier to do this inside Rhino itself but not from Grasshopper. May I ask why you are trying to do this?

Here is how I would do it in Grasshopper which is similar to what you suggested. I’m using the Human plugin for modifying the properties of the Rhino objects.

set-room-display-name-to-rhino.gh|attachment

Thanks so much for the reply Mostapha. I’m still having issues from the equals sign onwards but I’m trying another way to sort by key. Sorry for the long response time, works gotten in the way of this side quest

Hi @jonathancox, can you share a bit more about the issue that you are facing? Do you have the Human plugin installed on your machine?

Hi Mostapha, yes I do. The script is just failing at the equals function (I think what you’re doing there is somehow matching the centroids of each of the objects somehow before assingning the name). The other stuff makes sense to me.

You said in your first message there was a native Rhino way to push Pollination names to the Rhino breps - is that the case?

(edit: I 'm not able to upload attachments, but as a description: My file has Pollination rooms which have room names. They directly match the geometry of the breps. I want the brep Name to match the pollination name in the end)

Can you try to upload the file somewhere else and share the link here?

Does this work?

1 Like

Hi @jonathancox,

Thank you for sharing the example. Here is an updated version of the script that should work.

set-room-display-name-to-rhino-updated.gh (81.1 KB)

It tries to map the input rooms to input Breps based on the distance between the center points. Make sure the number of rooms and breps are the same or otherwise you will end up with the wrong results for the Breps that don’t have a matching room.

Yep that did it! Can’t thank you enough for all your time and knowledge