|
<< Click to Display Table of Contents >> Navigation: Programming Mechworks PDM > DBWCommandShell > Library Reference > BOM > DBWGetDBWBomAsArray |
The function fills the passed array with the same information as an ExcelBOM.
Sub DBWGetDBWBomAsArray(parameterfile,DocumentUid,revision,ByRef BomArray,ByRef ID_Col,ByRef BomitemsCount)
parameterfile |
The \PAR\DBWBOM_*.txt template file used to choose the BOM type |
|---|---|
DocumentUid |
The unique ID of the document to create the BOM of |
revision |
The specific revision of the selected document to create the BOM of |
BomArray |
A 2-Dimensional array (matrix) containing the same rows and columns of the ExcelBOM for the passed document |
|---|---|
ID_Col |
An integer representing the column where the ID value is shown. |
BomitemsCount |
The total number of the items in the BOM |
A typical example of the usage of this function is the script RMB on assembly→Bom and Printing→Customized_Bom_Text_file_from_excel_bom.vbs
Here below is the topic code of such script.
...
DBWGetDBWBomAsArray parameterfile,DocumentUid,revision,BomArray,ID_Col,BomitemsCount
saveBomDataAsTabSeparatedText BomArray,BomitemsCount,pathToBomTextFile,false
WshShell.Run ("notepad " & pathToBomTextFile)
...
Function saveBomDataAsTabSeparatedText( BomArray,BomitemsCount,pathToTextFile,ShowProgressBar)
...
For i=0 To UBound(BomArray,1)
str=""
For j=0 To UBound(BomArray,2)
If j=0 Then 'first column
str=DBWAddSpacesLeft(BomArray(i,j) ,15)
Else
str=str & DBWAddSpacesLeft(BomArray(i,j) ,40)
End if
Next
...
Next
end Function