Index: trunk/src/obj_subc.c =================================================================== --- trunk/src/obj_subc.c (revision 13975) +++ trunk/src/obj_subc.c (revision 13976) @@ -287,6 +287,29 @@ return mask; } +void pcb_subc_create_aux(pcb_subc_t *sc, pcb_coord_t ox, pcb_coord_t oy, double rot) +{ + double unit = PCB_MM_TO_COORD(1); + pcb_layer_t *aux = pcb_layer_new_bound(sc->data, PCB_LYT_VIRTUAL | PCB_LYT_NOEXPORT | PCB_LYT_MISC | PCB_LYT_TOP, SUBC_AUX_NAME); + double cs, sn; + + if (rot == 0.0) { + cs = 1; + cs = 1; + } + else { + cs = cos(rot); + sn = sin(rot); + } + + add_aux_line(aux, "subc-role", "origin", ox, oy, ox, oy); + add_aux_line(aux, "subc-role", "x", ox, oy, pcb_round((double)ox + cs*unit), pcb_round(oy + sn*unit)); + add_aux_line(aux, "subc-role", "y", ox, oy, pcb_round((double)ox + sn*unit), pcb_round(oy + cs*unit)); +} + + + + int pcb_subc_convert_from_buffer(pcb_buffer_t *buffer) { pcb_subc_t *sc; @@ -509,16 +532,8 @@ vtp0_uninit(&mask_pads); vtp0_uninit(&paste_pads); - /* create aux layer */ - { - pcb_coord_t unit = PCB_MM_TO_COORD(1); - pcb_layer_t *aux = pcb_layer_new_bound(sc->data, PCB_LYT_VIRTUAL | PCB_LYT_NOEXPORT | PCB_LYT_MISC | PCB_LYT_TOP, SUBC_AUX_NAME); + pcb_subc_create_aux(sc, buffer->X, buffer->Y, 0.0); - add_aux_line(aux, "subc-role", "origin", buffer->X, buffer->Y, buffer->X, buffer->Y); - add_aux_line(aux, "subc-role", "x", buffer->X, buffer->Y, buffer->X+unit, buffer->Y); - add_aux_line(aux, "subc-role", "y", buffer->X, buffer->Y, buffer->X, buffer->Y+unit); - } - /* Add refdes */ pcb_attribute_put(&sc->Attributes, "refdes", "U0"); if (!has_refdes_text) { Index: trunk/src/obj_subc.h =================================================================== --- trunk/src/obj_subc.h (revision 13975) +++ trunk/src/obj_subc.h (revision 13976) @@ -106,6 +106,11 @@ layer that matches brd_layer or brd_layer if not found. */ pcb_layer_t *pcb_loose_subc_layer(pcb_board_t *pcb, pcb_layer_t *brd_layer); +/*** subc creation helpers ***/ + +/* Create the aux layer for a subc, set origin to ox;oy and rotation to rot */ +void pcb_subc_create_aux(pcb_subc_t *sc, pcb_coord_t ox, pcb_coord_t oy, double rot); + /*** loops ***/ #define PCB_SUBC_LOOP(top) do { \