/**************************************\ * * * OpenSCAD Mesh Display * * by Thinkyhead - April 2017 * * * * Copy the grid output from Marlin, * * paste below as shown, and use * * OpenSCAD to see a visualization * * of your mesh. * * * \**************************************/ $t = 0.15; // comment out during animation! X = 0; Y = 1; L = 0; R = 1; F = 2; B = 3; // // Sample Mesh - Replace with your own // measured_z = [ [ -1.20, -1.13, -1.09, -1.03, -1.19 ], [ -1.16, -1.25, -1.27, -1.25, -1.08 ], [ -1.13, -1.26, -1.39, -1.31, -1.18 ], [ -1.09, -1.20, -1.26, -1.21, -1.18 ], [ -1.13, -0.99, -1.03, -1.06, -1.32 ] ]; // // An offset to add to all points in the mesh // zadjust = 0; // // Mesh characteristics // bed_size = [ 200, 200 ]; mesh_inset = [ 10, 10, 10, 10 ]; // L, F, R, B mesh_bounds = [ [ mesh_inset[L], mesh_inset[F] ], [ bed_size[X] - mesh_inset[R], bed_size[Y] - mesh_inset[B] ] ]; mesh_size = mesh_bounds[1] - mesh_bounds[0]; // NOTE: Marlin meshes already subtract the probe offset NAN = 0; // Z to use for un-measured points // // Geometry // max_z_scale = 100; // Scale at Time 0.5 min_z_scale = 10; // Scale at Time 0.0 and 1.0 thickness = 0.5; // thickness of the mesh triangles tesselation = 1; // levels of tesselation from 0-2 alternation = 2; // direction change modulus (try it) // // Appearance // show_plane = true; show_labels = true; show_coords = true; arrow_length = 5; label_font_lg = "Arial"; label_font_sm = "Arial"; mesh_color = [1,1,1,0.5]; plane_color = [0.4,0.6,0.9,0.6]; //================================================ Derive useful values big_z = max_2D(measured_z,0); lil_z = min_2D(measured_z,0); mean_value = (big_z + lil_z) / 2.0; mesh_points_y = len(measured_z); mesh_points_x = len(measured_z[0]); xspace = mesh_size[X] / (mesh_points_x - 1); yspace = mesh_size[Y] / (mesh_points_y - 1); // At $t=0 and $t=1 scale will be 100% z_scale_factor = min_z_scale + (($t > 0.5) ? 1.0 - $t : $t) * (max_z_scale - min_z_scale) * 2; // // Min and max recursive functions for 1D and 2D arrays // Return the smallest or largest value in the array // function some_1D(b,i) = (i