Generative Design_Create Revit Elements Unexpected output

Hello all,

i’ve been struggling for days with the unexpected behavior of a script for Generative design,

While running the script in Dynamo it works properly, but when executed through Generative Design it only displays one thumbnails as result, the rest appear with “Image not found”.

And more surprisingly, when I click “Generate Revit Elements”, The elements generated in Revit do not correspond to the chosen option, it creates the elements of a totally different option that does not match neither the output results nor graphically.

What i’m trying to acheive is to place modules of different widths randomly along a line and to test which configuration uses the least total quantity of modules, and what is total remaining length of the line not covered by any module.

For visualization I created circles representing the width (diameter) of each module.

The scripts randomly selects the possible modules to place on each iteration.

Does any of you have any idea of what can be causing this behavior?

Thank you so much in advance,

JGO