why does this not work

Hi all,

I am trying to merg all xrefs I came up with this:

fn XrefMerge=
xref_index = xrefs.getXRefFileCount()

for i = 1 to xref_index do
this_xref = xrefs.getXrefFile i
merge this_xref

However it will merge first xref but then it will say:

-- Runtime error: getXRefFile index out of range: 2

i suspect that the index changes but how will I tell maxscript to always use index 1 while using a for loop


returns.jpg254.7 KB