Jump to content

Rectangle Packing 1.0.4

   (1 review)

5 Screenshots

About This File

The heart of this Marionette example is the RectPack node. A node with over 2600 lines of code! 

It supports dozens of packing algorithm to pack rectangles on another rectangular area in a space and time-saving way. 

The right combination of packing and bin algo gives the ability to pack rectangles in a way you want to have them on your machines (as close as possible, always cut complete board, less cuts etc.)

 

Actually not even myself know, which packing algo ist right for which use case. 

Also for professional use case, usually there is a machine dedicated software, which packs the port in a way which match best for the machine. 

So I see the main use case to pack parts on a board for milling them on a cnc-machine as example for model-making. Workflows which uses a guillotine-workflow (always cut the whole board) often have special requirements which maybe could be reached with the choice of packing algorithm or maybe can not. 

 

The Marionette Example based on foundational work:

http://www.secnot.com/   Python code for packing algorithm

Jukka Jylang - A Thousand Ways to Pack the Bin - A Practical Approach to Two-Dimensional Rectangle Bin Packing (2010)

Huang, E. Korf - Optimal Rectangle Packing: An Absolute Placement Approach (2013)

 

General Features:

- Input of basic data like length and width

- Input of additional data

- object input (node detects if part input are objects and process them like rectangles)

- sort by material

- use a list of stock materials

....

 

Not all input combinations works at the moment. Recommended to use the existing examples to get correct input values.

German Movie
https://youtu.be/yyZGvazL7Ik

 

Edited by DomC


What's New in Version 1.0.4   See changelog

Released

1.0.3
corrected script for an error that was shown, if column C "PartName, TeileName" is not a number.

1.0.4
Now the Column "Drehbar" (Rotateable) in die Board list works as expected. If the Checkbox "Rotation erlauben" it checks for the Material List Value 0 or 1. If "Rotation erlauben" is not checkt it do not check the Column in Material list. So choose "Rotation erlauben" and make it 0 or 1 in the Material list in .

Additional Upload v2023 Version.

  • Like 12

User Feedback

Recommended Comments



Some Screenshots of a carpenter who uses this for cutting arrangements.

So great to see, how other people uses those technology (and days of work) to improve their workflows. http://www.garzotto-ag.ch/

 

Screenshots attached

 

5a3ae63760824_TheProject.thumb.jpg.60817b8488f6de241e3c3752acbbb426.jpg

 

5a3ae65fa7b02_CuttingArrangement.thumb.jpg.577834b88bcaf5d2876418e2ebf1a063.jpg

 

5a3ae673141de_Stackedworkpieces.thumb.JPG.8a9c5d8c601aa0903a272a6151018fb1.JPG

 

 

 

 

 

 

Link to comment

Hi,

Ich benutze dein Programm um in unserer Firma Plattenzuschnitte zu optimieren und bin begeistert.

Allerdings bekomme ich bei der Variante WorksheetInput, also die Eingabe über die Tabelle immer eine Fehlermeldung.

Vielleicht schaust du dir das mal an!

 

Danke für deine echt coolen Programmierungen die du hier veröffentlichst, von diesen benutze ich einige um mir den Arbeitstag zu erleichtern!

 

🙂

Link to comment

@Gescher

Hallo

Ich kann mir das gerne anschauen. Es gibt zwei Tabellen-Inputs. Einerseits die Teileliste, andererseits eine Plattenliste um für verschiedene Materialien, verschiedene Plattengrössen zu definieren und um zu sehen, welche Platten bestellt werden müssen. Wobei man auch bei der Lager-Liste Stk 1 verwenden darf, wenn man das nicht braucht.

 

Also Board-List ist der Platten-Lagerbestand und Stückliste-Küche ist die Stückliste. Es könnte dann Fehler geben, wenn die Spaltenreihenfolge nicht stimmt, die Zahlen mit Komma getrennt sind (7,1 statt 7.0). Poste doch mal Deine Beispieldatei und Beispieltabelle.

Link to comment

This looks great! Would it also be possible to use this principle for fitting furniture in a room?

 

Link to comment

Hallo DomC,

Vielen Dank für dieses sehr nützliche Tool.


Ich habe festgestellt, dass es ein Limit für die Anzahl der Ausfahrtsschilder gibt.

Nach 20 Platten "boards_out" die Berechnung stoppt und der Rest wird ausgelassen
Wissen Sie, wo ich die Anzahl der Ausgangsfelder im Code anpassen kann?
Vielen Dank im Voraus

Raphael

Capture_06_28_2021_084042.png

Link to comment

Hi
Oups, did not thought about that limit. There was a plan to implement code for checking stock material. That code was not implemented completely and there was set a constant maximum of boards per material of 10. And the Standard input of material was 2. So this results in 20 Boards. As a short fix you can change the code on apprx line 2474 to

 

max_board = 100

or more if needed. But this needed to be fixed in the node anytime I take time for that.

Link to comment

Hi Dom,

Thank you for your answer
As you can imagine it works.

 

Now I have a problem with the "worksheetInput_Example" file.
I think it comes from the version of vectorworks 2021 !?

Because I opened it with the 2020 version and it worked

 

Can you look at what's going on?

Thanks in advance

Link to comment
On 8/6/2021 at 9:44 AM, Raph said:

Now I have a problem with the "worksheetInput_Example" file.

This File "WorksheetInputExample_v2" (without any changes) runs without issues here in 2021. Can you attach your File here?

Link to comment

Hello
Aha, you really take the Original File. So the issue could be related to the following:
1. Platform (Mac Win)
2. Country-Settings (dezimal seperator is point here)
3. Vectorworks Version (I have German SP4)
4. Program Settings (more or less Standard)

Ah see the issue while I am writing here. On my windows computer it hangs since over a Minute. Seems to be the issue can be confirmed on windows here too. Thanks, I will update for any news.
 

 

Link to comment

Ok
1) I work on Mac. It sure can make a difference but it used to work with the 2020.
2) I work with the separators in dot mode.
3) The version I use is in French.
4) I can't help you there, please give me more details on what you need to know.

I'm not really sure I didn't modify the raw panel list and part list. But I'm sure it was working.

I hope I can help you find the problem

RAph

  • Like 1
Link to comment

Challenge Question

I would like to cut out these 50 layers on the CNC. How would you do it?

I tried to use your tool with these shapes but it doesn't work. I think they are not rectangles so it's impossible for the program to calculate that!

 

the work is already done but I'd like to do a smaller one

 

The idea would be to find an easier and faster method than the one I did.


Because I took each layer one after the other to extract the surface and place it manually on a panel. Then I exported a cutting file for each panel with 3-5 shapes.

 

What do you think about it?

 

RAph

WhatsApp Image 2021-08-07 at 14.08.41.jpeg

Link to comment

Cool

 

Spontaneously  I would say, It has to go this way since we have no other Marionette:
1. Unfold (Extracting Tool) Click on every shape and extract planar shapes
2. Put them on screen-plane (Infopalette)
3. Or alternatively there would maybe be a quite simple script to put every shape on a different layer (maybe not, because the pathes may be NURBS and they are not CNC-compatible)

4. Next exporting DXF and (I don't like to say) import it in an other software to nest those polys. 
maybe this one, looks free and looks at it runs on macintosh:
https://deepnest.io/

just downloaded it looks promising good!
Edit:
Seems that every DXF have to be imported one by one manually. Also it needs some settings (units). Did not testes, It did not work after one Minute.

5. Some CNC-CAM-Software could automatically extract your 3D Model (export Parasolid)

The really cool thing would to have a poly-nest similar to the rectangle-nest. There is open-source-code for this available so it would not be a project from scratch. Also this would allow us, for automating the complete process. That would be my next project if I would find the time because that is also a kind of project that is interesting for me.

 

Edited by DomC
Link to comment

OK
Just tested that application.
1. Import units should be set in the settings to mm
2. The sheet(board) must be added or imported by dxf

So far, then it works. It seems to be a try and error algorithm, because it uses quite a while. Would be nice, to have a tool like this directly implemented in Vectorworks (also something, that can be handled by script/marionette)
 

Bildschirmfoto 2021-08-09 um 18.32.01.png

Bildschirmfoto 2021-08-09 um 18.44.44.png

Bildschirmfoto 2021-08-09 um 18.45.27.png

 

 

Source code nesting algorithm, seems to be java:
image.png.9dbb209bd8779234ff1472d21ad7ac65.png

Edited by DomC
  • Like 1
Link to comment

Hi dom

Thanks for your answers and your interest.

first of all, did you update your "WorksheetInputExample_v2" file?


Thanks for your advice,
I installed deepnest and tried to import dxf.
No dxf file opened.
I tried with lines, surfaces, only the surface extractor.
really weird.
but it must be a good tool and very handy.

it would be really nice if vector works would do the surface calculation directly. I am unfortunately not strong enough in python to do this.

I will try again


Thank you Dom
++Capture_09_12_2021_120643.thumb.png.f79aba12ac4df7426ed39ebdae7cd799.png

Link to comment
On 8/22/2021 at 1:39 PM, Raph said:

Hi dom

Thanks for your answers and your interest.

first of all, did you update your "WorksheetInputExample_v2" file?

 

 

I was able to reproduce the "freeze" on my computer also with VW 2020 and VW 2021. It seems it freezes by wrapping the Network to a Object Node before the code runs. So the Code is all right, it is the Wrapping-Technique, which produces a problem. I will submit a Bug for that.

I deleted the empty pass nodes and deleted the name of the Wrapper of the Worksheet Wrappers. Those Wrappers and nodes produces empty outputs in the network, which maybe is results the appHang.

New Version 1.0.1 of Worksheet Input Example Created for Vectorworks 2020/2021

Edited by DomC
Link to comment

Hi
It should still work in 2023 from my view. Which one you try to use? With the Worksheet input there could be an issue, if part numbers are no numbers and if values are seperated with comma instead points. 

I made a short test with input by layer and worksheet v2 both are working here.
The others are old versions for 2019 or 2020. Sorry, the Versioning is not clear. v2 is newer than 1.0.1

Link to comment

omg
By this occasion I see the Movie here by movie-time 1.0.5.  We can see, the Model of the Start-Picture of Vectorworks 2023! How time is running😁



 

  • Love 1
Link to comment
On 8/9/2021 at 6:30 PM, DomC said:

The really cool thing would to have a poly-nest similar to the rectangle-nest. There is open-source-code for this available so it would not be a project from scratch. Also this would allow us, for automating the complete process. That would be my next project if I would find the time because that is also a kind of project that is interesting for me.

 

 

 

  • Love 1
Link to comment

grafik.png.d8dfcc3c8f84c341b066dca7ef77e3e2.png

 

grafik.png.fe6e280877b3a969b91c4e75f5bd9df8.png

Diese beiden Fehlermeldungen kommen bei mir, ich habe aber an der Datei (worksheetinputs) nichts verändert. die Opjectinput datei funktioniert bei mir auch.


 

 

 

 

Diese Fehlermeldung kommt obwohl ich nichts an der Datei verändert habe. ich wollte nur eine anderen Nesting Algorithmus auswählen und dann kommen diese Fehlermeldung .

 

Es wäre wirklich super wenn man direkt in Vectorworks anordnen könnte und vorallem nachträglich noch verändern kann, das ist bei meiner aktuellen Zuschnittoptimierung nicht möglich und dann auf dem Papier echt nervig.
 

Richtig großartige Zusatzfunktion wäre noch gruppen bilden zu können die zusammen platziert werden würden ( für z.B. Durchgehende Maßerung oder um  mehrerer Fronten zusammen mit Schichtstoff zu belegen.

 

Wäre wirklich super diese Marionette nutzen zu können, vorallem nachträglich daran noch etwas verändern zu können. Die ist eine Funktion die bei unserer Vectorworksexternen Optimierung häufig nervt weil einfach nicht möglich.

 

Viele Grüße aus Freiburg im Breisgau

grafik.png

Link to comment
On 7/5/2023 at 12:51 AM, DomC said:

Hi
It should still work in 2023 from my view. Which one you try to use? With the Worksheet input there could be an issue, if part numbers are no numbers and if values are seperated with comma instead points. 


Seems like this is the case here. On windows OS, some Input Fields convert to comma decimal separator. 
Der Input darf keine Kommas als Dezimaltrennzeichen haben. Das scheint aber hier auf Windows der Fall zu sein wie schon im ersten Kommentar erwähnt.

 

  • Like 1
Link to comment

Edit:
Added a New Version 1.0.2. where the script tries to convert non-valid cell numbers to numbers. The script tries to convert every cell so I hope this has no other negative effect. However the the existing Example is Version 2023 and works also on my Windows System with Swiss-German and German Keyboard Layout (Switzerland uses Decimal seperator ".", Germany uses ","). 

Link to comment

Hi Dom

I recently downloaded it and it works a treat, I got to poke at it a little and wrote a short sheet(same rows like the original) in Excel and imported it. The marionette still works as before just every time I refresh the following error message shows up. 
( In the code I changed Max boards from 10 to 100) don't know if it plays a part...

 

 

Bildschirmfoto 2024-01-16 um 13.16.50.png

Link to comment

The Message says that it tries to add a float to a string ('100mm' + 10, 'hello' + 100) etc. Maybe the type of value in the sheet is not the same like in the sheet that works? Also I think it could related to a VW update. I provided a 2023 1.0.2 to fix that issue.

Uploaded a New Version, which uses "vs.ValidNumStr()" for Every cell. So if A cell contains no valid number, Vectorworks tries to convert to a number.

Do you use that fresh version or an older one?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Add a comment...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...