Delete Iterations via Python?

Am I crazy or was there a Delete Iterations (except for the highest iteration) python script floating around?

It’s in the flame examples folder:
/opt/Autodesk/flame_2021.1/python_examples/clean_batch_iteration.py

1 Like

Legend! Thank you.

Ooh. This sounds good. I’ll have to take a look and see how easy it is modified to keep the latest five.

Not that easy. I really need to learn me some python

1 Like

@MikeV do you know the answer to this? I haven’t tried yet, but I’m wondering if a for loop would work. Where I >5, or something like that?

Wherever you see these lines in the Autodesk sample script:

for iteration in batch_group.batch_iterations:
flame.delete(iteration, confirm=False)

You could change it to:

for iteration in batch_group.batch_iterations[:-5]:
flame.delete(iteration, confirm=False)

This will prevent it from deleting the last 5 iterations in a batch group as it runs the delete loop.

Mike

3 Likes

#BOOM!! Thanks man!!

Thanks @MikeV

I modified the script using your suggestion.
It works very nicely. Thanks @MikeV

1 Like

If anyone is interested I took the Autodesk script and added a simple UI that will let you select the number of iterations you want to keep. It’s called Delete Iterations and it’s up on the Logik Portal.

It will delete the iterations in a selected batch group, all the batch groups in the desk, or all the batch groups in a selected library/folder.

Mike

8 Likes