Index: trunk/src/obj_pstk_inlines.h =================================================================== --- trunk/src/obj_pstk_inlines.h (revision 29869) +++ trunk/src/obj_pstk_inlines.h (revision 29870) @@ -302,6 +302,34 @@ return pcb_pstk_shape_mech_gid(pcb, ps, layer->meta.real.grp); } +/* Returns a shape correspinding to the hole or the mech shape (slot) if + it affects layer; hole shape is created in holetmp */ +PCB_INLINE pcb_pstk_shape_t *pcb_pstk_shape_mech_or_hole_at(pcb_board_t *pcb, pcb_pstk_t *ps, pcb_layer_t *layer, pcb_pstk_shape_t *holetmp) +{ + pcb_pstk_tshape_t *ts; + pcb_pstk_proto_t *proto; + + layer = pcb_layer_get_real(layer); + + if (!pcb_pstk_bb_drills(pcb, ps, pcb_layer_get_group_(layer), &proto)) + return NULL; + + /* hole has priority */ + if (proto->hdia > 0) { + holetmp->shape = PCB_PSSH_CIRC; + holetmp->data.circ.dia = proto->hdia; + holetmp->data.circ.x = holetmp->data.circ.y = 0; + return holetmp; + } + + /* if there's no hole, check for slot */ + if (proto->mech_idx < 0) + return NULL; /* no mech shape -> no slot */ + + ts = pcb_pstk_get_tshape(ps); + return ts->shape + proto->mech_idx; +} + /* Return the shape of the hshadow, if it is not the same as the forbidden shape. The forbidden shape should be the shape that triggers the lookup. tmpshp should be a local temporary shape where the circular shape for a