Index: export_stl.c =================================================================== --- export_stl.c (revision 28922) +++ export_stl.c (revision 28923) @@ -181,36 +181,6 @@ return 0; } -TODO("this is the same code as in g-code and probably openscad has a version too - centralize"); -static pcb_coord_t pcb_board_thickness(pcb_board_t *pcb) -{ - pcb_layergrp_id_t gid; - pcb_layergrp_t *grp; - pcb_coord_t curr, total = 0; - - for(gid = 0, grp = pcb->LayerGroups.grp; gid < pcb->LayerGroups.len; gid++,grp++) { - const char *s; - - if (!(grp->ltype & PCB_LYT_COPPER) && !(grp->ltype & PCB_LYT_SUBSTRATE)) - continue; - s = pcb_attribute_get(&grp->Attributes, "stl::thickness"); - if (s == NULL) - s = pcb_attribute_get(&grp->Attributes, "thickness"); - - curr = 0; - if (s != NULL) - curr = pcb_get_value(s, NULL, NULL, NULL); - if (curr <= 0) { - if (grp->ltype & PCB_LYT_SUBSTRATE) - pcb_message(PCB_MSG_ERROR, "stl: can not determine substrate thickness on layer group %ld - total board thickness is probably wrong\n", (long)gid); - continue; - } - total += curr; - } - return curr; -} - - static void stl_do_export(pcb_hid_t *hid, pcb_hid_attr_val_t *options) { const char *filename; @@ -240,7 +210,7 @@ /* determine sheet thickness */ if (options[HA_ovrthick].crd > 0) thick = options[HA_ovrthick].crd; - else thick = pcb_board_thickness(PCB); + else thick = pcb_board_thickness(PCB, "stl", PCB_BRDTHICK_PRINT_ERROR); if (thick <= 0) { pcb_message(PCB_MSG_WARNING, "STL: can not determine board thickness - falling back to hardwired 1.6mm\n"); thick = PCB_MM_TO_COORD(1.6);