Insert virtual component and renumber BOM

Insert virtual component and renumber BOM

breinkemeyer
Enthusiast Enthusiast
296 Views
3 Replies
Message 1 of 4

Insert virtual component and renumber BOM

breinkemeyer
Enthusiast
Enthusiast

I have an assembly of a screw conveyor.  Our drafting department wants the first line of the bom to be the Entire assembly as a virtual component, renamed to Item A and renumber the remaining lines starting at Item 2 sequentially starting with item number 1.  I'm not sure of a couple of arguments needed for the methods (see attachment).

 

here is the code

 

// add the virtual components to the list
AssemblyDocument oDoc = (AssemblyDocument)oInventorApp.ActiveDocument;
AssemblyComponentDefinition oCompDef = oDoc.ComponentDefinition;

Matrix oMatrix = oInventorApp.TransientGeometry.CreateMatrix();
ComponentOccurrence oNewOcc = oCompDef.Occurrences.AddVirtual("SC-18", oMatrix);
VirtualComponentDefinition oVurtCompDef = (VirtualComponentDefinition)oNewOcc.Definition;
oVurtCompDef.PropertySets["Design Tracking Properties"]["Description"].Value = "MTO Screw Conveyor";


BOM oBOMDef = oDoc.ComponentDefinition.BOM;
oBOMDef.StructuredViewFirstLevelOnly = true;
oBOMDef.StructuredViewEnabled = true;
oBOMDef.SetPartNumberMergeSettings(false);
BOMView oView = oBOMDef.BOMViews["Structured"];

oView.Renumber(1, 1, );

oDoc.Save();
oDoc.Close();

0 Likes
Accepted solutions (1)
297 Views
3 Replies
Replies (3)
Message 2 of 4

breinkemeyer
Enthusiast
Enthusiast

Ok, an update.  I was able to get the conveyor itself in the bom as the first item (virtual part).  now I just need to renumber the bom 

 

oView.Renumber(1, 1, ) the third variable is an object of the bom lines to renumber.  what object is it looking for?

0 Likes
Message 3 of 4

marcin_otręba
Advisor
Advisor
Accepted solution

It is BOMRows collection:

 

marcin_otrba_1-1732097091606.png

 

 

Hi, maybe you want to check my apps:


DrawingTools   View&ColoringTools   MRUFolders

0 Likes
Message 4 of 4

breinkemeyer
Enthusiast
Enthusiast

thank you sir!

0 Likes