Create 3D views of multible elements based on parameter values

Hi all

I want to create a script that creates unique 3d views and isolates elements within these views. The elements can be multiple categories and the views must be create based on 2 parameters.

Parameter A is an overall parameter.
Parameter B is a numbering parameter within the overall parameter.

Both paramaters are Number instance parameter.

The 3D view needs to be created with elements where parameter A+B are the same.
The elements must be isolated in the 3D view.

Im very new to Dynamo, and all other posts that resembles my task i couldnt get to work.

I tried using this script, and i get it to create the 3D views of each individual pipe.

But that quite far from what im interested in.

Hope you can help me out.

Parameter A applies to all pipeline:

Parameter B applies to parts in the pipeline:

Get both parameters for all elements. Compare and group them. Create a view for each group of elements. Then isolate the elements.

You should be able to find examples of each of these steps on the forum. If you have any trouble piecing them together you can post an update with the specific issue you’re having.

Hi Nick

Thanks for the guidance. I get what you want me to do, it make sense, but I’ts a bit to complexe for me to figure out even what to search for in tis forum :frowning:

I can get a list that groups the elements with the same parameter from Paramater B, but im not sure how to implement results from Parameter A in the same lists.

And im not sure what to do with the lists to make a boundingbox and a 3D view afterwards.

You don’t actually want to filter any elements based on individual parameters (if I’m understanding your grouping correctly). You want to combine A+B and group those elements by matching value. You can use GroupByKey to do this once you have the combined values. It shouldn’t make a difference in this case, because you’re getting your elements the same way, but it’s best practice to use the same list of elements to get both parameters. This ensures the values are aligned correctly. Then it’s just a matter of creating the views, cropping them, and isolating the elements. I’ve listed some helpful nodes below.

Okay so now i got the list group as i think it should be:

Now i have my groups of elements, but how do you create the elements or geometry i need to create my broundingbox?

First, make sure you’re grouping the elements, not the parameter values. You can get a bounding box by elements, and then use that along with a view name to create the view.

I tihnk i might be getting closer with your help, but im running in to some issues.
I create the groups now, i can see the bounding boxes in the Element.boundingbox node. But it stil returns an error i dont understand.
Is it because of the null elements?

In the BoundingBox.FromBoundingBoxes it creates 4 different boundingboxes which seems correct, but it wont create the views when i run the script.

When i select only pipes it seems like it should work.
When i run it, it creates 4 views in Revit, but not with the corect boundingboxes, and i get an error in the 3DView by BoundingBox.

We can’t see what those elements are in your graph, but they’re not returning any values for either parameter, so there seems to be an issue. Can you pin all the node preview bubbles for your nodes and confirm that those elements in the second group are valid and have parameter values you’re looking for?

Hi Nick

I got it to work!
Now i just need to tweak a few things :slight_smile:

One think i cant seem to get to work is when selecting multiple categories.
When i test using only Pipes it works great, but when i want to include pipe fittings and accessories it doesnt work:

Any of the ByCategory nodes will return elements grouped by those supplied categories. It just list comprehension - two categories means two lists. You need to Flatten the list of elements before doing anything with it so there aren’t any additional list levels.