Include bend radius on BOM

This commit is contained in:
AJ
2018-05-02 06:32:28 -04:00
parent f9fca98fe6
commit a6f1ebce34
4 changed files with 61 additions and 5 deletions

View File

@@ -300,6 +300,7 @@ namespace ExportDXF.Forms
{
item.Thickness = sheetMetalData.Thickness.FromSldWorks();
item.KFactor = sheetMetalData.KFactor;
item.BendRadius = sheetMetalData.BendRadius.FromSldWorks();
}
if (item.Description == null)
@@ -426,8 +427,13 @@ namespace ExportDXF.Forms
if (item.KFactor > 0)
partsSheet.Cells[row, 7].Value = item.KFactor;
if (item.BendRadius > 0)
partsSheet.Cells[row, 8].Value = item.BendRadius;
}
partsSheet.Column(1).AutoFit();
workbook.Calculate();
pkg.Save();
}

View File

@@ -2,7 +2,9 @@
using SolidWorks.Interop.swconst;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
@@ -32,7 +34,9 @@ namespace ExportDXF
while (feature != null)
{
if (feature.GetTypeName() == featureName)
var name = feature.GetTypeName();
if (name == featureName)
list.Add(feature);
feature = feature.GetNextFeature() as Feature;
@@ -41,6 +45,23 @@ namespace ExportDXF
return list;
}
public static List<Feature> GetAllSubFeaturesByTypeName(this Feature feature, string subFeatureName)
{
var subFeature = feature.GetFirstSubFeature() as Feature;
var list = new List<Feature>();
while (subFeature != null)
{
Debug.WriteLine(subFeature.GetTypeName2());
if (subFeature.GetTypeName() == subFeatureName)
list.Add(subFeature);
subFeature = subFeature.GetNextSubFeature() as Feature;
}
return list;
}
public static bool HasFlatPattern(this ModelDoc2 model)
{
return model.GetBendState() != (int)swSMBendState_e.swSMBendStateNone;
@@ -161,6 +182,33 @@ namespace ExportDXF
{
return feature?.Parameter(dimName) as Dimension;
}
public static string PunctuateList(this IEnumerable<string> stringList)
{
var list = stringList.ToList();
switch (list.Count)
{
case 0:
return string.Empty;
case 1:
return list[0];
case 2:
return string.Format("{0} and {1}", list[0], list[1]);
default:
var s = string.Empty;
for (int i = 0; i < list.Count - 1; i++)
s += list[i] + ", ";
s += "and " + list.Last();
return s;
}
}
}
public static class Units

View File

@@ -16,6 +16,8 @@ namespace ExportDXF
public double KFactor { get; set; }
public double BendRadius { get; set; }
public string Material { get; set; }
public Component2 Component { get; set; }

Binary file not shown.