[Home] [Puzzles & Projects] [Delphi Techniques] [Math Topics] [Library] [Utilities]
A "Cut List" shows how to cut a given set of parts from a given set of available
stock. This program creates a diagram showing the stock pieces and how the
required parts may be cut from them.
Background & Techniques
This program was originally written 10 years ago, in 1993, to solve a particular woodworking problem. This year I'm making picture frames for motivational posters for our 7 grandkids and needed to decide whether to buy the backing and Plexiglas pieces precut or cut it myself from 4'X8' sheets. (Only 6 pieces 22"x28" can be cut from a sheet, so precuts were a better choice.)
I decided to update and publish the program for others to play with. I have included several sample files which should make things clear. A couple of potentially confusing points:
Non-programmers are welcome to read on, but may want to jump to bottom of this page to download the executable program now.
Many changes have taken place in the past 10 years - in computer speed more than in Delphi. The original 1993 program used an OnIdle exit, DoIt, to force processing into the background and had a fairly elaborate record mechanism to save state information between calls. An OnIdle exit must relinquish control back to the system fairly often in order to avoid impacting other applications and therefore must be able to pick up where it left off at each entry. All of that code was removed in the current version because computers are 10 times faster today. Logically, DoIt could now be merged into the Solve procedure which does the initial search setup. This has not been done.
Two classes defined the parts: TBoard contains dimension information for a board and TBoardList is a TStringList descendant which contains the boards as TBoard Objects attached to each entry. The Strings associated with each entry contain a string version of the current sort field. TBoardList objects are used for several purposes, they contain the lists of required parts, the available supply, the leftover pieces after each piece is cut (which are merged back into the supply list for possible use in cutting more pieces), and for working and "best" versions of these lists.
I cleaned up the graphics some and made the drawings respond to resizing. Most other code is the way it was written 10 years ago. I'm also sure that any bugs you find are the result of errors made 10 years ago and not during the current revisions. Surely not!
Addendum January 15, 2005: A few needed fixes were posted today to create Version 2.
Addendum February 20, 2005: Version 2.1 posted today includes two nice enhancements suggested by users:
I also fixed a bug or two in the way that Combination solutions are calculated.
Addendum March 3: 2005: An international user pointed out that the Sample projects included in the downloads would not load properly because of the decimal point difference. The January fix generalized the decimal separator field so that files created in Europe could be read there. It never occurred to me that my samples, which already contain the "proper" decimal point (.), would not read properly in Europe. Version 2.1.1, posted today, corrects this problem by identifying the decimal separator of the creating system in each project file. I also corrected a problem which added an extra blank space at the beginning of each part name each time the project was saved. It is good to have real users!
Addendum April 14: 2005: Several users had requested an easier way to enter multiple parts that have the same dimensions. Today's update solve this by adding a "How many" box for New, Insert, Duplicate requests.
Addendum January 20, 2006: Here's the first update in several months. No bugs to fix, just added some of enhancements requested by users. Version 3.1 adds
Let me know when you find bugs or have additional suggestions.
February 10, 2006: I found a bug or two (or 10) in the January 20th version so here's Version 3.2. which fixes at least some of them and also adds two more significant features:
May, 11, 2006: A couple more minor fixes today (Version 3.2.1);
May 25, 2006: One more "fix-up", Version 3.2.2 to correct some printing problems when part names are long (columns overlapped). I also added an option to allow users to select which lists/diagram to print. The "scrap" parts list may now also be printed. It is good to have real users planning real projects to find these things.
June 1, 2006: Viewer Ted has been a good beta tester resulting in one more attempt at getting multiple page printing to work. He designed a twin and full sized bed frames with lots of parts (176 as I recall) and wanted to print the solution diagram in landscape mode on legal size paper to maximize the scale. Version 3.2.3 solves the problem, at least for this case. The bed frame project is also included so I'll have it for future testing. Ted has offered the PDF file containing the plans if anyone is interested.
July 31, 2006: Version 3.3 posted today finally implements a "Human Intelligence" option which allows users to arrange parts on supply pieces as desired. There are cases where the program generated solution may not be satisfactory for one reason or another. A new pages allows drag/drop operations to place required part images on available supply board images. Optionally, parts may be "snapped" into position - automatically moved up and left as far as possible without overlapping parts already in place. Solutions may be printed and saved to disk to be restored later. When a solution is restored, parts are matched the the currently loaded case. Be aware that human intelligence solutions are currently "read only". Changing any part definitions after saving a human intelligence solution will probably invalidate that solution. If parts have changed in size or identification (e.g. have been renumbered) , the re-loader does not know which parts to place in which locations.
A tip: If you are trying to place pieces that "just fit" on the supply piece, i.e. no tolerance, consider expanding the defined supply piece size by a fraction. It is difficult to position and drop the piece exactly while manually dragging.
October 3, 2006: Viewer Andy reported a couple of problems with the popup menus are used to modify a case. Left click opened the menu, but an accidental double click not only opened the menu but deleted the selected entry. And if the last entry in a list were accidentally deleted, there was no to undo or add it back. I haven't implemented the "Undo" yet, but I did make changes so that a left click now only selects the item to be acted on, and a right click pops up the change menu. Also if all items have been deleted, it is now possible to select the list header line and use "Insert After" option to add an entry.
February 18, 2007: Another minor fix applied today, Version 3.3.2. For a case with no solution, if the "Cutwidth" or "Minimum waste size to report" fields were modified, the program repeatedly tried to solve the case. I never did find the bug, so I went around it. There is now a separate "Search for solution" button rather than using the "Search type" radio buttons to trigger the search.
May 28, 2007: I finally decided to revisit the basic search algorithm and made some significant improvements in the quality of solutions found. Here is a summary of the changes in Version 3.4:
There were significant changes internally to the program with this update so, as usual, let me know what I may have broken in the process.
July 2, 2007: Fixed a few problems today with the "Paste program solution" option which had trouble displaying, printing, or saving the the results when any pieces had been rotated. It seems closer to working correctly now. Thanks to Mike for submitting the case which illustrated the problems. (Mikesdraws.txt defining his kitchen cabinet project is now included.) New Cutlist version is 3.4.1.
October 5, 2010: Over 3 years since the last fix . Version 3.4.2 corrects a problem which can occur if the user tries to load "txtHI", (user manually created solution) without loading the original base case file first. The situation was not diagnosed and the loading errors got ugly. I believe it's diagnosed better now, but I haven't done a lot of testing on the fix, so let me know if you find problems (old or new).
January 14, 2010: The October release fixed one problem, but introduced another. Existing "TxtHI" manual solutions could be updated but new ones could not be saved. Version 3.4.3 released today fixes that problem.
June 6, 2012: A couple of minor printing fixes corrected today - so minor that I'm not updating the version number. But printed diagrams now have a slightly wider part outlines to improve visibility. And the extra blank page preceding printed diagrams under some conditions has been eliminated.
Suggestions for Further Explorations
Copyright © 2000-2013, Gary Darby
All rights reserved.