How do you access the part number that will show up in the BOM for a specific component. For example: I am in a drawing, and want to open a specific part. Get its part number and search an excel spreadsheet to get our database description for that part. Does anyone have a quick example or something. Thanks.
Corey Scheihc
Didn't find your answer? Ask the community — no account required.
S
Sean Phillips
using solidworks api
1.drawingdoc::getfirstview "get the first drawing view"
2.View::Getbomtable "check for a bom table and get it"
3.view::getnextview "get next view and so on"
4.View::Getbomtable "check for a bom table and get it"
5.bomtable::attach3 "you must gain access to the bom in order to read it"
6.gettotalcolumncount "get number of columns"
7.gettotalrowcount "get number of rows"
8.getentrytext "using the Getbomtable object" & "columncount" & "rowcount"
9.bomtable::detach "release the bom"
for exp.
for i = 1 to gettotalcolumncount
for k = 1 to gettotalrowcount
mystring = Getbomtable.getentrytext(k,i)
debug.print mystring
next k
next i
C
Corey Scheich
Don't worry I got it.
Sub GetConfigNameInBOM()
Dim swApp As SldWorks.SldWorks Dim swDoc As SldWorks.ModelDoc2 Dim Config As SldWorks.configuration Dim BOM_Name As String Dim ANameOn As Boolean
Set swApp = Application.SldWorks Set swDoc = swApp.ActiveDoc Set Config = swDoc.GetActiveConfiguration
ANameOn = Config.UseAlternateNameInBOM
If ANameOn Then BOM_Name = Config.alternateName If BOM_Name = "" Then BOM_Name = Config.Name End If Else BOM_Name = swDoc.GetTitle End If
End Sub
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.