Looping webcut

I’d like to have a script that slices my model into a bunch of slices. I’d like the number of slices to be a variable.

Here’s the script I thought I could use:

#{ _lam_thick = 5 }
#{ _num_cuts = 19 }
#{ _lam = 1 }
#{ loop ( {_num_cuts} ) }
webcut… distance { _lam_thick * _lam } from…
#{ _lam++ }
#{ endloop }

But Cubit doesn’t seem to care for a variable as the loop counter.

This does work:
#{ _lam_thick = 5 }
#{ _lam = 1 }
#{ loop (19) }
webcut… distance { _lam_thick * _lam } from…
#{ _lam++ }
#{ endloop }

Am I missing something about using a variable for the loop counter?

Thanks,

This should work:

reset
brick x 100
#{ _num_cuts = 19 }
#{ _lam = 1 }
#{ loop(_num_cuts) }
webcut vol all xplane offset {_lam}
#{ _lam++ }
#{ endloop }