I'm writing a VB .NET application that will extract BOM informations.
Here an example of the BOM of the .dft file:
Item No/"Product No"/"Description"/Qty
------------------------------------------------------
1/"HC026"/"Nylon lock nut 5/16"/4
2/"HDRO-2629"/"Bloc nytralon HDR"/1
I'm only able to get the product number. I also need to get the item number, the description and the qty. Here is my code :
Private seApp As SolidEdgeFramework.Application = Nothing
Private seActiveDoc As SolidEdgeFramework.SolidEdgeDocument = Nothing
Private seDraft As SolidEdgeDraft.DraftDocument = Nothing
Private sePropSets As SolidEdgeFileProperties.PropertySets = Nothing
Dim seDraftSheet As SolidEdgeDraft.Sheet = Nothing
Dim sePartsList As SolidEdgeDraft.PartsList = Nothing
Dim seModelNode As SolidEdgeDraft.ModelNode = Nothing
Dim sePropSet As SolidEdgeFileProperties.Properties = Nothing
Dim I As Integer
seApp = Marshal.GetActiveObject("SolidEdge.Application")
sePropSets = CreateObject("SolidEdge.FileProperties")
seActiveDoc = seApp.ActiveDocument
seDraft = seActiveDoc
seDraftSheet = seDraft.ActiveSheet
For I = 1 To seDraftSheet.DrawingObjects.Count
If TypeOf seDraftSheet.DrawingObjects.Item(I) Is SolidEdgeDraft.PartsList Then
sePartsList = seDraftSheet.DrawingObjects.Item(I)
Exit For
End If
Next
If Not sePartsList Is Nothing Then
For I = 1 To sePartsList.ModelLink.ModelNodes.Count
seModelNode = sePartsList.ModelLink.ModelNodes.Item(I)
If seModelNode.IncludeInPartsList Then 'And seModelNode.IsBallooned Then
sePropSets.Open(seModelNode.FileName, True)
sePropSet = sePropSets.Item("ProjectInformation")
MsgBox(Trim(sePropSet.Item("Document Number").Value))
sePropSets.Close()
End If
Next
End If
For the quantity, I can count it manually with the number of time that I get the same product in the loop.
How can I have the Item number and description? Is there a way to code something else that will give me all the information of the BOM (Item No, Product No, Description and Qty) ?
Thanks a lot!
Here an example of the BOM of the .dft file:
Item No/"Product No"/"Description"/Qty
------------------------------------------------------
1/"HC026"/"Nylon lock nut 5/16"/4
2/"HDRO-2629"/"Bloc nytralon HDR"/1
I'm only able to get the product number. I also need to get the item number, the description and the qty. Here is my code :
Private seApp As SolidEdgeFramework.Application = Nothing
Private seActiveDoc As SolidEdgeFramework.SolidEdgeDocument = Nothing
Private seDraft As SolidEdgeDraft.DraftDocument = Nothing
Private sePropSets As SolidEdgeFileProperties.PropertySets = Nothing
Dim seDraftSheet As SolidEdgeDraft.Sheet = Nothing
Dim sePartsList As SolidEdgeDraft.PartsList = Nothing
Dim seModelNode As SolidEdgeDraft.ModelNode = Nothing
Dim sePropSet As SolidEdgeFileProperties.Properties = Nothing
Dim I As Integer
seApp = Marshal.GetActiveObject("SolidEdge.Application")
sePropSets = CreateObject("SolidEdge.FileProperties")
seActiveDoc = seApp.ActiveDocument
seDraft = seActiveDoc
seDraftSheet = seDraft.ActiveSheet
For I = 1 To seDraftSheet.DrawingObjects.Count
If TypeOf seDraftSheet.DrawingObjects.Item(I) Is SolidEdgeDraft.PartsList Then
sePartsList = seDraftSheet.DrawingObjects.Item(I)
Exit For
End If
Next
If Not sePartsList Is Nothing Then
For I = 1 To sePartsList.ModelLink.ModelNodes.Count
seModelNode = sePartsList.ModelLink.ModelNodes.Item(I)
If seModelNode.IncludeInPartsList Then 'And seModelNode.IsBallooned Then
sePropSets.Open(seModelNode.FileName, True)
sePropSet = sePropSets.Item("ProjectInformation")
MsgBox(Trim(sePropSet.Item("Document Number").Value))
sePropSets.Close()
End If
Next
End If
For the quantity, I can count it manually with the number of time that I get the same product in the loop.
How can I have the Item number and description? Is there a way to code something else that will give me all the information of the BOM (Item No, Product No, Description and Qty) ?
Thanks a lot!