Cut Plan Macro

We build cabinets. Our Assemblies are NOT weldments.

Our CNC programmers make spread sheets their cut plans manually.

They were wondering if there was a macro that could be run on a cabinet assembly that would:

  1. List all the parts/panels in an cabinet assembly
  2. Get the size of each part/panel (Thickness, Depth, and Width)
  3. list out everything in a spread sheet

EX:

BEL-1492-TP-X 1.188 24.000 48.000

BEL-1493-BK-X .750 16.000 48.000

BEL-1494-BT-X .750 24.000 48.000

BEL-1495-SD-X .750 24.000 16.000

I received this in a batch of macros from John Stoltzfus. Based on the name, and how much stuff is in there, I think it will do what you want, or at least give you a good start. I haven’t tested it. You would need to add bounding box dimensions to your BOM template.
BOMtoExcelV3.swp (188 KB)

1 Like

John had that stuff locked down good. I would have been looking at the bounding box and having that info come in as part of the description some how. I was working that out for some Sheetmetal parts a few years ago. It would have been nice.

I’ve tried to run this with no success. Probably just missing something simple.

I have my assembly, all parts have bonding boxes, I made a temporary drawing.

I’ve run the macro on the assembly and drawing and get this error:

It looks like it is missing a reference to a macro which I don’t have.

If I were going to do this, I would create a drawing, insert a BOM with bounding box dimensions, then export that BOM to excel. I’m pretty sure all of that can be automated, but I don’t have any code to share.

Yep! That’s what I’m looking at. you’ve have helped me out a lot!

1 Like

Opened the drawings and ran the macro.

Promted me for:

initials

Assembly qty

confirm BOM template location

then

I read the notes in the macro and it said:

'Default save location. Must append \ at end. Leave blank to save in same location as cad file.
Const sDIR_SAVE As String = “”
'Folder + file name + extension of BOM template (.sldbomtbt). Leave blank to use SW default?

I think the macro is meant to be run from an assembly model, not a drawing.

1 Like

Yes it is!

I ran it on an assembly and got really excited.

And it list all the items, part no, description, qty but no bounding box info.

So close!

There are several approaches to get the boundingbox info in your parts. It depends on your use case really which one to pick.

If your previous projects have been handled by getting the measurements in one way or another and you only want to focus on future projects, i would advise to use templates for your parts in which you define Thickness, Depth, and Width linked to the appropiate dimensions.

Is it ok for you to only work on future projects/parts?

Eddy

1 Like

Added some bounding box info.

Tools → References → Microsoft Excel 16.0 Object Library

Bounding Box BOM to Excel.swp (68 KB)

3 Likes

@DeDum nice work !
On my pc i had to change the following line to make it run correctly and fill in the xyz in Excel:

'Todo fix or error check this
bNumRow = xlSH.UsedRange.Rows.count
'UsedRange is the rectangular block of cells that actually contains data or formatting.
'using this you don't need to hardcode the available number of Rows and it will work on different excel versions (see below)
’    bNumRow = xlSH.Range(“D1048576”).End(XlDirection.xlUp).Row 
’this line gave me always 1 leading to not populating the cells with xyz

I’m running Excel 64bit. you can check your excel version using this function:

Sub CheckExcel32OR64Bits()`
   #If VBA7 Then
     #If Win64 Then
          MsgBox “You are running 64-bit Excel”
     #Else`
          MsgBox “You are running 32-bit Excel”
     #End If
   #Else
       MsgBox “You are running an older 32-bit version of Excel”
   #End If
End Sub
1 Like

I swapped out that 1 line and it works as expected!

Thank you both!

I know I’m asking a lot and I should probably learn to write these macros myself but…

It’s 90% of what I need.

We model our part in real world orientation for assembly ease. This throws the output dimensions from the assembly in a different order. I found how to sort the excel but can that be written into the macro?

Additionally, can the assembly configuration name be read in the column following the assembly name?

The end goal is that the excel look like this:

@Eddy_Alleman Thanks - That should work great.

Updated to V3. Left the previous because this one is harder to read.

V2:

  1. Tried to get last bom row more dynamically.
  2. Try not to alter imported BOM data so that it will work with any BOM template.

V3:

  1. Added column for active config
  2. Separated code that creates new columns so they can be commented out if not wanted

Bounding Box BOM to Excel V3.swp (130.5 KB)

2 Likes

I’m not understanding the sort. Think you can run a sort in vba with: xlFULL.Application.WorksheetFunction.Sort()