Index: trunk/src/obj_subc.c =================================================================== --- trunk/src/obj_subc.c (revision 22694) +++ trunk/src/obj_subc.c (revision 22695) @@ -1877,7 +1877,7 @@ return val; } -pcb_subc_t *pcb_subc_replace(pcb_board_t *pcb, pcb_subc_t *dst, pcb_subc_t *src, pcb_bool add_undo) +pcb_subc_t *pcb_subc_replace(pcb_board_t *pcb, pcb_subc_t *dst, pcb_subc_t *src, pcb_bool add_undo, pcb_bool dumb) { pcb_data_t *data = dst->parent.data; pcb_subc_t *placed; @@ -1888,11 +1888,19 @@ assert(dst->parent_type == PCB_PARENT_DATA); assert(src != NULL); - if (pcb_subc_get_origin(dst, &ox, &oy) != 0) { - ox = (dst->BoundingBox.X1 + dst->BoundingBox.X2) / 2; - oy = (dst->BoundingBox.Y1 + dst->BoundingBox.Y2) / 2; + if (dumb) { + ox = pcb_crosshair.X; + oy = pcb_crosshair.Y; + rot = 0; } - pcb_subc_get_rotation(dst, &rot); + else { + if (pcb_subc_get_origin(dst, &ox, &oy) != 0) { + ox = (dst->BoundingBox.X1 + dst->BoundingBox.X2) / 2; + oy = (dst->BoundingBox.Y1 + dst->BoundingBox.Y2) / 2; + } + pcb_subc_get_rotation(dst, &rot); + } + placed = pcb_subc_dup_at(pcb, data, src, ox, oy, 0); Index: trunk/src/obj_subc.h =================================================================== --- trunk/src/obj_subc.h (revision 22694) +++ trunk/src/obj_subc.h (revision 22695) @@ -164,8 +164,10 @@ pcb_subc_t *pcb_subc_dup_at(pcb_board_t *pcb, pcb_data_t *dst, pcb_subc_t *src, pcb_coord_t dx, pcb_coord_t dy, pcb_bool keep_ids); /* Replace dst with a copy of src in place (preserving location and orientation - and attributes */ -pcb_subc_t *pcb_subc_replace(pcb_board_t *pcb, pcb_subc_t *dst, pcb_subc_t *src, pcb_bool add_undo); + and attributes. If add_undo is true, add the old subc del and the new subc + creation to the undo list. If dub is true, do not try to match rotation or + pick up coords, just use crosshair and current loc. */ +pcb_subc_t *pcb_subc_replace(pcb_board_t *pcb, pcb_subc_t *dst, pcb_subc_t *src, pcb_bool add_undo, pcb_bool dumb); /*** loops ***/ Index: trunk/src/rats_patch.c =================================================================== --- trunk/src/rats_patch.c (revision 22694) +++ trunk/src/rats_patch.c (revision 22695) @@ -382,7 +382,7 @@ return pcb_rats_patch_export(pcb, pcb->NetlistPatches, !fmt_pcb, fexport_cb, &ctx); } -static const char pcb_acts_ReplaceFootprint[] = "ReplaceFootprint([Selected|Object], [footprint])\n"; +static const char pcb_acts_ReplaceFootprint[] = "ReplaceFootprint([Selected|Object], [footprint], [dumb])\n"; static const char pcb_acth_ReplaceFootprint[] = "Replace the footprint of the selected components with the footprint specified."; static int act_replace_footprint_dst(int op, pcb_subc_t **olds) @@ -468,7 +468,7 @@ } -static int act_replace_footprint(int op, pcb_subc_t *olds, pcb_subc_t *news, char *fpname) +static int act_replace_footprint(int op, pcb_subc_t *olds, pcb_subc_t *news, char *fpname, int dumb) { int changed = 0; pcb_subc_t *placed; @@ -481,9 +481,10 @@ if (!PCB_FLAG_TEST(PCB_FLAG_SELECTED, subc) || (subc->refdes == NULL)) continue; - placed = pcb_subc_replace(PCB, subc, news, pcb_true); + placed = pcb_subc_replace(PCB, subc, news, pcb_true, dumb); if (placed != NULL) { - pcb_ratspatch_append_optimize(PCB, RATP_CHANGE_ATTRIB, placed->refdes, "footprint", fpname); + if (!dumb) + pcb_ratspatch_append_optimize(PCB, RATP_CHANGE_ATTRIB, placed->refdes, "footprint", fpname); changed = 1; } } @@ -490,9 +491,10 @@ PCB_END_LOOP; break; case F_Object: - placed = pcb_subc_replace(PCB, olds, news, pcb_true); + placed = pcb_subc_replace(PCB, olds, news, pcb_true, dumb); if (placed != NULL) { - pcb_ratspatch_append_optimize(PCB, RATP_CHANGE_ATTRIB, placed->refdes, "footprint", fpname); + if (!dumb) + pcb_ratspatch_append_optimize(PCB, RATP_CHANGE_ATTRIB, placed->refdes, "footprint", fpname); changed = 1; } break; @@ -511,13 +513,12 @@ static fgw_error_t pcb_act_ReplaceFootprint(fgw_arg_t *res, int argc, fgw_arg_t *argv) { - char *fpname = NULL; + char *fpname = NULL, *dumbs = NULL; pcb_subc_t *olds = NULL, *news; - int op = F_Selected; + int dumb = 0, op = F_Selected; PCB_ACT_MAY_CONVARG(1, FGW_KEYWORD, ReplaceFootprint, op = fgw_keyword(&argv[1])); - if (act_replace_footprint_dst(op, &olds) != 0) { PCB_ACT_IRES(1); return 0; @@ -530,7 +531,12 @@ return 0; } - PCB_ACT_IRES(act_replace_footprint(op, olds, news, fpname)); + PCB_ACT_MAY_CONVARG(3, FGW_STR, ReplaceFootprint, dumbs = argv[3].val.str); + if ((dumbs != NULL) && (strcmp(dumbs, "dumb") == 0)) + dumb = 1; + + + PCB_ACT_IRES(act_replace_footprint(op, olds, news, fpname, dumb)); free(fpname); return 0; }