using System.Collections.Generic; namespace OpenNest.IO.Bom; /// /// Builds the import dialog's part rows from the BOM items and the drawing /// folder. /// public static class BomImportRows { /// /// Returns one row per BOM item, in BOM order. Every row with a file /// name gets the drawing it matches in , /// whether or not its material and thickness are filled in. A blank /// BOM quantity becomes 1, marked as assumed. /// public static List Build(List items, string dxfFolder) { var index = DrawingFileIndex.Load(dxfFolder); var rows = new List(); foreach (var item in items) { rows.Add( new BomPartRow { ItemNum = item.ItemNum, FileName = item.FileName, BomQty = item.Qty, Qty = item.Qty ?? 1, QtyAssumed = item.Qty == null, Description = item.Description, Material = item.Material, Thickness = item.Thickness, DxfPath = string.IsNullOrWhiteSpace(item.FileName) ? null : index.Find(item.FileName), } ); } return rows; } }