Index: trunk/src_plugins/query/net_len.c =================================================================== --- trunk/src_plugins/query/net_len.c (revision 34956) +++ trunk/src_plugins/query/net_len.c (revision 34957) @@ -256,15 +256,18 @@ /* rnd_trace(" junction: obj=#%ld at end #%ld\n", junct->ID, seg_end->ID);*/ - /* do not add the same thing twice */ - if ((ctx->seglen->junction[0] == junct) || (ctx->seglen->junction[1] == junct)) - return; - - if (ctx->seglen->junction[i] != NULL) i++; - if (ctx->seglen->junction[i] != NULL) { - ctx->seglen->hub = 1; - return; + /* do not add the same thing twice: keep only one junct object per seg end */ + if ((ctx->seglen->junc_at[0] == seg_end) || (ctx->seglen->junc_at[1] == seg_end)) { + /* keep it as spare */ + i = 2; } + else { + if (ctx->seglen->junction[i] != NULL) i++; + if (ctx->seglen->junction[i] != NULL) { + ctx->seglen->hub = 1; + return; + } + } ctx->seglen->junction[i] = junct; ctx->seglen->junc_at[i] = seg_end; @@ -482,6 +485,20 @@ rnd_swap(pcb_any_obj_t *, ctx.seglen->junction[0], ctx.seglen->junction[1]); } + /* a hub segment is a single object with junction (sometimes in the spare field) */ + if ((ctx.seglen->objs.used == 1) && (ctx.seglen->junc_at[2] != NULL)) { + ctx.seglen->hub = 1; + /* recycle spare if possible */ + if (ctx.seglen->junc_at[0] == NULL) { + ctx.seglen->junc_at[0] = ctx.seglen->junc_at[2]; + ctx.seglen->junction[0] = ctx.seglen->junction[2]; + } + else if (ctx.seglen->junc_at[1] == NULL) { + ctx.seglen->junc_at[1] = ctx.seglen->junc_at[2]; + ctx.seglen->junction[1] = ctx.seglen->junction[2]; + } + } + ec->tmplst.used = 0; return ctx.seglen; } Index: trunk/src_plugins/query/net_len.h =================================================================== --- trunk/src_plugins/query/net_len.h (revision 34956) +++ trunk/src_plugins/query/net_len.h (revision 34957) @@ -4,8 +4,8 @@ vtp0_t objs; unsigned has_junction:1; unsigned has_nontrace:1; - pcb_any_obj_t *junction[2]; /* object with a junction on it before and after the list */ - pcb_any_obj_t *junc_at[2]; /* our last object (part of the seg) that faces the given junction */ + pcb_any_obj_t *junction[3]; /* object with a junction on it before and after the list; 0..1 are ordered as objs; 2 is a spare field for internal use */ + pcb_any_obj_t *junc_at[3]; /* our last object (part of the seg) that faces the given junction */ unsigned hub:1; /* when set, this segment is a junction hub with more than 2 connected segments */ rnd_coord_t len; int num_vias; /* number of functional vias, a.k.a. layer group changes */