Apply Workset to Element, With Filter


I’ve only worked with Dynamo a couple of weeks, so I am at a basic level of knowledge.

Been looking around at the forum and I’ve found some helpful threads to get me started, great place to learn!

For my problem,
What I like to do is to collect all element of a category and apply a workset to them, but, I want to exclude the elements that are already given a specific workset.

So, basically I want to select all the pipes in the project, filter out and exclude the ones on a specific workset and apply a given workset to the remaining pipes.
So for my test I have 3 worksets, “V50-Modell” which are meant to be applied to pipes, “V57-Modell” which are meant to be applied to ducts and also a sketch-workset “Skiss”.
I would like to apply all the pipes to the workset “V50-Modell”. Though, I have a set of pipes that are applied to the “Skiss”-workset, which I want to be kept on that workset.

I’ve come up with the following so far:

The problem is, it is only changing the workset of 1 pipe segment and not all of the pipes. The marked pipe in the figure below is applied to the wanted workset, the rest of them remains the same.

In the figure abow, the two blue networks are ducts, the one on the left is on the “sketch” and the one on the right is on “V50-Modell”. The two red networks are pipes, the one on the left is on the “Sketch” workset and the one on the right is on “V57-Modell” (Which is supposed to be changed to “V50-Modell”.

I’m attaching the dynamo script. ApplyWorksetWithFilter.dyn (24.5 KB)

Any ideas on how to proceed? Is there a way to make an more efficient dynamo-script?
I’ve found a lot of helpful threads regarding filtering or applying workset, but nothing about combining them the way I’d like to do…


I managed to get it working! Got to this:

This way I collect all duct/duct fittings/duct accesories, applying a given workset for all of them except for the once that are already in the “Skiss”-Workset.

Though, I would now like to add a rule to the filter, exclude yet another workset. The idea would be like this:

I believe some kind of python script must be the easiest way to accomplish this, but that would be way above my knowledge, since Dynamo itself is new to me :). So, If I would like to stick to Dynamo, anyone got an Idea how to filter with multiple conditions?


Edit: Double posted pic.

Python would be completely overkill for this. Look at this!

2019-12-13 Dynamo Forum Post LJac.dyn (15.0 KB)

As you can see this is easily expandable

1 Like

Easy as that! Made a first try, and it seems to work fine! Thank you so much, appreciate it!

I kinda feel like one of the biggest obstacle while new to Dynamo is to know what commands are available (both as standard in Dynamo and all the packages). I did had in mind that something like that would be available. Thanks again!

Yes i also had this problem starting with Dynamo, and i still am learning new nodes everyday!