Changed method of getting sheet metal data.

This commit is contained in:
AJ
2018-04-23 14:51:21 -04:00
parent 7048d27eee
commit 9aafcde051
3 changed files with 19 additions and 18 deletions

View File

@@ -22,7 +22,7 @@
<UpdatePeriodically>false</UpdatePeriodically> <UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired> <UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions> <MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>9</ApplicationRevision> <ApplicationRevision>11</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>

View File

@@ -232,7 +232,7 @@ namespace ExportDXF.Forms
if (dir == null) if (dir == null)
{ {
Print("Cancelled\n", Color.Red); Print("Canceled\n", Color.Red);
return; return;
} }
@@ -289,18 +289,12 @@ namespace ExportDXF.Forms
var config = item.Component.ReferencedConfiguration; var config = item.Component.ReferencedConfiguration;
var sheetMetal = model.GetFeatureByTypeName("SheetMetal"); var sheetMetal = model.GetFeatureByTypeName("SheetMetal");
var sheetMetalData = sheetMetal?.GetDefinition() as SheetMetalFeatureData;
if (sheetMetal != null) if (sheetMetalData != null)
{ {
var kfactor = sheetMetal.GetDimension("D2")?.GetValue2(config); item.Thickness = sheetMetalData.Thickness.FromSldWorks();
item.KFactor = sheetMetalData.KFactor;
if (kfactor.HasValue)
item.KFactor = kfactor.Value;
var thickness = sheetMetal.GetDimension("Thickness")?.GetValue2(config);
if (thickness.HasValue)
item.Thickness = thickness.Value;
} }
var db = string.Empty; var db = string.Empty;
@@ -314,9 +308,16 @@ namespace ExportDXF.Forms
Application.DoEvents(); Application.DoEvents();
} }
try
{
var bomFile = Path.Combine(savePath, "BOM.xlsx"); var bomFile = Path.Combine(savePath, "BOM.xlsx");
CreateBOMExcelFile(bomFile, items.ToList()); CreateBOMExcelFile(bomFile, items.ToList());
} }
catch (Exception ex)
{
Print(ex.Message, Color.Red);
}
}
private string ChangePathExtension(string fullpath, string newExtension) private string ChangePathExtension(string fullpath, string newExtension)
{ {
@@ -503,8 +504,8 @@ namespace ExportDXF.Forms
for (int rowIndex = 0; rowIndex < table.RowCount; rowIndex++) for (int rowIndex = 0; rowIndex < table.RowCount; rowIndex++)
{ {
if (table.RowHidden[rowIndex] == true) //if (table.RowHidden[rowIndex] == true)
continue; // continue;
var bomComponents = isBOMPartsOnly ? var bomComponents = isBOMPartsOnly ?
((Array)bom.GetComponents2(rowIndex, bom.BomFeature.Configuration))?.Cast<Component2>() : ((Array)bom.GetComponents2(rowIndex, bom.BomFeature.Configuration))?.Cast<Component2>() :

View File

@@ -172,12 +172,12 @@ namespace ExportDXF
public static double ToSldWorks(this double d) public static double ToSldWorks(this double d)
{ {
return d * ScaleFactor; return Math.Round(d * ScaleFactor, 8);
} }
public static double FromSldWorks(this double d) public static double FromSldWorks(this double d)
{ {
return d / ScaleFactor; return Math.Round(d / ScaleFactor, 8);
} }
} }
} }