Duplicate baking object problem with Python

Hi, I’m referencing this post to create a node for baking geometry by triggering the button,
Previewing and baking text with Python - Grasshopper (grasshopper3d.com)

and it also changes baked geometry to a specific layer,

WeChat Image_20210509121209
the problem is the result will be duplicated,
is there a way to delete the duplicated result?

PythonBakeButtonCycleProblem.gh (9.7 KB)
Thanks

You’ve left out the line that checks for your button press:

-Kevin

1 Like

Thanks for the replying, It works!
Don’t know why the problem will remain when the IF statement put before Line 20,
but follow your suggestion and put it after the layer adjustment then it works. :thinking:

Thanks again! you really save my day!