Пример #1
0
        private void ExportToDXF(DrawingDoc drawing)
        {
            Print("Finding BOM tables...");
            var bomTables = drawing.GetBomTables();

            if (bomTables.Count == 0)
            {
                Print("Error: Bill of materials not found.", Color.Red);
                return;
            }

            Print($"Found {bomTables.Count} BOM table(s)\n");

            var items = new List <Item>();

            foreach (var bom in bomTables)
            {
                if (worker.CancellationPending)
                {
                    return;
                }

                var itemExtractor = new BomItemExtractor(bom);
                itemExtractor.SkipHiddenRows = true;

                Print($"Fetching components from {bom.BomFeature.Name}");

                var bomItems = itemExtractor.GetItems();
                items.AddRange(bomItems);
            }

            Print($"Found {items.Count} component(s)");
            ExportToDXF(items);
        }