Index: exto_trdp.c =================================================================== --- exto_trdp.c (revision 34161) +++ exto_trdp.c (revision 34162) @@ -72,11 +72,11 @@ if (teardrops_init_pstk(tr, ps, tr->line->parent.layer) == 0) teardrop_line(tr, tr->line); - return 1; + return RND_R_DIR_FOUND_CONTINUE; } /* create new teardrops on a line endpoint */ -static long trdp_gen_line_pt(pcb_board_t *pcb, pcb_subc_t *subc, pcb_line_t *line, int second) +static void trdp_gen_line_pt(pcb_board_t *pcb, pcb_subc_t *subc, pcb_line_t *line, int second, rnd_coord_t *jx, rnd_coord_t *jy) { teardrop_t t; rnd_coord_t x, y; @@ -103,7 +103,11 @@ spot.Y2 = y + 10; rnd_r_search(pcb->Data->padstack_tree, &spot, NULL, trdp_pstk_cb, &t, NULL); - return t.new_arcs; + + if (t.new_arcs > 0) { + *jx = t.jx; + *jy = t.jy; + } } static int trdp_gen(pcb_subc_t *subc, pcb_any_obj_t *edit_obj) @@ -111,6 +115,7 @@ pcb_layer_t *ly = &subc->data->Layer[LID_EDIT]; pcb_line_t *edit_line; pcb_board_t *pcb = pcb_data_get_top(subc->data); + rnd_coord_t jx, jy; if (subc->extobj_data == NULL) trdp_unpack(subc); @@ -125,20 +130,15 @@ edit_line = linelist_first(&ly->Line); - trdp_gen_line_pt(pcb, subc, edit_line, 0); - trdp_gen_line_pt(pcb, subc, edit_line, 1); -TODO("move origin to focal point"); -#if 0 - { - pcb_layer_t *ly = &subc->data->Layer[LID_EDIT]; - line_geo_def; - line = linelist_first(&ly->Line); - line_geo_calc(line); - pcb_subc_move_origin_to(subc, line->Point1.X - dy * PCB_SUBC_AUX_UNIT, line->Point1.Y + dx * PCB_SUBC_AUX_UNIT, 0); - } -#endif + jx = (edit_line->Point1.X + edit_line->Point2.X) / 2; + jy = (edit_line->Point1.Y + edit_line->Point2.Y) / 2; + trdp_gen_line_pt(pcb, subc, edit_line, 0, &jx, &jy); + trdp_gen_line_pt(pcb, subc, edit_line, 1, &jx, &jy); + + pcb_subc_move_origin_to(subc, jx, jy, 0); + return pcb_exto_regen_end(subc); } Index: teardrops.c =================================================================== --- teardrops.c (revision 34161) +++ teardrops.c (revision 34162) @@ -47,6 +47,7 @@ rnd_coord_t thickness; long new_arcs; pcb_flag_t flags; + rnd_coord_t jx, jy; /* output: junction point x;y where all the arcs come together on the line */ } teardrop_t; #define RCRD(c) ((rnd_coord_t)(rnd_round(c))) @@ -136,6 +137,9 @@ lx = tr->px + dx * ldist; ly = tr->py + dy * ldist; + tr->jx = RCRD(lx); + tr->jy = RCRD(ly); + /* We need one up front to determine how many segments it will take to fill. */ ax = lx - dy * adist; ay = ly + dx * adist; @@ -249,7 +253,7 @@ tr->flags = line->Flags; teardrop_line(tr, line); - return 1; + return RND_R_DIR_FOUND_CONTINUE; } static long check_pstk(pcb_board_t *pcb, pcb_pstk_t *ps)