Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng 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
Joined
May 23, 2007
Messages
10
Location
NL
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
 
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

Back
Top