Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check BOM on sheet

Status
Not open for further replies.

33456

Mechanical
May 23, 2007
10
How can i check on what sheet a bom is.
I have several sheets and several boms, only 1 on a pge offcourse.

please fill in the blanks ..

Sub checkbom()
Dim bom_aanwezig As SldWorks.Feature
Dim swBomFeat As SldWorks.BomFeature
Dim vTableArr As Variant
Dim swTable As SldWorks.TableAnnotation

Set swApp = Application.SldWorks
Set actDOC = swApp.ActiveDoc

Set bom_aanwezig = actDOC.FirstFeature

Do While Not bom_aanwezig Is Nothing
Dim tsoort
tsoort = bom_aanwezig.GetTypeName
If tsoort = "BomFeat" Then
Set swBomFeat = bom_aanwezig.GetSpecificFeature2
vTableArr = swBomFeat.GetTableAnnotations
Set swTable = vTableArr(0)
Dim aantalrijen
aantalrijen = swTable.RowCount
For i = 1 To aantalrijen
hoogteverstelling = hoogteverstelling + 0.0045
Next i
'End If
Set bom_aanwezig = bom_aanwezig.GetNextFeature
Else
Set bom_aanwezig = bom_aanwezig.GetNextFeature()
End If
Loop
End Sub
 
Replies continue below

Recommended for you

33456,

I do not know if you can find that out from the way you are doing it; I have never tried it. I did a semi-quick look through API help but could not find any straightforward method. In the past, I wrote a macro that cycled through each sheet, got the tableannotation object associated with that sheet and then got the BOMFeature object to get the BOM name.

Regards,

Regg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor