Index: write.c =================================================================== --- write.c (revision 14542) +++ write.c (revision 14543) @@ -486,113 +486,6 @@ return 0; } -/* writes element data in autotrax format for use in a layout .PCB file */ -static int wrax_layout_elements(wctx_t *ctx, pcb_board_t *Layout, pcb_data_t *Data) -{ - - gdl_iterator_t eit; - pcb_line_t *line; - pcb_arc_t *arc; - pcb_coord_t xPos, yPos, yPos2, yPos3, text_offset; - - pcb_element_t *element; - - int silk_layer = 7; /* hard coded default, 7 is bottom silk */ - int copper_layer = 1; /* hard coded default, 1 is bottom copper */ - int pad_shape = 1; /* 1=circle, 2=Rectangle, 3=Octagonal, 4=Rounded Rectangle, - 5=Cross Hair Target, 6=Moiro Target */ - int drill_hole = 0; /* for SMD */ - - pcb_box_t *box; - - text_offset = PCB_MIL_TO_COORD(400); /* this gives good placement of refdes relative to element */ - - elementlist_foreach(&Data->Element, &eit, element) { - gdl_iterator_t it; - pcb_pin_t *pin; - pcb_pad_t *pad; - - /* only non empty elements */ - if (!linelist_length(&element->Line) && !pinlist_length(&element->Pin) && !arclist_length(&element->Arc) && !padlist_length(&element->Pad)) - continue; - - box = &element->BoundingBox; - xPos = (box->X1 + box->X2) / 2; - yPos = PCB->MaxHeight - (box->Y1 - text_offset); - yPos2 = yPos - PCB_MIL_TO_COORD(200); - yPos3 = yPos2 - PCB_MIL_TO_COORD(200); - - if (PCB_FLAG_TEST(PCB_FLAG_ONSOLDER, element)) { - silk_layer = 8; - copper_layer = 6; - } - else { - silk_layer = 7; - copper_layer = 1; - } - - fprintf(ctx->f, "COMP\r\n%s\r\n", element->Name[PCB_ELEMNAME_IDX_REFDES].TextString); /* designator */ - fprintf(ctx->f, "%s\r\n", element->Name[PCB_ELEMNAME_IDX_DESCRIPTION].TextString); /* designator */ - fprintf(ctx->f, "%s\r\n", element->Name[PCB_ELEMNAME_IDX_VALUE].TextString); /* designator */ - pcb_fprintf(ctx->f, "%.0ml %.0ml 100 0 10 %d\r\n", /* designator */ - xPos, yPos, silk_layer); - pcb_fprintf(ctx->f, "%.0ml %.0ml 100 0 10 %d\r\n", /* pattern */ - xPos, yPos2, silk_layer); - pcb_fprintf(ctx->f, "%.0ml %.0ml 100 0 10 %d\r\n", /* comment field */ - xPos, yPos3, silk_layer); - - pinlist_foreach(&element->Pin, &it, pin) { - if (PCB_FLAG_TEST(PCB_FLAG_SQUARE, pin)) - pad_shape = 2; - else if (PCB_FLAG_TEST(PCB_FLAG_OCTAGON, pin)) - pad_shape = 3; - else - pad_shape = 1; /* circular */ - - pcb_fprintf(ctx->f, "CP\r\n%.0ml %.0ml %.0ml %.0ml %d %.0ml 1 %d\r\n%s\r\n", pin->X, PCB->MaxHeight - (pin->Y), pin->Thickness, pin->Thickness, pad_shape, pin->DrillingHole, copper_layer, (char *)PCB_EMPTY(pin->Number)); /* or ->Name? */ - } - - padlist_foreach(&element->Pad, &it, pad) { - pad_shape = 2; /* rectangular */ - - pcb_fprintf(ctx->f, "CP\r\n%.0ml %.0ml ", /* positions of pad */ - (pad->Point1.X + pad->Point2.X) / 2, PCB->MaxHeight - ((pad->Point1.Y + pad->Point2.Y) / 2)); - - if ((pad->Point1.X - pad->Point2.X) <= 0 && (pad->Point1.Y - pad->Point2.Y) <= 0) { - pcb_fprintf(ctx->f, "%.0ml %.0ml ", pad->Point2.X - pad->Point1.X + pad->Thickness, /* width */ - (pad->Point2.Y - pad->Point1.Y + pad->Thickness)); /* height */ - } - else if ((pad->Point1.X - pad->Point2.X) <= 0 && (pad->Point1.Y - pad->Point2.Y) > 0) { - pcb_fprintf(ctx->f, "%.0ml %.0ml ", pad->Point2.X - pad->Point1.X + pad->Thickness, /* width */ - (pad->Point1.Y - pad->Point2.Y + pad->Thickness)); /* height */ - } - else if ((pad->Point1.X - pad->Point2.X) > 0 && (pad->Point1.Y - pad->Point2.Y) > 0) { - pcb_fprintf(ctx->f, "%.0ml %.0ml ", pad->Point1.X - pad->Point2.X + pad->Thickness, /* width */ - (pad->Point1.Y - pad->Point2.Y + pad->Thickness)); /* height */ - } - else if ((pad->Point1.X - pad->Point2.X) > 0 && (pad->Point1.Y - pad->Point2.Y) <= 0) { - pcb_fprintf(ctx->f, "%.0ml %.0ml ", pad->Point1.X - pad->Point2.X + pad->Thickness, /* width */ - (pad->Point2.Y - pad->Point1.Y + pad->Thickness)); /* height */ - } - - pcb_fprintf(ctx->f, "%d %d 1 %d\r\n%s\r\n", pad_shape, drill_hole, copper_layer, (char *)PCB_EMPTY(pad->Number)); /*or Name? */ - - } - linelist_foreach(&element->Line, &it, line) { /* autotrax supports tracks in COMPs */ - pcb_fprintf(ctx->f, "CT\r\n"); - wrax_line(ctx, line, silk_layer, 0, 0); - } - - arclist_foreach(&element->Arc, &it, arc) { - pcb_fprintf(ctx->f, "CA\r\n"); - wrax_arc(ctx, arc, silk_layer, 0, 0); - } - - fprintf(ctx->f, "ENDCOMP\r\n"); - } - return 0; -} - static const char *or_empty(const char *s) { if (s == NULL) return ""; @@ -755,7 +648,6 @@ wrax_polygons(ctx, alid, ly, dx, dy, in_subc); } - wrax_layout_elements(ctx, ctx->pcb, data); wrax_subcs(ctx, data); wrax_vias(ctx, data, dx, dy, in_subc); return 0;