Index: src_plugins/export_openems/export_openems.c
===================================================================
--- src_plugins/export_openems/export_openems.c (revision 31996)
+++ src_plugins/export_openems/export_openems.c (revision 31997)
@@ -61,6 +61,8 @@
#define MESH_NAME "openems"
+#define PRIO_COPPER 1
+
typedef struct rnd_hid_gc_s {
rnd_core_gc_t core_gc;
rnd_hid_t *me_pointer;
@@ -89,6 +91,7 @@
/* xml */
unsigned cond_sheet_open:1;
+ double elevation; /* in mm */
} wctx_t;
static FILE *f = NULL;
@@ -792,7 +795,15 @@
rnd_fprintf(ctx->f, "CSX = AddPcbrndTrace(CSX, PCBRND, %d, points%ld, %mm, 0);\n", ctx->clayer, oid, radius*2);
}
else {
- rnd_fprintf(ctx->f, "TODO: fill circle %mm;%mm\n", cx, cy);
+ double a, step, x = RND_COORD_TO_MM(cx), y = -RND_COORD_TO_MM(cy), r = RND_COORD_TO_MM(radius);
+ step = r*10;
+ if (step < 8) step = 8;
+ step = 2*M_PI/step;
+
+ rnd_fprintf(ctx->f, " ", PRIO_COPPER, ctx->elevation);
+ for(a = 0; a < 2*M_PI; a += step)
+ rnd_fprintf(ctx->f, " \n", x + cos(a)*r, y + sin(a)*r);
+ rnd_fprintf(ctx->f, " \n");
}
}
@@ -810,7 +821,10 @@
fprintf(ctx->f, "CSX = AddPcbrndPoly(CSX, PCBRND, %d, poly%ld_xy, 1);\n", ctx->clayer, oid);
}
else {
- rnd_fprintf(ctx->f, "TODO: poly offs %mm;%mm\n", dx, dy);
+ rnd_fprintf(ctx->f, " ", PRIO_COPPER, ctx->elevation);
+ for(n = 0; n < n_coords; n++)
+ rnd_fprintf(ctx->f, " \n", RND_COORD_TO_MM(x[n]+dx), RND_COORD_TO_MM(-(y[n]+dy)));
+ rnd_fprintf(ctx->f, " \n");
}
}
Index: src_plugins/export_openems/openems_xml.c
===================================================================
--- src_plugins/export_openems/openems_xml.c (revision 31996)
+++ src_plugins/export_openems/openems_xml.c (revision 31997)
@@ -40,11 +40,24 @@
static void openems_wr_xml_layergrp_begin(wctx_t *ctx, pcb_layergrp_t *g)
{
+ rnd_layergrp_id_t from, to;
+
openems_wr_xml_layergrp_end(ctx);
+ rnd_coord_t th;
TODO("Fix hardwired constants");
fprintf(ctx->f, " \n", g->name);
fprintf(ctx->f, " \n");
ctx->cond_sheet_open = 1;
+
+ if (pcb_layergrp_list(ctx->pcb, PCB_LYT_BOTTOM|PCB_LYT_COPPER, &from, 1) != 1) {
+ ctx->elevation = 0;
+ rnd_message(RND_MSG_ERROR, "Missing bottom copper layer group - can not simulate\n");
+ TODO("return error");
+ }
+ to = g - ctx->pcb->LayerGroups.grp;
+ th = pcb_stack_thickness(ctx->pcb, "openems", PCB_BRDTHICK_PRINT_ERROR, from, 1, to, 0, PCB_LYT_SUBSTRATE|PCB_LYT_COPPER);
+TODO("check for -1 and return error");
+ ctx->elevation = RND_COORD_TO_MM(th);
}
static void openems_wr_xml_grp_substrate(wctx_t *ctx, pcb_layergrp_t *g)