As a warning about the power and danger of scripts ...
I wrote a “Collapse Matrices” script that would find all XForms on Xrefs and collapse them. Batch mode so I could do dozens of files at a time, and runs ~80% faster than the tool in Creator itself.
I then found that the Place model tools puts a matrix (or matrices) on the group node above the XRef, so pulled the
type = mgGetCode ( rec)
if ( type == fltXRef)
out of the script, and simply did a check to see if a node had a transform.
We discovered much later that that buggers up all the light strings that were entered as “light string with delta”. apparently type of light string has an XForm on it somewhere embedded in the record that the user is unaware of, and when you collapse that matrix it pretty much gets rid of all the lightpoints in the string other than the first vertex.
So I put a
type = mgGetCode ( rec)
if ( ( type == fltXRef) or (type == fltGroup)
in there and everything is fine.
So warning - if you are using scripts to modify a whole bunch of objects in a “destructive” fashion (you can’t unscramble those eggs), thoroughly test, and either CM or make a copy of the pre-modified files until you have a chance to publish and QA the end results 8*).