Index: pstklib.c =================================================================== --- pstklib.c (revision 35184) +++ pstklib.c (revision 35185) @@ -66,3 +66,15 @@ } } +void pcb_pstklib_build_pcb(pcb_pstklib_t *ctx, int recurse_subc) +{ + pcb_pstklib_build_data(ctx, ctx->pcb->Data); + if (!recurse_subc) + return; + + PCB_SUBC_LOOP(ctx->pcb->Data); + { + pcb_pstklib_build_data(ctx, subc->data); + } + PCB_END_LOOP; +} Index: pstklib.h =================================================================== --- pstklib.h (revision 35184) +++ pstklib.h (revision 35185) @@ -31,5 +31,10 @@ /* Iterate all padstack prototypes within data and build ctx->protos hash */ void pcb_pstklib_build_data(pcb_pstklib_t *ctx, pcb_data_t *data); +/* Auto build the padstack proto lib from ctx->pcb, with option to recurse + into subcircuits and collect prototypes there too */ +void pcb_pstklib_build_pcb(pcb_pstklib_t *ctx, int recurse_subc); + + /* return proto's prototype or NULL */ #define pcb_pstklib_get(ctx, proto) htprp_get((ctx)->protos, (proto))