Repeat commands per list index

Hello, I am looking to run a series of commands based on the number of faces I select. I currently have it working for 1 face and can repeat it for any amount of predetermined faces I want, if I copy the code that many times and run it through a list combiner. I am wondering if there is a way to make this work for “n” amount of faces? Given that when I use the select faces node it will create a list of the surfaces selected

What types of commands are you trying to execute? Dynamo will automatically process each input, regardless of the total number, and the exact behavior can be controlled through lacing and levels. Are you able to post what you have tried so far?

2 Likes

Could you maybe share something visual / your Dynamo file.

Here is a snap shot of most of the code that needs to repeat. I am making a “Visual Speaker Throw” simulation and want to be able to show all speakers at once versus one at a time, while allowing for any given number of speakers. So be able to “Select Faces” instead of “Select Face” and create origin points for each face selected based on its center point.
As a side question, is there a node that will make an input number negative as its output? i.e (-|x|)

Are your faces from a family? If so it may be easier to get the facing orientation and location point, and use that to place the throw? Or do you need more info about the specific face elsewhere in the graph?

Either way you can likely set stuff to work on lists by using list @ level and lacing combinations.

That may be another way to do what I’m looking for. Currently I am using the points on the face of the surface to create a face to aim the “rays” at to plug into a directed rays node from the acustamo package. attached is the working file I have for one speaker and I welcome any efficiencies you see I can make. I am pretty new to dynamo and used what I understood to make it work.

Speaker Throw.dyn (99.0 KB)

1 Like

That’s the first step. Adding more under standing is the next. :slight_smile:

This should help you along:

. There is likely a better way to do the original selection and omitting the surface building, but as I don’t have your rvt file I can’t say what that is.

The method you use for building your speaker family will matter quite a bit. One thought would be to use a shared family nested into the speaker mass, with the only geometry being a single surface at the location of the ‘throwing’ face. This would allow you to simply grab all elements of that family type, find their location and geometry, and use that to generate the rays. Alternatively you could try and use a face on your speaker family which has a known and unique characteristic (such as the smallest area, or the normal being parallel to the facing orientation), and use that surface as your base surface.

Thank you so much! I believe I understand what you are saying to do in the image you posted, but I want to verify where you are putting that in the node chain. It is where I am pulling the four points I am creating together to make a surface, correct? Then, when I select multiple faces (vs. just selecting one) it will transpose the list per surface based on the list level?

Yes. The List.Create node is the same one you have. :slight_smile:

1 Like