- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm working with 2023.2.1 using the steps from the API on looping through a BOM. It's a c# conversion of "Using the BOM APIs API Sample". For excerpt, i've named the function GetPartsListToExport. The excerpt below is what i'm using in place of the orginal "Call QueryBOMRowProperties(oBOMView.BOMRows, ItemTab)" line.
if a checkbox is checked, dive into and go through the sub assembly.
if (checkBoxSelectAll.Checked)
{
//if the subassembly has children (if the bom isn't empty) proceed
if (aBomRow.ChildRows != null)
{
AssemblyDocument sDoc = (AssemblyDocument)brDef.Document;
if (sDoc.IsModifiable)
{
//open the assembly
Globals._InvApp.Documents.Open(sDoc.FullFileName);
//run through the parts list again
GetPartsListToExport();
//when done processing file, close it
sDoc.Close(true);
}
}
}
And that works fine as is, no functional issues whatsover.
Something always bugged me about it, though. That being it opens the sub-assembly on the screen when you run it. I found that annoying and figured i'd get rid of it.
So, i changed this line:
Globals._InvApp.Documents.Open(sDoc.FullFileName);
to
Globals._InvApp.Documents.Open(sDoc.FullFileName, false);
That should open the sub quietly in the background so no one sees it. Well, it sort of did, but it just kept looping on the first part over and over. Tried it several times with the same result. Removing false returns it to work fine.
So, why in the world does doing it invisibly cause it to loop?
Solved! Go to Solution.