iLogic : renumber one part in BoM assembly

iLogic : renumber one part in BoM assembly

Anonymous
Not applicable
610 Views
3 Replies
Message 1 of 4

iLogic : renumber one part in BoM assembly

Anonymous
Not applicable

Is this possible to renumber with iLogic one part in a BoM assembly ?
It's possible manually but programmaticaly ?

 

Regards

 

Yves

0 Likes
611 Views
3 Replies
Replies (3)
Message 2 of 4

Vladimir.Ananyev
Alumni
Alumni

The sort order of items in the BOM view could be changed with the BOMView.Sort method (in structured and parts only views).

Cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 4

Anonymous
Not applicable
Do you have any example for changing just one part in an assembly with the "BOMView. Sort" method ?
Regards,
0 Likes
Message 4 of 4

Vladimir.Ananyev
Alumni
Alumni

If your BOMView is sorted by item numbers in ascending order then the following sample will swap rows 2 and 3.

 

Sub SWAP_Rows()

  Dim oAssyDoc As AssemblyDocument
  Set oAssyDoc = ThisApplication.ActiveDocument
  Dim oAssyDef As AssemblyComponentDefinition
  Set oAssyDef = oAssyDoc.ComponentDefinition

  ' Get the Representations Manager object.
  Dim repMgr As RepresentationsManager
  Set repMgr = oAssyDef.RepresentationsManager
  
  ' activate LOD Master - necessary to get BOM object !!!
  Dim oMasterLOD As LevelOfDetailRepresentation
  Set oMasterLOD = repMgr.LevelOfDetailRepresentations.Item(1)
  oMasterLOD.Activate

  'set  a reference to the BOM
  Dim oBOM As BOM
  Set oBOM = oAssyDef.BOM
  
  ' Make sure that the "Parts Only" view is enabled.
  oBOM.PartsOnlyViewEnabled = True
  Call oBOM.SetPartNumberMergeSettings(True)
  
  'set a reference to the "Parts Only" BOMView
  Dim oBOMView As BOMView
  Set oBOMView = oBOM.BOMViews.Item("Parts Only")

  Dim oBOMRow1 As BOMRow
  Set oBOMRow1 = oBOMView.BOMRows.Item(2)  'item number = 2
  Dim oBOMRow2 As BOMRow
  Set oBOMRow2 = oBOMView.BOMRows.Item(3)  'item number = 3
  
  'swap item numbers
  oBOMRow1.itemNumber = 3
  oBOMRow2.itemNumber = 2
  
  Beep
End Sub

cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

0 Likes