Skip to content

Commit

Permalink
attempt at solving bug MatterHackers#327 -
Browse files Browse the repository at this point in the history
  • Loading branch information
cristy-the-one committed Feb 29, 2020
1 parent 4ec0f0b commit 71af5d0
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Csg/Processors/OpenSCadOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The views and conclusions contained in the software and documentation are those
using System;
using System.IO;
using System.Text;
using System.Globalization;

namespace MatterHackers.Csg.Processors
{
Expand Down Expand Up @@ -98,11 +99,11 @@ public string GetScadOutputRecursive(BoxPrimitive objectToProcess, int level = 0

if (objectToProcess.CreateCentered)
{
info += "cube([" + objectToProcess.Size.X.ToString() + ", " + objectToProcess.Size.Y.ToString() + ", " + objectToProcess.Size.Z.ToString() + "], center=true);" + AddNameAsComment(objectToProcess);
info += "cube([" + objectToProcess.Size.X.ToString(CultureInfo.InvariantCulture) + ", " + objectToProcess.Size.Y.ToString(CultureInfo.InvariantCulture) + ", " + objectToProcess.Size.Z.ToString(CultureInfo.InvariantCulture) + "], center=true);" + AddNameAsComment(objectToProcess);
}
else
{
info += "cube([" + objectToProcess.Size.X.ToString() + ", " + objectToProcess.Size.Y.ToString() + ", " + objectToProcess.Size.Z.ToString() + "]);" + AddNameAsComment(objectToProcess);
info += "cube([" + objectToProcess.Size.X.ToString(CultureInfo.InvariantCulture) + ", " + objectToProcess.Size.Y.ToString(CultureInfo.InvariantCulture) + ", " + objectToProcess.Size.Z.ToString(CultureInfo.InvariantCulture) + "]);" + AddNameAsComment(objectToProcess);
}
return ApplyIndent(info, level);
}
Expand All @@ -126,7 +127,7 @@ public string GetScadOutputRecursive(Cylinder.CylinderPrimitive objectToProcess,
{
string info = AddRenderInfoIfReqired(objectToProcess);

info += "cylinder(r1=" + objectToProcess.Radius1.ToString() + ", r2=" + objectToProcess.Radius2.ToString() + ", h=" + objectToProcess.Height.ToString() + ", center=true, $fn={0});".FormatWith(NumberOfCylinderSegments) + AddNameAsComment(objectToProcess);
info += "cylinder(r1=" + objectToProcess.Radius1.ToString(CultureInfo.InvariantCulture) + ", r2=" + objectToProcess.Radius2.ToString(CultureInfo.InvariantCulture) + ", h=" + objectToProcess.Height.ToString(CultureInfo.InvariantCulture) + ", center=true, $fn={0});".FormatWith(NumberOfCylinderSegments) + AddNameAsComment(objectToProcess);

return ApplyIndent(info, level);
}
Expand All @@ -140,11 +141,11 @@ public string GetScadOutputRecursive(RotateExtrude.RotateExtrudePrimitive object
string info = AddRenderInfoIfReqired(objectToProcess);

string rotate_extrude = "rotate_extrude(convexity = 10, $fn = {0})".FormatWith(NumberOfCylinderSegments);
string translate = "translate([" + objectToProcess.AxisOffset.ToString() + ", 0, 0])";
string translate = "translate([" + objectToProcess.AxisOffset.ToString(CultureInfo.InvariantCulture) + ", 0, 0])";
string thingToRotate = "polygon( points=[";
foreach (Vector2 point in objectToProcess.Points)
{
thingToRotate += "[" + point.X.ToString() + ", " + point.Y.ToString() + "], ";
thingToRotate += "[" + point.X.ToString(CultureInfo.InvariantCulture) + ", " + point.Y.ToString(CultureInfo.InvariantCulture) + "], ";
}
thingToRotate += "] );";

Expand All @@ -171,7 +172,7 @@ public string GetScadOutputRecursive(LinearExtrude.LinearExtrudePrimitive object
string thingToRotate = "polygon( points=[";
foreach (Vector2 point in objectToProcess.Points)
{
thingToRotate += "[" + point.X.ToString() + ", " + point.Y.ToString() + "], ";
thingToRotate += "[" + point.X.ToString(CultureInfo.InvariantCulture) + ", " + point.Y.ToString(CultureInfo.InvariantCulture) + "], ";
}
thingToRotate += "] );";

Expand Down Expand Up @@ -209,7 +210,7 @@ public string GetScadOutputRecursive(NGonExtrusion.NGonExtrusionPrimitive object
{
string info = AddRenderInfoIfReqired(objectToProcess);

info += "cylinder(r1=" + objectToProcess.Radius1.ToString() + ", r2=" + objectToProcess.Radius1.ToString() + ", h=" + objectToProcess.Height.ToString() + ", center=true, $fn=" + objectToProcess.NumSides.ToString() + ");" + AddNameAsComment(objectToProcess);
info += "cylinder(r1=" + objectToProcess.Radius1.ToString(CultureInfo.InvariantCulture) + ", r2=" + objectToProcess.Radius1.ToString(CultureInfo.InvariantCulture) + ", h=" + objectToProcess.Height.ToString(CultureInfo.InvariantCulture) + ", center=true, $fn=" + objectToProcess.NumSides.ToString(CultureInfo.InvariantCulture) + ");" + AddNameAsComment(objectToProcess);

return ApplyIndent(info, level);
}
Expand All @@ -222,7 +223,7 @@ public string GetScadOutputRecursive(Sphere objectToProcess, int level = 0)
{
string info = AddRenderInfoIfReqired(objectToProcess);

info += "sphere(" + objectToProcess.Radius.ToString() + ", $fn={0});".FormatWith(NumberOfCylinderSegments) + AddNameAsComment(objectToProcess);
info += "sphere(" + objectToProcess.Radius.ToString(CultureInfo.InvariantCulture) + ", $fn={0});".FormatWith(NumberOfCylinderSegments) + AddNameAsComment(objectToProcess);
return ApplyIndent(info, level);
}

Expand Down Expand Up @@ -335,4 +336,4 @@ private string Spaces(int num)

#endregion SCAD Formating Functions
}
}
}

0 comments on commit 71af5d0

Please sign in to comment.