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)
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.
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.
'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?
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?
@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
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?