/// <summary> /// Converts this object to an OpenSCAD script /// </summary> /// <returns>Script for this object</returns> public override string ToString() { StatementBuilder sb = new StatementBuilder(); sb.Append("sphere("); 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(); }
/// <summary> /// Converts this object to an OpenSCAD script /// </summary> /// <returns>Script for this object</returns> public override string ToString() { var sb = new StatementBuilder(); sb.Append("cylinder("); sb.AppendValuePairIfExists("center", this.Center.ToString().ToLower()); appendDiameterAndRadius(sb); sb.AppendValuePairIfExists("h", this.Height, true); sb.AppendValuePairIfExists("$fn", this.Resolution, true); sb.AppendValuePairIfExists("$fa", this.MinimumAngle, true); sb.AppendValuePairIfExists("$fs", this.MinimumCircumferentialLength, true); sb.Append(");"); sb.Append(Environment.NewLine); return sb.ToString(); }
/// <summary> /// Converts this object to an OpenSCAD script /// </summary> /// <returns>Script for this object</returns> public override string ToString() { StatementBuilder sb = new StatementBuilder(); sb.Append("text("); sb.Append("\""); sb.Append(this.Text); sb.Append("\""); sb.AppendValuePairIfExists("size", this.Size?.ToString(), true); // Text is always centered in OSCADSharp to ensure correctness of // position interpolation sb.AppendValuePairIfExists("halign", "\"center\"", true); sb.AppendValuePairIfExists("valign", "\"center\"", true); sb.AppendValuePairIfExists("font", this.Font, true); sb.AppendValuePairIfExists("spacing", this.Spacing?.ToString(), true); sb.AppendValuePairIfExists("direction", this.TextDirection?.ToString(), true); sb.AppendValuePairIfExists("language", this.Language?.ToString(), true); sb.Append(");"); sb.Append(Environment.NewLine); var formatter = new SingleBlockFormatter(String.Format("linear_extrude(height = {0})", 1), sb.ToString()); return formatter.ToString(); }