flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > nesting algorithms.

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4363
Location: Now
edfed 05 Jan 2026, 01:04
hi; happy new year.

then, about nesting algorithms, i wonder how it can be made using ... fasm.

then, i wonder, how it can be made using.. computers, and the best...
how it can be made.

because i need a lot this algorithm (i make furnitures for food) i am at the point where i want to make it my own way.

i need to cut boards to make panels, and in theses boards, i should optimse a lot of things.
there are a lot of solutions to make it. but as always, not any is convenient for me.
they all lack something. and i have a strong feeling about the powerness of this algorithm.


if you think about it in 1D, it is just about managing tasks on a timeline.

what is the prioritary task? the more power consuming. then, the bigger board should be cut first. or at least, it should be positionned first.

and so on.

as long as you add tasks (or boards, or packages, etc..) onto the shelves, you see that the biggests should be made first.

it is the basics of task management.
the harder should be made first.

then, i come to the code itself.
it is not really code because code is not so important. it is about the algorithms.

Code:
nesting:
.shapes:
80,60
80,60
80,60
240,15
180,15
75,20
75,20
75,20
38,10
38,10
38,10
38,10
38,10
38,10
180,40
180,40
178,40
60,40
38,40
38,40
.boards:
250,125
250,125

.cuts:

1       250×125 x=60
2       250×60  y=80 80×60
3       170×60  y=80 80×60
4       90×60   y=80 80×60 remain 10×60
5       250×65  x=15 
6       250×15  y=240 240×15 remain 10×15
7       250×50  x=15 
8       250×15  y=180 180×15 remain 70×15
9       250×35  x=20 
10      250×20  y=75 75×20
11      175×20  y=75 75×20
12      100×20  y=75 75×20 remain 25×20
13      250×15  x=10 remain 250×5
14      250×10  y=38 38×10
15      212×10  y=38 38×10
16      174×10  y=38 38×10
17      136×10  y=38 38×10
18      98×10   y=38 38×10
19      60×10   y=38 38×10 remain 22×10

1       250×125 y=180
2       180×125 x=40 180×40
3       180×85  x=40 180×40
4       180×45  x=40 remain 180×5
5       180×40  y=178 178×40 remain 2×40
6       70×125  x=40 
7       70×40   y=60 60×40 remain 10×40
8       70×85   y=38 remain 32×85
9       38×85   x=40 38×40
10      38×45   x=40 38×40 remain 38×5



input:
.shapes
.boards

output:
.cuts

shape:
.name
.xl
.yl

board:
.name
.xl
.yl

cut:
.shape
.board
.x
.y

render:
.frame
.name
.x
.y
.xl
.yl
.color


;for 1 dimension
area:
;xl,yl
;return area of piece or board
makebucket:
;extract list of pointers to datas for bucket sort
bucketsort:
;sort a list of numbers using buckets, this list is used to point to datas
split:
;cut piece from board
;return position and remaining boards
fit:
;take a sorted list of numbers and fit them in one number
;return a string of fitted numbers, and a string of non fitted numbers

;for 2 dimensions
shapeSort:
;optional sort by shapes, Horizontal, Vertical or Square
ratioSort:
;optional sort by ratio between H and V dimensions
areaSort:
;sort by area


    


in this code, i will try to make the best fit of the panels inside boards. but before, i'll make a 1D nesting to fit execution times and files on hard disks, i'll also try to make a generic algo to optimise 1D parameters on a line.
then, try to make it 2D, 3D, and 4D.

in the 4D i think it is about storage in hubs, where you have spaces on shelves for a time, and the next day, all changes. if you manage it correctlly, you can optimise the flux of goods everywhere.

happy new year.
Post 05 Jan 2026, 01:04
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.