Print errors when getting BOM items.

This commit is contained in:
AJ
2022-06-23 11:06:23 -04:00
parent aeec611f78
commit a0080c8a68

View File

@@ -283,12 +283,11 @@ namespace ExportDXF.Forms
if (worker.CancellationPending)
return;
var itemExtractor = new BomItemExtractor(bom);
itemExtractor.SkipHiddenRows = true;
var bomItems = GetItems(bom);
Print($"Fetching components from {bom.BomFeature.Name}");
if (bomItems == null)
return;
var bomItems = itemExtractor.GetItems();
items.AddRange(bomItems);
}
@@ -300,6 +299,25 @@ namespace ExportDXF.Forms
ExportToDXF(items);
}
private List<Item> GetItems(BomTableAnnotation bom)
{
try
{
var itemExtractor = new BomItemExtractor(bom);
itemExtractor.SkipHiddenRows = true;
Print($"Fetching components from {bom.BomFeature.Name}");
return itemExtractor.GetItems();
}
catch (Exception ex)
{
Print($"Failed to get items from BOM. {ex.Message}", Color.Red);
}
return null;
}
private void ExportToDXF(PartDoc part)
{
var prefix = prefixTextBox.Text;