Index: board.c =================================================================== --- board.c (revision 19254) +++ board.c (revision 19255) @@ -199,6 +199,21 @@ return PCB_R_DIR_FOUND_CONTINUE; } +static pcb_r_dir_t slot_counting_callback(const pcb_box_t *b, void *cl) +{ + pcb_pstk_t *ps = (pcb_pstk_t *)b; + pcb_pstk_proto_t *proto = pcb_pstk_get_proto(ps); + HoleCountStruct *hcs = (HoleCountStruct *)cl; + + if ((proto != NULL) && (proto->mech_idx >= 0)) { + if (proto->hplated) + hcs->nplated++; + else + hcs->nunplated++; + } + return PCB_R_DIR_FOUND_CONTINUE; +} + void pcb_board_count_holes(pcb_board_t *pcb, int *plated, int *unplated, const pcb_box_t *within_area) { HoleCountStruct hcs = { 0, 0 }; @@ -211,6 +226,18 @@ *unplated = hcs.nunplated; } +void pcb_board_count_slots(pcb_board_t *pcb, int *plated, int *unplated, const pcb_box_t *within_area) +{ + HoleCountStruct hcs = { 0, 0 }; + + pcb_r_search(pcb->Data->padstack_tree, within_area, NULL, slot_counting_callback, &hcs, NULL); + + if (plated != NULL) + *plated = hcs.nplated; + if (unplated != NULL) + *unplated = hcs.nunplated; +} + const char *pcb_board_get_filename(void) { return PCB->Filename;