BOM Experts - Possible to export SW BOM?

Still in two minds about sw BOM or Excel BOM

The Excel BOM can be exported but is a 'pig' to work with on screen within SW. I seem to remember before 2006 that you could work on a Excell BOM outside SW and so save on all the graphic problems of scalling it to be visible on a screen oir am I dreaming.

SW BOM easier to use on screen - but can I export it so I can import data into a seperate word file or excell file for documentation?

Thanks in advance for any pointers

TTFN

Jonathan

Reply to
jjs
Loading thread data ...

I wrote a macro that generates the data I need apart from any SW functionality.

Reply to
TOP

Would you be willing to share it ?

Does it export it as a form that can be easily tabulated in another common programme and can be used by a non computer literate person like myself?

TTFN

Jonathan

Reply to
jjs

in sw2005 you could save the BOM as ".txt" file, then import that into Excel. Everything is fine except column widths, and text justification, both of which just takes a few seconds to redo in Excel. I would assume sw2006 still does this.

bill

Reply to
rider89

Thanks for that Bill - I learn something everyday - It worked fine and as you say it takes no time to layout the excel once the data is imported.

TTFN

Jonathan

Reply to
jjs

Just last week there was a similiar thread.

Search for:

TIP: Import SW native BOM into Excel

simply highlight the BOM table then File/SaveAs (defaults to template but pull down for .csv or .txt

Reply to
George

Just last week there was a similiar thread.

Search for:

TIP: Import SW native BOM into Excel

simply highlight the BOM table then File/SaveAs (defaults to template but pull down for .csv or .txt

Reply to
George

Below you find the macro is use for exporting directly into excel for further processing. It is snatched from from the api help and just slightly modified. All it does is open excel and copy the bom into a new sheet (SWX2005).

Matze

==============================================

Option Explicit

Public Enum swBOMConfigurationAnchorType_e swBOMConfigurationAnchor_TopLeft = 1 swBOMConfigurationAnchor_TopRight = 2 swBOMConfigurationAnchor_BottomLeft = 3 swBOMConfigurationAnchor_BottomRight = 4 End Enum

Public Enum swBomType_e swBomType_PartsOnly = 1 swBomType_TopLevelOnly = 2 swBomType_Indented = 3 End Enum

Public Enum swTableSplitDirection_e swTableSplit_None = 0 swTableSplit_Horizontal = 1 swTableSplit_Vertical = 2 End Enum

Dim xlApp As Object

Sub main() Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swDraw As SldWorks.DrawingDoc Dim swSheet As SldWorks.Sheet Dim swFeat As SldWorks.Feature Dim swBomFeat As SldWorks.BomFeature Dim sPathName As String Dim nNumSheet As Long Dim nRetval As Long Dim i As Long Dim bIsFirstSheet As Boolean Dim bRet As Boolean

Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc Set swDraw = swModel bIsFirstSheet = True

Set xlApp = Nothing On Error Resume Next Set xlApp = GetObject(, "Excel.Application") On Error GoTo 0 If xlApp Is Nothing Then Set xlApp = CreateObject("Excel.Application") End If

xlApp.Visible = True xlApp.Workbooks.Add

Set swFeat = swModel.FirstFeature Do While Not swFeat Is Nothing If "BomFeat" = swFeat.GetTypeName Then Set swBomFeat = swFeat.GetSpecificFeature2 ProcessBomFeature swApp, swModel, swBomFeat End If Set swFeat = swFeat.GetNextFeature Loop For i = 1 To 5 xlApp.ActiveWorkbook.ActiveSheet.Columns(i).AutoFit Next i Set xlApp = Nothing End Sub

Sub ProcessBomFeature(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, _ swBomFeat As SldWorks.BomFeature)

Dim swFeat As SldWorks.Feature Dim vTableArr As Variant Dim vTable As Variant Dim swTable As SldWorks.TableAnnotation Set swFeat = swBomFeat.GetFeature

vTableArr = swBomFeat.GetTableAnnotations For Each vTable In vTableArr Set swTable = vTable ProcessTableAnn swApp, swModel, swTable Next vTable End Sub

Sub ProcessTableAnn(swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, _ swTableAnn As SldWorks.TableAnnotation)

Dim nNumRow As Long Dim nNumCol As Long Dim nNumHeader As Long Dim sHeaderText() As String Dim i As Long Dim j As Long Dim k As Long Dim nIndex As Long Dim nCount As Long Dim nStart As Long Dim nEnd As Long Dim nSplitDir As Long

nNumHeader = swTableAnn.GetHeaderCount nSplitDir = swTableAnn.GetSplitInformation(nIndex, nCount, nStart, nEnd) If swTableSplit_None = nSplitDir Then nNumRow = swTableAnn.RowCount nNumCol = swTableAnn.ColumnCount nStart = nNumHeader nEnd = nNumRow - 1 Else nNumCol = swTableAnn.ColumnCount If 1 = nIndex Then nStart = nStart + nNumHeader End If End If

ReDim sHeaderText(nNumCol - 1) For j = 0 To nNumCol - 1 xlApp.ActiveWorkbook.ActiveSheet.Cells(1, j + 1).Value = swTableAnn.GetColumnTitle(j) sHeaderText(j) = swTableAnn.GetColumnTitle(j) Next j

For j = nStart To nEnd For k = 0 To nNumCol - 1 xlApp.ActiveWorkbook.ActiveSheet.Cells(j + 1, k + 1).Value = swTableAnn.Text(j, k) Next k Next j End Sub

Reply to
Matze

If you find it takes more than a few seconds to tart it up in Excel, then what I do is open up the exported text file in Excel, copy all the relevant cells to the clipboard, then open up a fully formatted template and use "paste special" with the "values" option to paste the data whilst retaining the formatting.

John Harland

Reply to
John

Jonathan,

I had this problem a while back and our local dealer had to scatch his head for a while. It's somewhere you would never think to look, For the life of me I cannot see why programmers do this sort of shit to the users??

Right click on BOM Table Header at top Choose Save as Template, Under save as type there are options for

*.sldbomtbt *.txt *.csv
Reply to
Neville Williams

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.