diff --git a/OSCADSharp/OSCADSharp/OSCADSharp.csproj b/OSCADSharp/OSCADSharp/OSCADSharp.csproj
index 8289d91..8688971 100644
--- a/OSCADSharp/OSCADSharp/OSCADSharp.csproj
+++ b/OSCADSharp/OSCADSharp/OSCADSharp.csproj
@@ -40,6 +40,7 @@
+
diff --git a/OSCADSharp/OSCADSharp/Text3D.cs b/OSCADSharp/OSCADSharp/Text3D.cs
index f27b481..866ebbf 100644
--- a/OSCADSharp/OSCADSharp/Text3D.cs
+++ b/OSCADSharp/OSCADSharp/Text3D.cs
@@ -20,20 +20,20 @@ namespace OSCADSharp
/// The generated text will have approximately an ascent of the given value (height above the baseline). Default is 10.
/// Note that specific fonts will vary somewhat and may not fill the size specified exactly, usually slightly smaller.
///
- public uint Size { get; set; }
+ public uint? Size { get; set; } = null;
///
/// The name of the font that should be used. This is not the name of the font file,
/// but the logical font name (internally handled by the fontconfig library). This can also include a style parameter, see below.
/// A list of installed fonts & styles can be obtained using the font list dialog (Help -> Font List).
///
- public string Font { get; set; }
+ public string Font { get; set; } = null;
///
/// The horizontal alignment for the text. Possible values are "left", "center" and "right". Default is "left".
///
/// TODO: Implement alignments
- public string HorizontalAlignment { get; set; }
+ //public string HorizontalAlignment { get; set; }
///
/// The vertical alignment for the text. Possible values are "top", "center", "baseline" and "bottom". Default is "baseline".
@@ -44,7 +44,7 @@ namespace OSCADSharp
///
/// Factor to increase/decrease the character spacing. The default value of 1 will result in the normal spacing for the font, giving a value greater than 1 will cause the letters to be spaced further apart.
///
- public uint Spacing { get; set; }
+ public uint? Spacing { get; set; } = null;
///
/// Direction of the text flow. Possible values are "ltr" (left-to-right), "rtl" (right-to-left), "ttb" (top-to-bottom) and "btt" (bottom-to-top). Default is "ltr".
@@ -55,22 +55,38 @@ namespace OSCADSharp
/// The language of the text. Default is "en".
///
public string Language { get; set; }
-
+
///
/// Used for subdividing the curved path segments provided by freetype
/// ($fn in OpenSCAD)
///
- public int Resolution { get; set; } = 0;
+ /// TODO: Implement Resolution
+ // public int? Resolution { get; set; } = 0;
+
+ ///
+ /// The script of the text. Default is "latin".
+ ///
+ /// TODO: Implement Script
+ // public string Script { get; set; }
public override OSCADObject Clone()
{
- throw new NotImplementedException();
+ return new Text3D()
+ {
+ Text = this.Text,
+ Size = this.Size,
+ Font = this.Font,
+ Spacing = this.Spacing,
+ TextDirection = this.TextDirection,
+ Language = this.Language
+ };
}
- private void appendValueIfExists(string name, string value, StringBuilder sb)
+ private void appendIfValueNotNullOrEmpty(string name, string value, StringBuilder sb)
{
if(!String.IsNullOrEmpty(value))
{
+ sb.Append(", ");
sb.Append(name);
sb.Append("=");
sb.Append(value);
@@ -85,10 +101,15 @@ namespace OSCADSharp
sb.Append(this.Text);
sb.Append("\"");
- appendValueIfExists("font", this.Font, sb);
+ appendIfValueNotNullOrEmpty("size", this.Size?.ToString(), sb);
+ appendIfValueNotNullOrEmpty("font", this.Font, sb);
+ appendIfValueNotNullOrEmpty("spacing", this.Spacing?.ToString(), sb);
+ appendIfValueNotNullOrEmpty("direction", this.TextDirection?.ToString(), sb);
+ appendIfValueNotNullOrEmpty("language", this.Language?.ToString(), sb);
+
sb.Append(");");
- return base.ToString();
+ return sb.ToString();
}
}
}
diff --git a/OSCADSharp/OSCADSharp/Transforms/LinearExtrudedObject.cs b/OSCADSharp/OSCADSharp/Transforms/LinearExtrudedObject.cs
new file mode 100644
index 0000000..dbb8605
--- /dev/null
+++ b/OSCADSharp/OSCADSharp/Transforms/LinearExtrudedObject.cs
@@ -0,0 +1,50 @@
+using OSCADSharp.Scripting;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OSCADSharp.Transforms
+{
+ ///
+ /// Linear Extrusion is a modeling operation that takes a 2D polygon as input and extends it in the third dimension. This way a 3D shape is created.
+ ///
+ /// This is a limited subset of the capabilities
+ ///
+ internal class LinearExtrudedObject : OSCADObject
+ {
+ ///
+ /// Height to extrude to
+ ///
+ public double Height { get; set; } = 1.0;
+ private OSCADObject obj;
+
+ //TODO: Possibly implement everything else?
+ //linear_extrude(height = fanwidth, center = true, convexity = 10, twist = -fanrot, slices = 20, scale = 1.0) {...}
+
+ ///
+ /// An object that will be extruded from 2d to 3d
+ ///
+ ///
+ ///
+ public LinearExtrudedObject(OSCADObject obj, double height)
+ {
+ this.obj = obj;
+ this.Height = height;
+ }
+
+
+ public override OSCADObject Clone()
+ {
+ return new LinearExtrudedObject(this.obj, this.Height);
+ }
+
+ public override string ToString()
+ {
+ string extrudeCommand = String.Format("linear_extrude(height = {0})", this.Height.ToString());
+ var formatter = new BlockFormatter(extrudeCommand, this.obj.ToString());
+ return formatter.ToString();
+ }
+ }
+}