Index: src_plugins/export_openems/export_openems.c =================================================================== --- src_plugins/export_openems/export_openems.c (revision 32020) +++ src_plugins/export_openems/export_openems.c (revision 32021) @@ -192,6 +192,19 @@ return openems_attribute_list; } +TODO("remove this once the function is moved and published in core") +extern const char *pcb_layergrp_thickness_attr(pcb_layergrp_t *grp, const char *namespace); + +rnd_coord_t ems_layergrp_thickness(pcb_layergrp_t *grp) +{ + rnd_coord_t th; + const char *s = pcb_layergrp_thickness_attr(grp, "openems"); + if (s != NULL) + th = rnd_get_value(s, NULL, NULL, NULL); + return th; +} + + /* Find the openems 0;0 mark, if there is any */ static void find_origin_bump(void *ctx_, pcb_board_t *pcb, pcb_layer_t *layer, pcb_line_t *line) { Index: src_plugins/export_openems/openems_xml.c =================================================================== --- src_plugins/export_openems/openems_xml.c (revision 32020) +++ src_plugins/export_openems/openems_xml.c (revision 32021) @@ -28,10 +28,6 @@ static double def_end_crit = 1e-05; static long def_f_max = 2100000000; -TODO("remove this once the function is moved and published in core") -extern const char *pcb_layergrp_thickness_attr(pcb_layergrp_t *grp, const char *namespace); - - static void openems_wr_xml_layergrp_end(wctx_t *ctx) { if (ctx->cond_sheet_open) { @@ -89,15 +85,9 @@ static int openems_wr_xml_outline(wctx_t *ctx, pcb_layergrp_t *g) { - int n; pcb_any_obj_t *out1; - const char *s; - rnd_coord_t th = 0; + rnd_coord_t th = ems_layergrp_thickness(g); - s = pcb_layergrp_thickness_attr(g, "openems"); - if (s != NULL) - th = rnd_get_value(s, NULL, NULL, NULL); - if (th <= 0) { rnd_message(RND_MSG_ERROR, "Substrate thickness is missing or invalid - can't export\n"); return -1;