Model Split

Hi All,
Currently I have a combined services revit model for MEP, however when issuing models sometimes the end user requires individual services models. Currently doing the longest manual way of creating save as, isolate work sets delete them and what not to prep the model for final issue. Thinking of putting a code together to automate the process.
Coding Steps:
• Open the Model and go into 3D view with a pre setup view of Model split.
• Then filter individual elements based on category and assign it to the correct workset (to eliminate user inconsistencies, if any)
• Delete the rest of the elements and worksets and then able to prompt to save the model with different name.
Started with Mech services first and below screenshot is where I am up to now.
Currently stuck @ converting the refrigerant piping systems into elements or requires help with finding refrigerant pipe work only and then assign it to the appropriate worksets.

Not sure if the filter is supposed to be “ME” for all items.

If so, you need to create a list of categories, and the see if the string contains ME.

Like this (I only have errors, because I don’t have electrical elements in my model):

You could also flatten the list after collecting them in “All Elements of Category” if you don’t need to maintain the list structure. In my experience, once a model becomes “bloated” you may need to move elements into workset “piece by piece.” This might mean only moving 500 items at a time. For this, you should also filter-out elements which are already placed on that workset.

You will need to get the paramter workset (it returns a number-id, not the text-name) but you can easily just grab the workset you need and get the id of that to use for an “==” comparison in dynamo for your filtering mask. Is that clear?