Delete Non Template Materials

Looking for a way to automate the purge material that seem to creep in a project by importing families) we have a clean list in my template but no mater what more and more creep in as it is being developed. I know I can purge and just click the new ones but is there a way to automate it so I keep a list and everything else is removed(including the assets). thanks in advance

P.S. here is what I have so far (got the sorting down)


Delete Non Template materials.dyn (15.7 KB)

As a start you’ll want to try filtering the material elements themselves - you’ve currently got names in the Last list.FilterByBoolMask node.

Once you have that sorted out you can try feeding the ‘out’ value from the final List.FilterByBoolMask node into an Element.Delete node, which may do the trick.

Alternatively you could use a Material.ByName node to re-select the materials in the ‘out’ port of the List.FilterByBoolMaks node and try deleting those.