Skip to content

Commit

Permalink
Merge pull request #15 from thomascorrie/feature/ClassRename
Browse files Browse the repository at this point in the history
Class names changes
  • Loading branch information
thomascorrie authored Jan 18, 2019
2 parents 059174a + 7ae5514 commit e62364f
Show file tree
Hide file tree
Showing 29 changed files with 271 additions and 193 deletions.
2 changes: 2 additions & 0 deletions Miscellany/About.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dynamo.Graph.Nodes;

namespace Miscellany
{
Expand All @@ -18,6 +19,7 @@ public static class About
/// <search>
/// Miscellany
/// </search>
[NodeCategory("Create")]
public static string Miscellany()
{
string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() + "." + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString() + "." + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Build.ToString();
Expand Down
34 changes: 17 additions & 17 deletions Miscellany/ContainerPacking/PackingService/PackContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public static Dictionary<string, object> PackContainer(Miscellany.ContainerPacki
AlgorithmPackingResult algorithmPackingResult = containerPackingResult.AlgorithmPackingResults.FirstOrDefault();
bool IsCompletePack = algorithmPackingResult.IsCompletePack;
int PackTimeInMilliseconds = Convert.ToInt32(algorithmPackingResult.PackTimeInMilliseconds); //Max limit of int32 for milliseconds is596 hours
double PercentContainerVolumePacked = Miscellany.Math.Functions.ToDouble(algorithmPackingResult.PercentContainerVolumePacked);
double PercentItemVolumePacked = Miscellany.Math.Functions.ToDouble(algorithmPackingResult.PercentItemVolumePacked);
double PercentContainerVolumePacked = Miscellany.Maths.ToDouble(algorithmPackingResult.PercentContainerVolumePacked);
double PercentItemVolumePacked = Miscellany.Maths.ToDouble(algorithmPackingResult.PercentItemVolumePacked);
//int BestFitOrientation = algorithmPackingResult.best

//Convert CromulentBisgetti items to Miscellany Items
Expand Down Expand Up @@ -94,42 +94,42 @@ public static Dictionary<string, object> PackContainer(Miscellany.ContainerPacki
//Convert a CromulentBisgetti Item to a Miscellany Item
private static Miscellany.ContainerPacking.Entities.Item ItemToMiscellany(Item i)
{
double ddim1 = Miscellany.Math.Functions.ToDouble(i.Dim1);
double ddim2 = Miscellany.Math.Functions.ToDouble(i.Dim2);
double ddim3 = Miscellany.Math.Functions.ToDouble(i.Dim3);
double ddim1 = Miscellany.Maths.ToDouble(i.Dim1);
double ddim2 = Miscellany.Maths.ToDouble(i.Dim2);
double ddim3 = Miscellany.Maths.ToDouble(i.Dim3);
//Create Item
Miscellany.ContainerPacking.Entities.Item mItem = new Miscellany.ContainerPacking.Entities.Item(i.ID, ddim1, ddim2, ddim3, i.Quantity);
//Add packed information
mItem.IsPacked = i.IsPacked;
if (i.IsPacked)
{
//Swap Y and Z values to shift from the CromulentBisgetti coordinate system and Dynamo
mItem.PackDimX = Miscellany.Math.Functions.ToDouble(i.PackDimX);
mItem.PackDimY = Miscellany.Math.Functions.ToDouble(i.PackDimZ);
mItem.PackDimZ = Miscellany.Math.Functions.ToDouble(i.PackDimY);
mItem.CoordX = Miscellany.Math.Functions.ToDouble(i.CoordX);
mItem.CoordY = Miscellany.Math.Functions.ToDouble(i.CoordZ);
mItem.CoordZ = Miscellany.Math.Functions.ToDouble(i.CoordY);
mItem.PackDimX = Miscellany.Maths.ToDouble(i.PackDimX);
mItem.PackDimY = Miscellany.Maths.ToDouble(i.PackDimZ);
mItem.PackDimZ = Miscellany.Maths.ToDouble(i.PackDimY);
mItem.CoordX = Miscellany.Maths.ToDouble(i.CoordX);
mItem.CoordY = Miscellany.Maths.ToDouble(i.CoordZ);
mItem.CoordZ = Miscellany.Maths.ToDouble(i.CoordY);
}
return mItem;
}

//Convert Miscellany Container to CromulentBisgetti Container
private static Container ContainerToCB(Miscellany.ContainerPacking.Entities.Container c)
{
decimal dLength = Miscellany.Math.Functions.ToDecimal(c.Length);
decimal dWidth = Miscellany.Math.Functions.ToDecimal(c.Width);
decimal dHeight = Miscellany.Math.Functions.ToDecimal(c.Height);
decimal dLength = Miscellany.Maths.ToDecimal(c.Length);
decimal dWidth = Miscellany.Maths.ToDecimal(c.Width);
decimal dHeight = Miscellany.Maths.ToDecimal(c.Height);
Container cbContainer = new Container(c.ID,dLength,dWidth,dHeight);
return cbContainer;
}

//Convert Miscellany Item to CromulentBisgetti Item
private static Item ItemToCB(Miscellany.ContainerPacking.Entities.Item i)
{
decimal ddim1 = Miscellany.Math.Functions.ToDecimal(i.Dim1);
decimal ddim2 = Miscellany.Math.Functions.ToDecimal(i.Dim2);
decimal ddim3 = Miscellany.Math.Functions.ToDecimal(i.Dim3);
decimal ddim1 = Miscellany.Maths.ToDecimal(i.Dim1);
decimal ddim2 = Miscellany.Maths.ToDecimal(i.Dim2);
decimal ddim3 = Miscellany.Maths.ToDecimal(i.Dim3);
Item cbItem = new Item(i.ID, ddim1, ddim2, ddim3, i.Quantity);
return cbItem;
}
Expand Down
4 changes: 2 additions & 2 deletions Miscellany/ContainerPacking/PackingService/PackContainers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public static Dictionary<string, object> PackContainers(List<Miscellany.Containe
IsCompletePack = algorithmPackingResult.IsCompletePack;
PackTimeInMilliseconds.Add(Convert.ToInt32(algorithmPackingResult.PackTimeInMilliseconds));
TotalPackTimeInMilliseconds += Convert.ToInt32(algorithmPackingResult.PackTimeInMilliseconds);
PercentContainerVolumePacked.Add(Miscellany.Math.Functions.ToDouble(algorithmPackingResult.PercentContainerVolumePacked));
PercentItemVolumePacked.Add(Miscellany.Math.Functions.ToDouble(algorithmPackingResult.PercentItemVolumePacked));
PercentContainerVolumePacked.Add(Miscellany.Maths.ToDouble(algorithmPackingResult.PercentContainerVolumePacked));
PercentItemVolumePacked.Add(Miscellany.Maths.ToDouble(algorithmPackingResult.PercentItemVolumePacked));
if (algorithmPackingResult.IsCompletePack == true)
{
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ public static Dictionary<string, object> PackContainersWithGroups(List<Miscellan
}
PackTimeInMilliseconds.Add(Convert.ToInt32(algorithmPackingResult.PackTimeInMilliseconds));
TotalPackTimeInMilliseconds += Convert.ToInt32(algorithmPackingResult.PackTimeInMilliseconds);
PercentContainerVolumePacked.Add(Miscellany.Math.Functions.ToDouble(algorithmPackingResult.PercentContainerVolumePacked));
PercentItemVolumePacked.Add(Miscellany.Math.Functions.ToDouble(algorithmPackingResult.PercentItemVolumePacked));
PercentContainerVolumePacked.Add(Miscellany.Maths.ToDouble(algorithmPackingResult.PercentContainerVolumePacked));
PercentItemVolumePacked.Add(Miscellany.Maths.ToDouble(algorithmPackingResult.PercentItemVolumePacked));
if (items.Count == 0) //No more groups to pack
{
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ public static Dictionary<string, object> PackContainersWithGroupsContinuously(Li
}
PackTimeInMilliseconds.Add(Convert.ToInt32(algorithmPackingResult.PackTimeInMilliseconds));
TotalPackTimeInMilliseconds += Convert.ToInt32(algorithmPackingResult.PackTimeInMilliseconds);
PercentContainerVolumePacked.Add(Miscellany.Math.Functions.ToDouble(algorithmPackingResult.PercentContainerVolumePacked));
PercentItemVolumePacked.Add(Miscellany.Math.Functions.ToDouble(algorithmPackingResult.PercentItemVolumePacked));
PercentContainerVolumePacked.Add(Miscellany.Maths.ToDouble(algorithmPackingResult.PercentContainerVolumePacked));
PercentItemVolumePacked.Add(Miscellany.Maths.ToDouble(algorithmPackingResult.PercentItemVolumePacked));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
using System.Threading.Tasks;
using Autodesk.DesignScript.Runtime;
using Autodesk.DesignScript.Geometry;
using Dynamo.Graph.Nodes;

namespace Miscellany.Geometry.Abstract
namespace Miscellany.Geometry
{
/// <summary>
/// CoordinateSystem
/// </summary>
public static class CoordinateSystem
public static class Abstract
{
/// <summary>
/// Shows scalable lines representing the CoordinateSystem axes and rectangles for the planes
Expand All @@ -26,8 +27,9 @@ public static class CoordinateSystem
/// <returns name="XYPlane">Plane</returns>
/// <returns name="YZPlane">Plane</returns>
/// <returns name="ZXPlane">Plane</returns>
[NodeCategory("Query")]
[MultiReturn(new[] { "Display", "Origin", "XAxis", "YAxis", "ZAxis", "XYPlane", "YZPlane", "ZXPlane" })]
public static Dictionary<string, object> Display(Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, double length = 1000)
public static Dictionary<string, object> CoordinateSystemDisplay(Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, double length = 1000)
{
//Avoid zero length
if (length == 0)
Expand Down Expand Up @@ -63,13 +65,7 @@ public static Dictionary<string, object> Display(Autodesk.DesignScript.Geometry.
d.Add("ZXPlane", coordinateSystem.ZXPlane);
return d;
}
}

/// <summary>
/// Plane
/// </summary>
public static class Plane
{
/// <summary>
/// Shows scalable lines representing the axes and a rectangle for the Plane
/// </summary>
Expand All @@ -80,8 +76,9 @@ public static class Plane
/// <returns name="XAxis">Vector</returns>
/// <returns name="YAxis">Vector</returns>
/// <returns name="Normal">Vector</returns>
[NodeCategory("Query")]
[MultiReturn(new[] { "Display", "Origin", "XAxis", "YAxis", "Normal" })]
public static Dictionary<string, object> Display(Autodesk.DesignScript.Geometry.Plane plane, double length = 1000)
public static Dictionary<string, object> PlaneDisplay(Autodesk.DesignScript.Geometry.Plane plane, double length = 1000)
{
//Avoid zero length
if (length == 0)
Expand Down Expand Up @@ -114,13 +111,7 @@ public static Dictionary<string, object> Display(Autodesk.DesignScript.Geometry.
d.Add("Normal", plane.Normal);
return d;
}
}

/// <summary>
/// Vector
/// </summary>
public static class Vector
{

/// <summary>
/// Shows a scalable line representing a Vector from a chosen starting point
/// </summary>
Expand All @@ -132,8 +123,9 @@ public static class Vector
/// <returns name="y">double</returns>
/// <returns name="z">double</returns>
/// <returns name="Length">double</returns>
[NodeCategory("Query")]
[MultiReturn(new[] { "Display", "x", "y", "z", "Length" })]
public static Dictionary<string, object> Display(Autodesk.DesignScript.Geometry.Vector vector, Autodesk.DesignScript.Geometry.Point startPoint, double scale = 1000)
public static Dictionary<string, object> VectorDisplay(Autodesk.DesignScript.Geometry.Vector vector, Autodesk.DesignScript.Geometry.Point startPoint, double scale = 1000)
{
//Avoid zero length
if (scale == 0)
Expand Down
6 changes: 3 additions & 3 deletions Miscellany/List/List.cs → Miscellany/Lists/Lists.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System.Collections.Generic;
using System.Collections; //Need this to handle non-specific IList as opposed to IList<T>

namespace Miscellany
namespace Miscellany.List
{
/// <summary>
/// Modify
/// Modifies
/// </summary>
public static class List
public static class Modifies
{
/// <summary>
/// Pairs items in a list: [a,b,c,d] > [[a,b],[b,c],[c,d]]
Expand Down
4 changes: 2 additions & 2 deletions Miscellany/Math/Functions.cs → Miscellany/Maths/Maths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
using System.Text;
using System.Threading.Tasks;

namespace Miscellany.Math
namespace Miscellany
{
/// <summary>
/// Functions
/// </summary>
public static class Functions
public static class Maths
{
/// <summary>
/// Converts a double to a decimal. If the double is above or below the maximum range for a decimal then the number is bounded to theos limits
Expand Down
31 changes: 31 additions & 0 deletions Miscellany/Miscellany.Migrations.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<migrations>
<priorNameHint>
<oldName>Miscellany.Geometry.Abstract.CoordinateSystem.Display</oldName>
<newName>Miscellany.Geometry.Abstract.CoordinateSystemDisplay</newName>
</priorNameHint>
<priorNameHint>
<oldName>Miscellany.Geometry.Abstract.Plane.Display</oldName>
<newName>Miscellany.Geometry.Abstract.PlaneDisplay</newName>
</priorNameHint>
<priorNameHint>
<oldName>Miscellany.Geometry.Abstract.Vector.Display</oldName>
<newName>Miscellany.Geometry.Abstract.VectorDisplay</newName>
</priorNameHint>
<priorNameHint>
<oldName>Miscellany.Math.Functions.RunningTotal</oldName>
<newName>Miscellany.Maths.RunningTotal</newName>
</priorNameHint>
<priorNameHint>
<oldName>Miscellany.Math.Functions.ToDecimal</oldName>
<newName>Miscellany.Maths.ToDecimal</newName>
</priorNameHint>
<priorNameHint>
<oldName>Miscellany.Math.Functions.ToDouble</oldName>
<newName>Miscellany.Maths.ToDouble</newName>
</priorNameHint>
<priorNameHint>
<oldName>Miscellany.List.PairItems</oldName>
<newName>Miscellany.List.Modifies.PairItems</newName>
</priorNameHint>
</migrations>
Loading

0 comments on commit e62364f

Please sign in to comment.