diff --git a/OSCADSharp/OSCADSharp/Internal/Scripting/Solids/SphereScriptBuilder.cs b/OSCADSharp/OSCADSharp/Internal/Scripting/Solids/SphereScriptBuilder.cs
new file mode 100644
index 0000000..b4b8354
--- /dev/null
+++ b/OSCADSharp/OSCADSharp/Internal/Scripting/Solids/SphereScriptBuilder.cs
@@ -0,0 +1,44 @@
+using OSCADSharp.Bindings;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OSCADSharp.Scripting.Solids
+{
+ internal class SphereScriptBuilder
+ {
+ private IBindings bindings;
+ private Sphere sphere;
+
+ public SphereScriptBuilder(IBindings bindings, Sphere sphere)
+ {
+ this.bindings = bindings;
+ this.sphere = sphere;
+ }
+
+ internal string GetScript()
+ {
+ StatementBuilder sb = new StatementBuilder(this.bindings);
+ sb.Append("sphere(");
+
+ if (this.bindings.Contains("d"))
+ {
+ sb.AppendValuePairIfExists("d", this.sphere.Diameter);
+ }
+ else
+ {
+ sb.AppendValuePairIfExists("r", this.sphere.Radius);
+ }
+
+ sb.AppendValuePairIfExists("$fn", this.sphere.Resolution, true);
+ sb.AppendValuePairIfExists("$fa", this.sphere.MinimumAngle, true);
+ sb.AppendValuePairIfExists("$fs", this.sphere.MinimumFragmentSize, true);
+ sb.Append(");");
+ sb.Append(Environment.NewLine);
+
+ return sb.ToString();
+ }
+ }
+}
diff --git a/OSCADSharp/OSCADSharp/OSCADSharp.csproj b/OSCADSharp/OSCADSharp/OSCADSharp.csproj
index 5859df1..89f7fad 100644
--- a/OSCADSharp/OSCADSharp/OSCADSharp.csproj
+++ b/OSCADSharp/OSCADSharp/OSCADSharp.csproj
@@ -46,6 +46,7 @@
+
diff --git a/OSCADSharp/OSCADSharp/Public/Solids/Sphere.cs b/OSCADSharp/OSCADSharp/Public/Solids/Sphere.cs
index 61648e5..4923dff 100644
--- a/OSCADSharp/OSCADSharp/Public/Solids/Sphere.cs
+++ b/OSCADSharp/OSCADSharp/Public/Solids/Sphere.cs
@@ -9,6 +9,7 @@ using System.Collections.Concurrent;
using System.Reflection;
using OSCADSharp.Bindings;
using OSCADSharp.Bindings.Solids;
+using OSCADSharp.Scripting.Solids;
namespace OSCADSharp
{
@@ -90,25 +91,8 @@ namespace OSCADSharp
/// Script for this object
public override string ToString()
{
- StatementBuilder sb = new StatementBuilder(this.bindings);
- sb.Append("sphere(");
-
- if (this.bindings.Contains("d"))
- {
- sb.AppendValuePairIfExists("d", this.Diameter);
- }
- else
- {
- sb.AppendValuePairIfExists("r", this.Radius);
- }
-
- sb.AppendValuePairIfExists("$fn", this.Resolution, true);
- sb.AppendValuePairIfExists("$fa", this.MinimumAngle, true);
- sb.AppendValuePairIfExists("$fs", this.MinimumFragmentSize, true);
- sb.Append(");");
- sb.Append(Environment.NewLine);
-
- return sb.ToString();
+ var scriptBuilder = new SphereScriptBuilder(this.bindings, this);
+ return scriptBuilder.GetScript();
}
///