/**************************************\ * * * 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 // // Mesh info and points // mesh_width = 200; // X Size in mm of the probed area mesh_height = 200; // Y Size... zprobe_offset = 0; // Added to the points NAN = 0; // Z to use for un-measured points 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 ] ]; // // 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; 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_width / (mesh_points_x - 1); yspace = mesh_height / (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 min_1D(b,i) = (i