I used a array to "match" because there will be several different definitions to delete.

TIG is showing you how to purge ONE definition and it's materials.

TNTDAVID wrote:Your code works perfectly for a single definition, ...

No it does not. because you made 3 edits that make it NOT work properly.

CORRECTION: Actually I found 4 errors that made it not delete all the components or materials.The second use of the Regexp was ! d.name =~ /#{name}/ (the regexp var is match.)matsNOTtogo=[] was defined as matsNOYtogo=[], resulting in NameErrorThe comparison of back_material was conditional upon inclusion of front material in two statements.

TNTDAVID wrote:... what if we have "CUBE", "TOTO" and "LOLA" to delete?

First, learn how and why TIG's code works for ONE definition, then learn how to modify it for multiple definitions.

Then either you wrap what TIG showed you into a method, and call it 3 times from a loop:

"Color B04" and "Color J08" are unused."Color K03", "Color M06" are used by primitive faces."Material 2" is the leader color.

So here is a method with extra quirks:* Returns false if array of cnames is empty.* Short circuits and returns 0 if no definitions are found to delete.* Reports both to console and message box number of definitions and materials purged.* Returns number of definitions deleted.

# this means you don't have to get Regexp right yourself names = Regexp.union(args) # this is similar to defs.to_a.dup.flatten list = defs.find_all { |d| d } # we will still only use one operation as v17 will error model.start_operation('mats')