So it's much more complicated than I thought, I'm fiddling with Esoxrepublic's BOMtoClipboard MACRO but I can't get it to run, not even the original file.
I tried to run it with SW 2014 SP0.0 and SW2012 too, but the macro appears not to run at all, I don't get any messages. I tried with SW standard sheets and standard BOM and with my custom ones...
Would a kind soul test it to see if it is just my SW that isn't running this MACRO? (http://www.esoxrepublic.com/freeware/macros/BOMtoClipboard.swp )
Thanks a lot!
Dim PickPt as Variant
remember that pickpt has an x, y, and z to it even though you are working on a 2d drawing.
PickPt = DRW.GetInsertionPoint
Finally I had the time to finish this, in case anyone is interested:
The code to get the number of rows of the BOM:
Private Sub subBOMrows() On Error Resume Next Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc Set swDraw = swModel Set swSheet = swDraw.GetCurrentSheet Set swFeat = swModel.FirstFeature BOMcount = 0 Do While Not swFeat Is Nothing Set swBomFeat = swFeat.GetSpecificFeature2 If Not swBomFeat Is Nothing Then BOMcount = BOMcount + 1 End If Set swFeat = swFeat.GetNextFeature Loop BOMcontent = swBomFeat.GetTableAnnotations Set swBomAno = BOMcontent(0) Set swTable = swBomAno BOMrows = swTable.RowCount Debug.Print "Number of rows: " & BOMrows End Sub
And then to set the point right above the BOM:
Private Sub definePoint() Global PickPt(3) As Double Global coordY As Double coordY = BOMrows * RowHeight + 0.034 '0.034 is the standard titleblock height PickPt(0) = coordX 'this is set according to the sheet size PickPt(1) = coordY PickPt(2) = 0 End Sub