How many lengths of material to order? Here's a macro to answer!

You've drawn a weldment and are wondering how many lengths of steel to order?

Solidworks gives you the total length - but that doesn't really help most of the time.

I've written this macro which you run against a part or assembly.  You enter the amount of material you are likely to waste on each cut (a few mm) and the length your supplier offers that section - 6m for example - for each size.

It starts with that length and subtracts lengths from the cut list until there is not enough left to fit any of the bits from the cut list in and starts a new length - and so on until all the items in your cut list have been 'cut'

It pops up a message box showing the number of lengths of each section required plus the amount of wastage.  This is useful to decide if it's better to order say 6m or 16m lengths, based on the wastage.

Lastly, it writes a text file showing the following:

Bill of Materials:

100x50x3.5 RHS C350 -     4650mm     Angle 1: 45°     Angle 2: 45°     Qty: 2

100x50x3.5 RHS C350 -     625mm     Angle 1: 45°     Angle 2: 45°     Qty: 2

100x50x3.5 RHS C350 -     250mm     Angle 1: 45°     Angle 2: 0°     Qty: 4

......

Optimised Cutting List:

RHS200x200x10

Length: 1 (16000mm) - 3650, 3650, 2300.49, 2300.49, 2280.13, 771.13, 771.13,

Length: 2 (16000mm) - 2280.13, 2064, 2064, 313.22, 313.22, 308.57, 308.57, 308.57, 308.57,

RHS80x80x5

Length: 1 (16000mm) - 3039.77, 3039.77, 3033.49, 3033.49, 1514, 1514, 717.98,

Length: 2 (16000mm) - 1485.74, 1485.74, 1485.74, 1485.74, 1482.76, 1482.76, 1482.76, 1482.76, 1000, 1000, 891.85, 849.97,

Length: 3 (16000mm) - 827.86, 717.98, 717.98, 717.98, 653.44, 653.44, 635, 635, 627.18, 627.18, 627.18, 627.18, 510.52, 510.52, 469.85, 469.85, 469.85, 469.85, 431.28, 389.39, 389.39, 389.39, 291.13, 291.13, 291.13, 291.13,

........

Summary:

RHS200x200x10 - 2 x 16000mm Lengths    With 7848mm Left over.

RHS80x80x5 - 3 x 16000mm Lengths   With 2310mm Left over.

....

I've also added a .bmp you can use as an icon (if you like) when you add the macro to a toolbar

Hope you find it useful!

Si

SolidworksApi macros