|
|
API VBA: Getting BOM Part NO.
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
|
|
0
|
|
|
|
Reply
|
Corey
|
8/5/2003 9:00:35 PM |
|
"Corey Scheich" <cscheich@garlockequip.com> wrote in message news:<bgp5o8$r8g8p$1@ID-200385.news.uni-berlin.de>...
> 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
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
|
|
0
|
|
|
|
Reply
|
sldprt
|
8/13/2003 6:21:37 AM
|
|
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
"Corey Scheich" <cscheich@garlockequip.com> wrote in message
news:bhdgaf$10r320$1@ID-200385.news.uni-berlin.de...
> Thanks Sean,
>
> I may be able to use that later. What I want to do is search an Assembly
> Tree or Drawing Tree for a part in which the Specified Part number matches
> what the user types in a text field. For example I know from the BOM in
a
> drawing that a certain part's Part# is 421994 but I don't know what the
> drawing name is but I want to open that part and add or change the
> description. All of our manufactured parts are saved under their part# so
> they are easy to open, but our fasteners and alot of fittings are in the
> feature pallete under their descriptions.
>
> I have found a pretty good example (on SW website?).
>
> GetConfigurationParams.zip
>
> Anyway this gets the part name if it is user specified but not if it is
the
> drawing name or Configuration name. If anyone knows how to get these also
> or atleast this property per config. That would be just dandy.
>
> Corey Scheich
>
> "Sean Phillips" <sldprt@hotmail.com> wrote in message
> news:edcc2afe.0308122221.22e08a8@posting.google.com...
> > "Corey Scheich" <cscheich@garlockequip.com> wrote in message
> news:<bgp5o8$r8g8p$1@ID-200385.news.uni-berlin.de>...
> > > 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
> >
> > 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
>
>
|
|
0
|
|
|
|
Reply
|
Corey
|
8/13/2003 2:30:44 PM
|
|
|
2 Replies
585 Views
(page loaded in 0.056 seconds)
|
|
|
|
|
|
|
|
|