Description
You can synchronize external bills of materials with Isah bills of materials (BOM) using an ExternalBom object. You have to fill the ExternalBom object with the contents of the Isah BOM. The next step is to compare the ExternalBom object with the Isah item BOM and if applicable, synchronize it. This way, the Engineering Link takes care of BOM synchronization without having to build synchronization logic into your application. You can use the ExternalBom object for parts, production files and engineering-items.
Reading the Isah BOM
You can use the ExternalBom object to read an Isah BOM. If you enter the TableId and PrimKey of an Isah item and run the Refresh method, the object will be filled with the BOM lines of the Isah item. Next, you can edit the BOM in your application and update the Isah BOM by synchronizing.
The following code fills the ExternalBom object with the BOM lines of an Isah item:
oExternalBom = New IPDMLink.ExternalBom
oExternalBom.TableId = 924
oExternalBom.Primkey = "2"
oExternalBom.Refresh()
lMsg = "ExternalBom lines: " & oExternalBom.Count & vbCrLf
For i = 0 To oExternalBom.Count – 1
lMsg = lMsg & i + 1 & ": BomLineNr = " & _
oExternalBom.Item(i).BomLineNr & vbCrLf
Next i
MsgBox lMsg
ExternalBomLine Object Properties
A ExternalBomLine object (IISPDMExternalBomLine) contains a number of common properties present in BOMs of parts, production files and engineering items. If other properties need to be changed, you have to change the object of the item type concerned. For example, if you want to enter the net dimensions of a part BOM line, you have to use a part object because they are absent in engineering BOM lines.
Apart from common properties an ExternalBomLine object contains optional properties, for example to store the Id of a CAD item. If you enter the ID the CAD item can be identified after the synchronization, for example to fill in the line number created in Isah.
The optional properties are:
Synchronizing
The Synchronise method updates the entered Isah item based on the ExternalBom lines. Existing lines will be updated, lines that are not present in Isah will be added and lines with the External property that are not present in the ExternalBom, will be deleted.
If a line has been added, the BomLineNr of the new line will be placed in the BomLineNr property. This way, the application connected to the Engineering Link, can use this information. For engineering items, the EngBomId value will be placed in the BomLineNr property. An engineering item BOM can contain both engineering items and parts.
The code below synchronizes an engineering revision BOM line based on an external BOM. Two lines will be added to the engineering item BOM: one line containing an engineering item and one containing a part.
oExternalBom = New IPDMLink.ExternalBom
oExternalBom.TableId = 924
oExternalBom.Primkey = "2"
oExternalBom.Refresh()
'' Line 1.
oBomLine = oExternalBom.Add(-1)
oBomLine.CADId = 1
oBomLine.TableId = 924
oBomLine.Primkey = "22"
oBomLine.Length = 0
oBomLine.Width = 0
oBomLine.Height = 0
oBomLine.Quantity = 4
oBomLine.PositionNr = 10
'' Line 2.
oBomLine = oExternalBom.Add(-1)
oBomLine.CADId = 2
oBomLine.TableId = 12
oBomLine.Primkey = "PARTCODE"
oBomLine.Length = 0
oBomLine.Width = 0
oBomLine.Height = 0
oBomLine.Quantity = 2
oBomLine.PositionNr = 20
oExternalBom.Synchronise()
lMsg = "ExternalBom lines: " & oExternalBom.Count & vbCrLf
For i = 0 To oExternalBom.Count – 1
lMsg = lMsg & i + 1 & ": BomLineNr = " & _
oExternalBom.Item(i).BomLineNr & vbCrLf
Next i
MsgBox lMsg