Skip to content

Fix calculations for spare parts - #4

Open
ebariaux wants to merge 1 commit into
tomasf:mainfrom
ebariaux:fix-size-calculation
Open

ebariaux wants to merge 1 commit into
tomasf:mainfrom
ebariaux:fix-size-calculation

Conversation

@ebariaux

Copy link
Copy Markdown
Contributor

Trying to fit a 6x7 plate on a P1S having a max capacity of 6x6 resulted in wrong calculations.
maxBedUnitsX 6 maxBedUnitsY 6
xUnits 7 yUnits 5
mainPartXUnits 6 mainPartYUnits 5
mainPartCountX 1 mainPartCountY 1
sparePartUnitsX 1 sparePartUnitsY 5

Screenshot 2026-08-31 at 23 38 11

The sparePartUnits does not fully take into account the main part.

With the new formula if the plate fully fits in a direction (examples with x, same for y):
xUnits <= maxBedUnitsX
-> mainPartXUnits = xUnits
-> xUnits - mainPartXUnits = 0
-> no additional spare parts

This now gives
maxBedUnitsX 6 maxBedUnitsY 6
xUnits 7 yUnits 5
mainPartXUnits 6 mainPartYUnits 5
mainPartCountX 1 mainPartCountY 1
sparePartUnitsX 1 sparePartUnitsY 0

Screenshot 2026-08-31 at 23 36 49

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

Successfully merging this pull request may close these issues.

1 participant