Commits

Lars Brubaker committed 8c21a05

Made vector able to take per element formating in tostring.
made the scad output only push 7 decimals into the matrix output.

  • Participants
  • Parent commits 1294b63

Comments (0)

Files changed (2)

Csg/Processors/OpenSCadOutput.cs

         public string GetScadOutputRecursive(TransformBase objectToProcess, int level = 0)
         {
             return ApplyIndent(AddRenderInfoIfReqired(objectToProcess) + "multmatrix(m = [ ["
-                + objectToProcess.transform.Column0.ToString() + "],["
-                + objectToProcess.transform.Column1.ToString() + "],["
-                + objectToProcess.transform.Column2.ToString() + "],["
-                + objectToProcess.transform.Column3.ToString() + "] ])" + AddNameAsComment(objectToProcess) + "\n{\n" + GetScadOutputRecursive((dynamic)objectToProcess.objectToTransform, level + 1) + "\n}", level);
+                + objectToProcess.transform.Column0.ToString("0.#######") + "],["
+                + objectToProcess.transform.Column1.ToString("0.#######") + "],["
+                + objectToProcess.transform.Column2.ToString("0.#######") + "],["
+                + objectToProcess.transform.Column3.ToString("0.#######") + "] ])" + AddNameAsComment(objectToProcess) + "\n{\n" + GetScadOutputRecursive((dynamic)objectToProcess.objectToTransform, level + 1) + "\n}", level);
         }
         #endregion
 

VectorMath/Vector4.cs

             return String.Format("{0}, {1}, {2}, {3}", x, y, z, w);
         }
 
+        /// <summary>
+        /// Returns a System.String that represents the current Vector4d, formatting each element with format.
+        /// </summary>
+        /// <param name="format"></param>
+        /// <returns></returns>
+        public string ToString(string format = "")
+        {
+            return x.ToString(format) + ", " + y.ToString(format) + ", " + z.ToString(format) + ", " + w.ToString(format);
+        }
+
         #endregion
 
         #region public override int GetHashCode()