Magazine

API TIP: Getting BOMs using SolidWorks Enterprise PDM API

Publié le 22 juillet 2009 par Clement Donzel

SolidWorks Enterprise PDM user interface provides direct access to the BOMs. However, If you need to access a BOM using a program, here is how it can be done. Before you can get a computed or derived BOM (bill of materials) using SolidWorks Enterprise PDM API 2009 and later, you must get the layout ID of the BOM. The following code shows how to do this in a VB.NET add-in:

Dim edmVault As IEdmVault7 = TryCast(poCmd.mpoVault, IEdmVault7)
Dim edmFile As IEdmFile7
Dim i As Long
Dim edmBOMManager As IEdmBomMgr
Dim data As EdmCmdData
data = ppoData(0)

‘ Get the SolidWorks Enterprise PDM object
edmFile = edmVault.GetObject(EdmObjectType.EdmObject_File, Data.mlObjectID1)

‘ Get the BOM manager utility, then
‘ get an array of BOM layouts for the file
Dim edmBOMArray() As EdmBomLayout
edmBOMManager = edmVault.CreateUtility(EdmUtility.EdmUtil_BomMgr)
edmBOMManager.GetBomLayouts(edmBOMArray)

‘ Using the layout ID of the BOM, get the BOM interface,
‘ which provides access to the BOM view, for each
‘ BOM in the file
For i = 0 To UBound(edmBOMArray)
Dim edmBOMView As IEdmBomView
edmBOMView = edmFile.GetComputedBOM(edmBOMArray(i).mlLayoutID, _
edmFile.CurrentVersion, “default”, 0)
Next


Retour à La Une de Logo Paperblog

A propos de l’auteur


Clement Donzel 83 partages Voir son profil
Voir son blog

l'auteur n'a pas encore renseigné son compte l'auteur n'a pas encore renseigné son compte

Dossier Paperblog