Index: export_openems.c =================================================================== --- export_openems.c (revision 22822) +++ export_openems.c (revision 22823) @@ -2,7 +2,7 @@ * COPYRIGHT * * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * Copyright (C) 2018,2019 Tibor 'Igor2' Palinkas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -556,6 +556,8 @@ } fprintf(ctx->f, "%%%%%% Board mesh, part 2\n"); + pcb_fprintf(ctx->f, "z_bottom_copper=%mm\n", mesh->z_bottom_copper); + fprintf(ctx->f, "mesh.y=["); openems_write_mesh_lines(ctx, &mesh->line[PCB_MESH_HORIZONTAL]); fprintf(ctx->f, "];\n"); @@ -570,7 +572,7 @@ fprintf(ctx->f, "mesh.x = mesh.x .+ offset.x;\n"); fprintf(ctx->f, "mesh.y = offset.y .- mesh.y;\n"); - fprintf(ctx->f, "mesh.z = mesh.z .+ offset.z;\n"); + fprintf(ctx->f, "mesh.z = z_bottom_copper .- mesh.z .+ offset.z;\n"); fprintf(ctx->f, "CSX = DefineRectGrid(CSX, unit, mesh);\n"); fprintf(ctx->f, "\n"); } Index: mesh.c =================================================================== --- mesh.c (revision 22822) +++ mesh.c (revision 22823) @@ -2,7 +2,7 @@ * COPYRIGHT * * pcb-rnd, interactive printed circuit board design - * Copyright (C) 2018 Tibor 'Igor2' Palinkas + * Copyright (C) 2018,2019 Tibor 'Igor2' Palinkas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -616,6 +616,7 @@ } } + mesh->z_bottom_copper = ybottom; return 0; } Index: mesh.h =================================================================== --- mesh.h (revision 22822) +++ mesh.h (revision 22823) @@ -28,6 +28,7 @@ pcb_coord_t def_copper_thick; /* default copper thickness */ pcb_mesh_lines_t line[PCB_MESH_max]; /* actual lines of the mesh */ const char *bnd[6]; /* temporary: boundary conditions */ + pcb_coord_t z_bottom_copper; /* z coordinate of the bottom copper layer, along the z-mesh (0 is the top copper) */ unsigned smooth:1; /* if set, avoid jumps in the meshing by gradually changing meshing distance */ unsigned noimpl:1; /* when set, do not add extra implicit mesh lines, keep the explicit ones only */ } pcb_mesh_t;