Hello OpenSCAD,
I want to create a bunch of objects and I have the width of each object in a list.
how can I accumulate the total of the widths to the Nth point so I can place the new object to the right of the ones placed so far?
I understand that W += currentWidth+3 is not valid on OpenSCAD
--
Best regards,
Bob mailto:roosbob@wybatap.com
You have to write a recursive function that computes the cumulative sum
list. There is a cumsum() function in BOSL2 for this.
On Wed, May 21, 2025 at 5:02 PM Bob Roos via Discuss <
discuss@lists.openscad.org> wrote:
Hello OpenSCAD,
I want to create a bunch of objects and I have the width of each object
in a list.
how can I accumulate the total of the widths to the Nth point so I can
place the new object to the right of the ones placed so far?
I understand that W += currentWidth+3 is not valid on OpenSCAD
--
Best regards,
Bob mailto:roosbob@wybatap.com
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Hi Adrian,
Thank you very much. I learned something new and explored some of the list related functions (idx & list)
Wednesday, May 21, 2025, 5:12:58 PM, you wrote:
You have to write a recursive function that computes the cumulative sum list. There is a cumsum() function in BOSL2 for this.
On Wed, May 21, 2025 at 5:02 PM Bob Roos via Discuss discuss@lists.openscad.org wrote:
Hello OpenSCAD,
I want to create a bunch of objects and I have the width of each object in a list.
how can I accumulate the total of the widths to the Nth point so I can place the new object to the right of the ones placed so far?
I understand that W += currentWidth+3 is not valid on OpenSCAD
--
have Fun,
Bob mailto:roosbob@wybatap.com