Compare commits

...

2 Commits

Author SHA1 Message Date
AJ
a0080c8a68 Print errors when getting BOM items. 2022-06-23 11:06:23 -04:00
AJ
aeec611f78 Include 5000 range in drawing numbers. 2022-06-23 10:47:30 -04:00
3 changed files with 33 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ namespace ExportDXF
{ {
public class DrawingInfo public class DrawingInfo
{ {
private static Regex drawingFormatRegex = new Regex(@"(?<jobNo>[34]\d{3}(-\d+\w{1,2})?)\s?(?<dwgNo>[ABEP]\d+(-?(\d+[A-Z]?))?)", RegexOptions.IgnoreCase); private static Regex drawingFormatRegex = new Regex(@"(?<jobNo>[345]\d{3}(-\d+\w{1,2})?)\s?(?<dwgNo>[ABEP]\d+(-?(\d+[A-Z]?))?)", RegexOptions.IgnoreCase);
public string JobNo { get; set; } public string JobNo { get; set; }

View File

@@ -283,12 +283,11 @@ namespace ExportDXF.Forms
if (worker.CancellationPending) if (worker.CancellationPending)
return; return;
var itemExtractor = new BomItemExtractor(bom); var bomItems = GetItems(bom);
itemExtractor.SkipHiddenRows = true;
Print($"Fetching components from {bom.BomFeature.Name}"); if (bomItems == null)
return;
var bomItems = itemExtractor.GetItems();
items.AddRange(bomItems); items.AddRange(bomItems);
} }
@@ -300,6 +299,25 @@ namespace ExportDXF.Forms
ExportToDXF(items); 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) private void ExportToDXF(PartDoc part)
{ {
var prefix = prefixTextBox.Text; var prefix = prefixTextBox.Text;

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="Item" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>ExportDXF.Item, ExportDXF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>