The setcs/cs function is a built-in engine function to store and retrieve local atom references. Although I cannot immediately see what is going wrong in your code, the use of self-defined local variables may benefit your code. For example, alter your code in the following manner.
Code: Select all
do(
Var([atmLoop1], vbAtom),
Var([atmLoop2], vbAtom),
ForAtomLayerUnder(p(1),
do(
atmLoop1 := a,
... { do some things with atmLoop1 }
ForAtomLayerUnder(atmLoop1,
do(
atmLoop2 := a,
... { do some things with atmLoop2 }
)
)
)
)
)
I hope that in this way your code performs as expected.
Regards,
Marvin