Renamed methods for getting bends.

This commit is contained in:
AJ
2019-11-21 14:02:30 -05:00
parent 6a08aba93b
commit 098b4f224e
2 changed files with 11 additions and 11 deletions

View File

@@ -29,7 +29,7 @@ namespace ExportDXF
if (up.Count == 0) if (up.Count == 0)
return true; return true;
var bend = ViewHelper.ClosestToBounds(bounds, bends); var bend = ViewHelper.GetBendClosestToBounds(bounds, bends);
return bend.Direction == BendDirection.Down; return bend.Direction == BendDirection.Down;
} }

View File

@@ -8,7 +8,7 @@ namespace ExportDXF
{ {
internal static class ViewHelper internal static class ViewHelper
{ {
public static Bounds GetBounds(SolidWorks.Interop.sldworks.View view) public static Bounds GetBounds(View view)
{ {
var outline = view.GetOutline() as double[]; var outline = view.GetOutline() as double[];
@@ -29,7 +29,7 @@ namespace ExportDXF
}; };
} }
public static Bend ClosestToBounds(Bounds bounds, IList<Bend> bends) public static Bend GetBendClosestToBounds(Bounds bounds, IList<Bend> bends)
{ {
var hBends = bends.Where(b => GetAngleOrientation(b.BendLineAngle) == BendOrientation.Horizontal).ToList(); var hBends = bends.Where(b => GetAngleOrientation(b.BendLineAngle) == BendOrientation.Horizontal).ToList();
var vBends = bends.Where(b => GetAngleOrientation(b.BendLineAngle) == BendOrientation.Vertical).ToList(); var vBends = bends.Where(b => GetAngleOrientation(b.BendLineAngle) == BendOrientation.Vertical).ToList();
@@ -71,7 +71,7 @@ namespace ExportDXF
return minHBendDist < minVBendDist ? minHBend : minVBend; return minHBendDist < minVBendDist ? minHBend : minVBend;
} }
public static Bend SmallestYCoordinate(IList<Bend> bends) public static Bend GetBendWithSmallestYCoordinate(IList<Bend> bends)
{ {
double dist = double.MaxValue; double dist = double.MaxValue;
int index = -1; int index = -1;
@@ -90,7 +90,7 @@ namespace ExportDXF
return index == -1 ? null : bends[index]; return index == -1 ? null : bends[index];
} }
public static Bend SmallestXCoordinate(IList<Bend> bends) public static Bend GetBendWithSmallestXCoordinate(IList<Bend> bends)
{ {
double dist = double.MaxValue; double dist = double.MaxValue;
int index = -1; int index = -1;
@@ -116,12 +116,12 @@ namespace ExportDXF
return txt.ToUpper().Contains("UP") ? BendDirection.Up : BendDirection.Down; return txt.ToUpper().Contains("UP") ? BendDirection.Up : BendDirection.Down;
} }
public static IEnumerable<Note> GetBendNotes(SolidWorks.Interop.sldworks.View view) public static IEnumerable<Note> GetBendNotes(View view)
{ {
return (view.GetNotes() as Array)?.Cast<Note>(); return (view.GetNotes() as Array)?.Cast<Note>();
} }
public static Note GetLeftMostNote(SolidWorks.Interop.sldworks.View view) public static Note GetLeftMostNote(View view)
{ {
var notes = GetBendNotes(view); var notes = GetBendNotes(view);
@@ -143,7 +143,7 @@ namespace ExportDXF
return leftMostNote; return leftMostNote;
} }
public static Note GetBottomMostNote(SolidWorks.Interop.sldworks.View view) public static Note GetBottomMostNote(View view)
{ {
var notes = GetBendNotes(view); var notes = GetBendNotes(view);
@@ -165,7 +165,7 @@ namespace ExportDXF
return btmMostNote; return btmMostNote;
} }
public static IEnumerable<double> GetBendAngles(SolidWorks.Interop.sldworks.View view) public static IEnumerable<double> GetBendAngles(View view)
{ {
var angles = new List<double>(); var angles = new List<double>();
var notes = GetBendNotes(view); var notes = GetBendNotes(view);
@@ -179,7 +179,7 @@ namespace ExportDXF
return angles; return angles;
} }
public static List<Bend> GetBends(SolidWorks.Interop.sldworks.View view) public static List<Bend> GetBends(View view)
{ {
var bends = new List<Bend>(); var bends = new List<Bend>();
var notes = GetBendNotes(view); var notes = GetBendNotes(view);
@@ -217,7 +217,7 @@ namespace ExportDXF
return bends; return bends;
} }
public static BendOrientation GetOrientation(SolidWorks.Interop.sldworks.View view) public static BendOrientation GetOrientation(View view)
{ {
var angles = GetBendAngles(view); var angles = GetBendAngles(view);