diff --git a/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs b/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs
index 6a54eac..627b6cf 100644
--- a/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs
+++ b/OSCADSharp/OSCADSharp.ConsoleTests/Program.cs
@@ -14,8 +14,8 @@ namespace OSCADSharp.ConsoleTests
static void Main(string[] args)
{
var cube = new Cube(null, true).Translate(10, 0, 5).Scale(1, 1, 5);
- var sphere = new Sphere().Mimic(cube).Translate(0, 0, 5);
- string script = cube.Union(sphere).ToString();
+ var sphere = new Sphere().Mimic(cube).Translate(0, 0, 10);
+ string script = cube.Minkowski(sphere, new Cylinder()).ToString();
File.WriteAllLines("test.scad", new string[] { script.ToString() });
Console.ReadKey();
diff --git a/OSCADSharp/OSCADSharp/OSCADObject.cs b/OSCADSharp/OSCADSharp/OSCADObject.cs
index 35a16a7..c724676 100644
--- a/OSCADSharp/OSCADSharp/OSCADObject.cs
+++ b/OSCADSharp/OSCADSharp/OSCADObject.cs
@@ -133,6 +133,16 @@ namespace OSCADSharp
{
return this.Translate(new Vector3(x, y, z));
}
+
+ ///
+ /// Creates a minkowski sum of child nodes (including this object)
+ ///
+ /// Nodes to sum with
+ /// A minkowski sum
+ public OSCADObject Minkowski(params OSCADObject[] nodes)
+ {
+ return new MinkowskiedObject(nodes);
+ }
#endregion
#region Boolean Operations
@@ -183,6 +193,7 @@ namespace OSCADSharp
}
#endregion
+ #region Utility Methods
///
/// Creates a copy of this object and all of its children
///
@@ -232,7 +243,7 @@ namespace OSCADSharp
///
/// Copies the transforms that have been applied to another OSCADObject, and applies
- /// the same transforms to this object. (Only transforms)
+ /// the same transforms to this object. (Only pure transforms, like Translate, Rotate, Scale, Color)
///
///
///
@@ -255,5 +266,6 @@ namespace OSCADSharp
return finalObject;
}
+ #endregion
}
}
diff --git a/OSCADSharp/OSCADSharp/OSCADSharp.csproj b/OSCADSharp/OSCADSharp/OSCADSharp.csproj
index 5becd83..ade38c4 100644
--- a/OSCADSharp/OSCADSharp/OSCADSharp.csproj
+++ b/OSCADSharp/OSCADSharp/OSCADSharp.csproj
@@ -55,6 +55,7 @@
+
diff --git a/OSCADSharp/OSCADSharp/Transforms/MinkowskiedObject.cs b/OSCADSharp/OSCADSharp/Transforms/MinkowskiedObject.cs
new file mode 100644
index 0000000..6db3c97
--- /dev/null
+++ b/OSCADSharp/OSCADSharp/Transforms/MinkowskiedObject.cs
@@ -0,0 +1,20 @@
+using OSCADSharp.Scripting;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OSCADSharp.Transforms
+{
+ ///
+ /// Creates an object that's the minkowski sum of child objects
+ ///
+ internal class MinkowskiedObject : BlockStatementObject
+ {
+
+ public MinkowskiedObject(IEnumerable children) : base("minkowski()", children)
+ {
+ }
+ }
+}