I’m trying to create a dynamo script that will be able to take 50% of all receptacles within a room that I’m selecting and replace them with a different specified type of receptacle. I would also like to specify multiple rooms at a time. Anyone able to help out?
Welcome to the forums!
Can you show us what you’ve tried so far and where you’re stuck? There are a few custom nodes that can identify elements by room or you can always get the room from each receptacle and then group the receptacles by room name/number. Then you just need to calculate and select 50% of those elements per room to change the type.
Thank you, and ill be honest. I’m new so I’m trying to familiarize myself with the nodes available, I’m able to use the rooms as an input but don’t know how to select the receptacles within the room / select 50% of them / and then subsequently replace them.
You’re going to need to show us what you have so far. Work step by step. It’s probably best to get the receptacles and then group them by room.
Then you can count how many receptacles are in each room and what 50% of that would be (rounding up or down if necessary).
If there’s no other conditions on which receptacles to be replaced, then you can either shuffle the list to select random instances or just take the first n instances to be replaced.
Hello @Nic.Batt welcome to the Dynamo Forum!
People are very willing to jump in an help out for sure, but will need a little more information. Are you able to provide screenshots and/or upload a typical Revit family for people to reference? Otherwise we are going in blind…
It will also depend upon your set-up, if you are modeling in the same file you can do what @Nick_Boyts suggests above, if you are using Linked Files it gets more complex.