Is this number is in the cut-list properties? If so you can try to follow the steps below:
- Traverse all views: 2012 SOLIDWORKS API Help - GetViews Method (IDrawingDoc)
- Find all visible entities (faces) on the view: 2013 SOLIDWORKS API Help - GetVisibleEntities Method (IView)
- This is where it become a bit tricky as you cannot get the weldment properties of faces. You have to find their corresponding cut-lists
- Find the body of face: 2010 SOLIDWORKS API Help - GetBody Method (IFace2)
- Traverse the tree to find all cut-list body features and their bodies: 2014 SOLIDWORKS API Help - Get Solid Bodies from Cut-list Folders and Get Custom Properties Example (VBA) (this example also demonstrates how to get properties)
- Now select the bodies from #3.1
It has been a while but I have finally started working on this. So far I have done steps 1, 2, and 3.1. I have done 3.2 also, which I can get the cut-list folder of the body. How do I relate the cut-list folder in the part to the item number in the cut-list table in the drawing? The only way I can figure out how to do this is to:
1. go back to the drawing
2. temporarily add a column to the cut-list which displays cut list item name
3. search for cut-list item name column for the row that has the correct name I am looking for
4. get the text in the item no. column from the row in previous step
5. delete temp column in cut-list
I can do all of that, but it seems like there is an easier way and I am missing something.
Thanks for your help.