Families contained within volume

I’m trying to create a script that allows me to get a parameter value from a generic model, and push that value to all the families that are contained by this same generic model.
Allow me to explain a little bit more:
I’d like to be able to create several Generic Models that represent certain zones (installation areas) in a building, and then get a parameter value of that Generic Model and push it back to all the families (Ducts, Duct Accessories, Pipes, …) who can be found within that Generic Model. This will allow me to create schedules for each installation area without me having to select everything manually…
I’m a complete newbie when it comes to Dynamo, I know what I want the thing to do, but just can’t get it to do what I want.
I can get it to work for Ducts and Pipes (that’s easy because there’s only 1 solid for each pipe or duct), but Duct Fittings, Duct Accessories, Pipe Fittings etc are all more complex geometries with multiple solids in each family, and that’s when it all goes wrong…
I’ve been trying to do this without any extra packages as well.
Help would really be appreciated :slight_smile:

Welcome to the forum!

Do the families have to be completed contained by the zone? What if they’re only partially contained or split between two zones?

The easiest thing to do is get the family locations (points) and check those against the zone. As you’ve found out, checking against multiple geometries for a single family is more work, however still possible. If families need to be fully contained by the zone then you will have to check every solid. That can be done by utilizing list levels so that every part is checked individually and then the family as a whole checked for no failing parts.

Try making some of the changes I’ve suggested and then post an image of your graph (with node preview bubbles pinned) so we can see where you’re at.

Hi Nick, thanks for the welcome :slight_smile:
As long as the bulk of the family is contained by the zone (>50%), it’s ok. It doesn’t have to be fully inside the zone. Same thing with elements that pass from one zone to an other: wherever the centroid is, that’s where the family should be assigned to.
This is what I’ve got so far:
part 1

part 2:

FYI: When posting pics of your graph, use the Export as Image button in the top right of the Dynamo window. This will export the whole graph, regardless of what’s visible in the canvas, at a high resolution. Just makes sure you’re zoomed in enough that the node titles are visible and you have the node preview bubbles pinned so we can see the data moving through your graph.

The centroid of the family would probably be ok for most families but you’re getting the centroid of all the individual solids and that will cause problems. Use Element.Location instead of Element.Geometry and Solid.Centroid. This will get you the origin or curve of each family. For curves, it might be best to convert those to a midpoint as well, but you can see how it goes first.

OK, have adapted it, script works great for all elements in 1 zone, but how can I get it to check vs every other zone?
Right now I’ve got a List.GetItemAtIndex combo with a Code Block to manually change the zone, but I’d like it to keep repeating this for every other zone as well… Any tips?