Added ItemNo, PartNo, and Description to item class.
This commit is contained in:
@@ -57,7 +57,7 @@
|
|||||||
<GenerateManifests>true</GenerateManifests>
|
<GenerateManifests>true</GenerateManifests>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<SignManifests>true</SignManifests>
|
<SignManifests>false</SignManifests>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="SolidWorks.Interop.sldworks, Version=24.1.0.45, Culture=neutral, PublicKeyToken=7c4797c3e4eeac03, processorArchitecture=MSIL">
|
<Reference Include="SolidWorks.Interop.sldworks, Version=24.1.0.45, Culture=neutral, PublicKeyToken=7c4797c3e4eeac03, processorArchitecture=MSIL">
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ namespace ExportDXF.Forms
|
|||||||
if (worker.CancellationPending)
|
if (worker.CancellationPending)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
var fileName = prefix + item.Name + ".dxf";
|
var fileName = prefix + item.PartNo + ".dxf";
|
||||||
var savepath = Path.Combine(savePath, fileName);
|
var savepath = Path.Combine(savePath, fileName);
|
||||||
var part = item.Component.GetModelDoc2() as PartDoc;
|
var part = item.Component.GetModelDoc2() as PartDoc;
|
||||||
|
|
||||||
@@ -405,6 +405,27 @@ namespace ExportDXF.Forms
|
|||||||
Print("Item numbers are in the " + Helper.GetNumWithSuffix(itemNoColumnIndex + 1) + " column.");
|
Print("Item numbers are in the " + Helper.GetNumWithSuffix(itemNoColumnIndex + 1) + " column.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var qtyColumnIndex = table.IndexOfColumnType(swTableColumnTypes_e.swBomTableColumnType_Quantity);
|
||||||
|
if (qtyColumnIndex == -1)
|
||||||
|
{
|
||||||
|
Print("Error: Quantity column not found.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var descriptionColumnIndex = table.IndexOfColumnTitle("Description");
|
||||||
|
if (descriptionColumnIndex == -1)
|
||||||
|
{
|
||||||
|
Print("Error: Description column not found.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var partNoColumnIndex = table.IndexOfColumnType(swTableColumnTypes_e.swBomTableColumnType_PartNumber);
|
||||||
|
if (partNoColumnIndex == -1)
|
||||||
|
{
|
||||||
|
Print("Error: Part number column not found.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var isBOMPartsOnly = bom.BomFeature.TableType == (int)swBomType_e.swBomType_PartsOnly;
|
var isBOMPartsOnly = bom.BomFeature.TableType == (int)swBomType_e.swBomType_PartsOnly;
|
||||||
|
|
||||||
for (int rowIndex = 0; rowIndex < table.RowCount; rowIndex++)
|
for (int rowIndex = 0; rowIndex < table.RowCount; rowIndex++)
|
||||||
@@ -423,25 +444,30 @@ namespace ExportDXF.Forms
|
|||||||
.GroupBy(c => c.ReferencedConfiguration)
|
.GroupBy(c => c.ReferencedConfiguration)
|
||||||
.Select(group => group.First());
|
.Select(group => group.First());
|
||||||
|
|
||||||
var itemNumber = table.Text[rowIndex, itemNoColumnIndex].PadLeft(2, '0');
|
//var itemNumber = table.Text[rowIndex, itemNoColumnIndex].PadLeft(2, '0');
|
||||||
var rev = 'A';
|
//var rev = 'A';
|
||||||
|
|
||||||
if (distinctComponents.Count() > 1)
|
if (distinctComponents.Count() > 1)
|
||||||
{
|
{
|
||||||
foreach (var comp in distinctComponents)
|
throw new NotImplementedException();
|
||||||
{
|
|
||||||
items.Add(new Item
|
//foreach (var comp in distinctComponents)
|
||||||
{
|
//{
|
||||||
Name = itemNumber + rev++,
|
// items.Add(new Item
|
||||||
Component = comp
|
// {
|
||||||
});
|
// Name = itemNumber + rev++,
|
||||||
}
|
// Component = comp
|
||||||
|
// });
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
items.Add(new Item
|
items.Add(new Item
|
||||||
{
|
{
|
||||||
Name = itemNumber,
|
PartNo = table.DisplayedText[rowIndex, partNoColumnIndex],
|
||||||
|
Quantity = int.Parse(table.DisplayedText[rowIndex, qtyColumnIndex]),
|
||||||
|
Description = table.DisplayedText[rowIndex, descriptionColumnIndex],
|
||||||
|
ItemNo = table.DisplayedText[rowIndex, itemNoColumnIndex].PadLeft(2, '0'),
|
||||||
Component = distinctComponents.First()
|
Component = distinctComponents.First()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -473,7 +499,7 @@ namespace ExportDXF.Forms
|
|||||||
|
|
||||||
list.Add(new Item
|
list.Add(new Item
|
||||||
{
|
{
|
||||||
Name = name,
|
PartNo = name,
|
||||||
Quantity = group.Count(),
|
Quantity = group.Count(),
|
||||||
Component = component
|
Component = component
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,10 +4,14 @@ namespace ExportDXF
|
|||||||
{
|
{
|
||||||
public class Item
|
public class Item
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string ItemNo { get; set; }
|
||||||
|
|
||||||
|
public string PartNo { get; set; }
|
||||||
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
public Component2 Component { get; set; }
|
public Component2 Component { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user