diff --git a/OSCADSharp/OSCADSharp/OSCADObject.cs b/OSCADSharp/OSCADSharp/OSCADObject.cs index d60e061..70b1aff 100644 --- a/OSCADSharp/OSCADSharp/OSCADObject.cs +++ b/OSCADSharp/OSCADSharp/OSCADObject.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace OSCADSharp { - public class OSCADObject + public abstract class OSCADObject { } } diff --git a/OSCADSharp/OSCADSharp/OSCADSharp.csproj b/OSCADSharp/OSCADSharp/OSCADSharp.csproj index 47db62e..247b532 100644 --- a/OSCADSharp/OSCADSharp/OSCADSharp.csproj +++ b/OSCADSharp/OSCADSharp/OSCADSharp.csproj @@ -1,10 +1,10 @@ - + Debug AnyCPU - e420ce17-2f13-4abc-87d7-c9744df39d3d + {E420CE17-2F13-4ABC-87D7-C9744DF39D3D} Library Properties OSCADSharp @@ -30,24 +30,22 @@ 4 - - - - - - - - - - - - - - + + + + + + + + - + + + + + - - + \ No newline at end of file diff --git a/OSCADSharp/OSCADSharp/Solids/Cube.cs b/OSCADSharp/OSCADSharp/Solids/Cube.cs new file mode 100644 index 0000000..4e7407e --- /dev/null +++ b/OSCADSharp/OSCADSharp/Solids/Cube.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OSCADSharp.Solids +{ + /// + /// A Cube geometry + /// + public class Cube + { + #region Attributes + /// + /// The Size of the cube in terms of X/Y/Z units + /// + public Vector3 Size { get; set; } = new Vector3(1, 1, 1); + + /// + /// If True, the center of the cube will be at 0, 0, 0 + /// + /// If False (default) one corner will be centered at 0,0, 0, with the cube extending into the positive octant (positive X/Y/Z) + /// + public bool Center { get; set; } = false; + #endregion + } +} diff --git a/OSCADSharp/OSCADSharp/Solids/Cylinder.cs b/OSCADSharp/OSCADSharp/Solids/Cylinder.cs new file mode 100644 index 0000000..7093408 --- /dev/null +++ b/OSCADSharp/OSCADSharp/Solids/Cylinder.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OSCADSharp.Solids +{ + /// + /// A Cylinder geometry + /// + public class Cylinder + { + #region Attributes + /// + /// Height of the cylinder or cone + /// + public double Height { get; set; } = 1; + + /// + /// Radius of cylinder. r1 = r2 = r. + /// + public double Radius { + get + { + return (Radius1 + Radius2) / 2; + } + set + { + this.Radius1 = value; + this.Radius2 = value; + } + } + + /// + /// Radius, bottom of cone. + /// + public double Radius1 { get; set; } = 1; + + /// + /// Radius, top of cone. + /// + public double Radius2 { get; set; } = 1; + + /// + /// Diameter of cylinder. r1 = r2 = d /2. + /// + public double Diameter + { + get { return this.Radius * 2; } + set { this.Radius = value / 2; } + } + + /// + /// Diameter, bottom of cone. r1 = d1 /2 + /// + public double Diameter1 + { + get { return this.Radius1 * 2; } + set { this.Radius1 = value / 2; } + } + + /// + /// Diameter, top of cone. r2 = d2 /2 + /// + public double Diameter2 + { + get { return this.Radius2 * 2; } + set { this.Radius2 = value / 2; } + } + + /// + /// Denotes the initial positioning of the cylinder + /// false: (default), z ranges from 0 to h + /// true: z ranges from -h/2 to +h/2 + /// + public bool Center { get; set; } = false; + + /// + /// Minimum angle (in degrees) of each cylinder fragment. + /// ($fa in OpenSCAD) + /// + public int MinimumAngle { get; set; } = 12; + + /// + /// Minimum circumferential length of each fragment. + /// ($fs in OpenSCAD) + /// + public int MinimumCircumferentialLength { get; set; } = 2; + + /// + /// Number of fragments in 360 degrees. Values of 3 or more override MinimumAngle and MinimumCircumferentialLength + /// ($fn in OpenSCAD) + /// + public int Resolution { get; set; } = 0; + #endregion + + + } +} diff --git a/OSCADSharp/OSCADSharp/Solids/Sphere.cs b/OSCADSharp/OSCADSharp/Solids/Sphere.cs new file mode 100644 index 0000000..16a9724 --- /dev/null +++ b/OSCADSharp/OSCADSharp/Solids/Sphere.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OSCADSharp.Solids +{ + /// + /// A Sphere geometry + /// + public class Sphere + { + #region Attributes + /// + /// This is the radius of the sphere + /// + public double Radius { get; set; } = 1; + + /// + /// This is the diameter of the sphere + /// + public double Diameter { get; set; } + + /// + /// Minimum angle (in degrees) of each cylinder fragment. + /// ($fa in OpenSCAD) + /// + public int MinimumAngle { get; set; } = 12; + + /// + /// Minimum circumferential length of each fragment. + /// ($fs in OpenSCAD) + /// + public int MinimumCircumferentialLength { get; set; } = 2; + + /// + /// Number of fragments in 360 degrees. Values of 3 or more override MinimumAngle and MinimumCircumferentialLength + /// ($fn in OpenSCAD) + /// + public int Resolution { get; set; } = 0; + #endregion + } +} diff --git a/OSCADSharp/OSCADSharp/Vector3.cs b/OSCADSharp/OSCADSharp/Vector3.cs new file mode 100644 index 0000000..0bf45f3 --- /dev/null +++ b/OSCADSharp/OSCADSharp/Vector3.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OSCADSharp +{ + /// + /// A Three-Dimensional vector + /// + /// Can be used to represent a direction, or a point in space + /// + public class Vector3 + { + public double X { get; set; } + public double Y { get; set; } + public double Z { get; set; } + + public Vector3(double x = 0, double y = 0, double z = 0) + { + this.X = x; + this.Y = y; + this.Z = z; + } + } +}