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,9 +300,10 @@ namespace ExportDXF.Forms
{ {
item.Thickness = sheetMetalData.Thickness.FromSldWorks(); item.Thickness = sheetMetalData.Thickness.FromSldWorks();
item.KFactor = sheetMetalData.KFactor; item.KFactor = sheetMetalData.KFactor;
} item.BendRadius = sheetMetalData.BendRadius.FromSldWorks();
}
if (item.Description == null) if (item.Description == null)
item.Description = model.Extension.CustomPropertyManager[config].Get("Description"); item.Description = model.Extension.CustomPropertyManager[config].Get("Description");
if (item.Description == null) if (item.Description == null)
@@ -312,7 +313,7 @@ namespace ExportDXF.Forms
item.Material = part.GetMaterialPropertyName2(config, out db); item.Material = part.GetMaterialPropertyName2(config, out db);
if (part == null) if (part == null)
continue; continue;
SavePartToDXF(part, config, savepath); SavePartToDXF(part, config, savepath);
@@ -426,8 +427,13 @@ namespace ExportDXF.Forms
if (item.KFactor > 0) if (item.KFactor > 0)
partsSheet.Cells[row, 7].Value = item.KFactor; partsSheet.Cells[row, 7].Value = item.KFactor;
if (item.BendRadius > 0)
partsSheet.Cells[row, 8].Value = item.BendRadius;
} }
partsSheet.Column(1).AutoFit();
workbook.Calculate(); workbook.Calculate();
pkg.Save(); pkg.Save();
} }

View File

@@ -2,7 +2,9 @@
using SolidWorks.Interop.swconst; using SolidWorks.Interop.swconst;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
@@ -32,7 +34,9 @@ namespace ExportDXF
while (feature != null) while (feature != null)
{ {
if (feature.GetTypeName() == featureName) var name = feature.GetTypeName();
if (name == featureName)
list.Add(feature); list.Add(feature);
feature = feature.GetNextFeature() as Feature; feature = feature.GetNextFeature() as Feature;
@@ -41,7 +45,24 @@ namespace ExportDXF
return list; return list;
} }
public static bool HasFlatPattern(this ModelDoc2 model) 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; return model.GetBendState() != (int)swSMBendState_e.swSMBendStateNone;
} }
@@ -161,6 +182,33 @@ namespace ExportDXF
{ {
return feature?.Parameter(dimName) as Dimension; 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 public static class Units

View File

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

Binary file not shown.