Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby Enumerable#sum doesn't work properly with Length objects #1024

Open
maxp-hover opened this issue Dec 20, 2024 · 0 comments
Open

Ruby Enumerable#sum doesn't work properly with Length objects #1024

maxp-hover opened this issue Dec 20, 2024 · 0 comments

Comments

@maxp-hover
Copy link

maxp-hover commented Dec 20, 2024

I have tested on Sketchup 2023 and 2024 on ARM Mac

The issue is simple to reproduce. Create a few edges, select them, then run the following code snippets in console:

Sketchup.active_model.selection.sum(&:length)
Sketchup.active_model.selection.map(&:length).sum

Only the second returns the correct result. The first just returns the length of the first edge in the selection.

I opened a forum post about this here a few years ago here, but didn't make a bug report for it. https://forums.sketchup.com/t/sketchup-selection-sum-doesnt-work-properly/187279

This is a really easy thing for a plugin / API developer to miss. Clearly there are workarounds, but it's one of those things which can very easily slip under the radar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant