00001
00026 #include "register_functions.c"
00027 #include "con_dil.h"
00028
00029
00036 int
00037 con_dil_create_element ()
00038 {
00039 gdouble xmax;
00040 gdouble xmin;
00041 gdouble ymax;
00042 gdouble ymin;
00043 gdouble x_text;
00044 gdouble y_text;
00045 gdouble dx;
00046 gint i;
00047 gint pin_number;
00048 gchar *pin_pad_name = g_strdup ("");
00049 FlagType pad_flag;
00050 ElementTypePtr element;
00051
00052 if (!element)
00053 {
00054 if (verbose)
00055 g_log ("", G_LOG_LEVEL_WARNING,
00056 (_("[%s] could not create a valid element pointer for an element.")),
00057 footprint_type);
00058 return (EXIT_FAILURE);
00059 }
00060
00061
00062 element->MarkX = 0;
00063 element->MarkY = 0;
00064
00065
00066
00067
00068
00069 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00070 {
00071 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00072 }
00073 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00074 {
00075 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00076 }
00077 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00078 {
00079 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00080 }
00081 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00082 {
00083 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00084 }
00085
00086 if (multiplier * (-courtyard_length / 2.0) < xmin)
00087 {
00088 xmin = multiplier * (-courtyard_length / 2.0);
00089 }
00090 if (multiplier * (courtyard_length / 2.0) > xmax)
00091 {
00092 xmax = multiplier * (courtyard_length / 2.0);
00093 }
00094 if (multiplier * (-courtyard_width / 2.0) < ymin)
00095 {
00096 ymin = multiplier * (-courtyard_width / 2.0);
00097 }
00098 if (multiplier * (courtyard_width / 2.0) > ymax)
00099 {
00100 ymax = multiplier * (courtyard_width / 2.0);
00101 }
00102
00103 element->Name[1].Scale = 100;
00104 element->Name[1].X = 0.0 ;
00105 element->Name[1].Y = (ymin - 10000.0);
00106 element->Name[1].TextString = footprint_name;
00107 element->Name[1].Element = element;
00108 element->Name[1].Direction = EAST;
00109 element->Name[1].ID = ID++;
00110
00111 element->Name[2].Scale = 100;
00112 element->Name[2].X = 0.0 ;
00113 element->Name[2].Y = (ymin - 10000.0);
00114 element->Name[2].TextString = footprint_refdes;
00115 element->Name[2].Element = element;
00116 element->Name[2].Direction = EAST;
00117 element->Name[2].ID = ID++;
00118
00119 element->Name[3].Scale = 100;
00120 element->Name[3].X = 0.0 ;
00121 element->Name[3].Y = (ymin - 10000.0);
00122 element->Name[3].TextString = footprint_value;
00123 element->Name[3].Element = element;
00124 element->Name[3].Direction = EAST;
00125 element->Name[3].ID = ID++;
00126
00127 for (i = 0; (i < number_of_columns); i++)
00128 {
00129 pin_number = 1 + i;
00130 if (pad_shapes_type == SQUARE)
00131 {
00132 pad_flag.f = SQUARE;
00133 }
00134 else if (pin1_square && (pin_number == 1))
00135 {
00136 pad_flag.f = SQUARE;
00137 }
00138 else
00139 {
00140 pad_flag.f = CLEAR;
00141 }
00142 create_new_pin
00143 (
00144 element,
00145 (int) (multiplier * ((((-number_of_columns - 1) / 2.0) +1 + i) * pitch_x)),
00146 (int) (multiplier * (pitch_y / 2.0)),
00147 (int) (multiplier * pad_diameter),
00148 (int) (multiplier * pad_clearance),
00149 (int) (multiplier * (pad_diameter + pad_solder_mask_clearance)),
00150 (int) (multiplier * pin_drill_diameter),
00151 pin_pad_name,
00152 g_strdup_printf ("%d", pin_number),
00153 pad_flag
00154 );
00155 if (!strcmp (pad_shape, "rounded pad, elongated"))
00156 {
00157 pad_flag.f = ONSOLDER;
00158 create_new_pad
00159 (
00160 element,
00161 (int) (multiplier * ((((-number_of_columns - 1) / 2.0) + 1 + i) * pitch_x)),
00162 (int) (multiplier * ((pitch_y + pad_length - pad_width) / 2.0)),
00163 (int) (multiplier * ((((-number_of_columns - 1) / 2.0) + 1 + i) * pitch_x)),
00164 (int) (multiplier * ((pitch_y - pad_length + pad_width) / 2.0)),
00165 (int) (multiplier * pad_length),
00166 (int) (multiplier * pad_clearance),
00167 (int) (multiplier * (pad_width + (2 * pad_solder_mask_clearance))),
00168 "",
00169 g_strdup_printf ("%d", pin_number),
00170 pad_flag
00171 );
00172 }
00173 pad_flag.f = CLEAR;
00174 if (pad_shapes_type == SQUARE)
00175 {
00176 pad_flag.f = SQUARE;
00177 }
00178 else
00179 {
00180 pad_flag.f = CLEAR;
00181 }
00182 pin_number = number_of_columns + 1 + i;
00183 create_new_pin
00184 (
00185 element,
00186 (int) (multiplier * ((((-number_of_columns - 1) / 2.0) + 1 + i) * pitch_x)),
00187 (int) (multiplier * (-pitch_y / 2.0)),
00188 (int) (multiplier * pad_diameter),
00189 (int) (multiplier * pad_clearance),
00190 (int) (multiplier * (pad_diameter + pad_solder_mask_clearance)),
00191 (int) (multiplier * pin_drill_diameter),
00192 pin_pad_name,
00193 g_strdup_printf ("%d", pin_number),
00194 pad_flag
00195 );
00196 if (!strcmp (pad_shape, "rounded pad, elongated"))
00197 {
00198 pad_flag.f = ONSOLDER;
00199 create_new_pad
00200 (
00201 element,
00202 (int) (multiplier * ((((-number_of_columns - 1) / 2.0) + 1 + i) * pitch_x)),
00203 (int) (multiplier * ((-pitch_y - pad_length + pad_width) / 2.0)),
00204 (int) (multiplier * ((((-number_of_columns - 1) / 2.0) + 1 + i) * pitch_x)),
00205 (int) (multiplier * ((-pitch_y + pad_length - pad_width) / 2.0)),
00206 (int) (multiplier * pad_length),
00207 (int) (multiplier * pad_clearance),
00208 (int) (multiplier * (pad_width + (2 * pad_solder_mask_clearance))),
00209 "",
00210 g_strdup_printf ("%d", pin_number),
00211 pad_flag
00212 );
00213 }
00214 pad_flag.f = CLEAR;
00215 }
00216
00217 if (silkscreen_package_outline)
00218 {
00219 create_new_line
00220 (
00221 element,
00222 (int) (multiplier * (((-pitch_x + pad_diameter + silkscreen_line_width) / 2) + pad_solder_mask_clearance)),
00223 (int) ymin,
00224 (int) (multiplier * (((-pitch_x + pad_diameter + silkscreen_line_width) / 2) + pad_solder_mask_clearance)),
00225 (int) ymax,
00226 (int) (multiplier * silkscreen_line_width)
00227 );
00228 create_new_line
00229 (
00230 element,
00231 (int) (multiplier * (((-pitch_x + pad_diameter + silkscreen_line_width) / 2) + pad_solder_mask_clearance)),
00232 (int) ymax,
00233 (int) (multiplier * (((pitch_x - pad_diameter - silkscreen_line_width) / 2) - pad_solder_mask_clearance)),
00234 (int) ymax,
00235 (int) (multiplier * silkscreen_line_width)
00236 );
00237 create_new_line
00238 (
00239 element,
00240 (int) (multiplier * (((pitch_x - pad_diameter - silkscreen_line_width) / 2) - pad_solder_mask_clearance)),
00241 (int) ymax,
00242 (int) (multiplier * (((pitch_x - pad_diameter - silkscreen_line_width) / 2) - pad_solder_mask_clearance)),
00243 (int) ymin,
00244 (int) (multiplier * silkscreen_line_width)
00245 );
00246 create_new_line
00247 (
00248 element,
00249 (int) (multiplier * (((-pitch_x + pad_diameter + silkscreen_line_width) / 2) + pad_solder_mask_clearance)),
00250 (int) ymin,
00251 (int) (multiplier * (((pitch_x - pad_diameter - silkscreen_line_width) / 2) - pad_solder_mask_clearance)),
00252 (int) ymin,
00253 (int) (multiplier * silkscreen_line_width)
00254 );
00255 }
00256
00257 if (silkscreen_indicate_1)
00258 {
00259 create_new_arc
00260 (
00261 element,
00262 (int) (xmin - (multiplier * (pad_solder_mask_clearance + pad_clearance))),
00263 (int) (ymax + (multiplier * (pad_solder_mask_clearance + pad_clearance))),
00264 (int) (multiplier * 0.5 * silkscreen_line_width),
00265 (int) (multiplier * 0.5 * silkscreen_line_width),
00266 0,
00267 360,
00268 (int) (multiplier * silkscreen_line_width)
00269 );
00270 }
00271
00272 if (courtyard)
00273 {
00274 create_new_line
00275 (
00276 element,
00277 (int) (xmin),
00278 (int) (ymin),
00279 (int) (xmin),
00280 (int) (ymax),
00281 (int) (multiplier * courtyard_line_width)
00282 );
00283 create_new_line
00284 (
00285 element,
00286 (int) (xmax),
00287 (int) (ymin),
00288 (int) (xmax),
00289 (int) (ymax),
00290 (int) (multiplier * courtyard_line_width)
00291 );
00292 create_new_line
00293 (
00294 element,
00295 (int) (xmin),
00296 (int) (ymin),
00297 (int) (xmax),
00298 (int) (ymin),
00299 (int) (multiplier * courtyard_line_width)
00300 );
00301 create_new_line
00302 (
00303 element,
00304 (int) (xmax),
00305 (int) (ymax),
00306 (int) (xmin),
00307 (int) (ymax),
00308 (int) (multiplier * courtyard_line_width)
00309 );
00310 }
00311
00312 if (attributes_in_footprint)
00313 {
00314 element = create_attributes_in_element (element);
00315 }
00316
00317 if (verbose)
00318 {
00319 g_log ("", G_LOG_LEVEL_INFO,
00320 (_("[%s] created an element for element: %s.")),
00321 footprint_type,
00322 footprint_filename);
00323 }
00324 current_element = (ElementTypePtr) &element;
00325 return (EXIT_SUCCESS);
00326 }
00327
00328
00338 int
00339 con_dil_create_packages_list ()
00340 {
00341 g_list_free (packages_list);
00342 packages_list = g_list_append (packages_list, "CON-DIL");
00343 return (EXIT_SUCCESS);
00344 }
00345
00346
00379 int
00380 con_dil_drc ()
00381 {
00382 int result = EXIT_SUCCESS;
00383 if (verbose)
00384 {
00385 g_log ("", G_LOG_LEVEL_INFO,
00386 (_("[%s] DRC Check: checking package %s.")),
00387 footprint_type, footprint_name);
00388 }
00389
00390 if (!(number_of_pins % 2))
00391 {
00392 if (verbose)
00393 {
00394 g_log ("", G_LOG_LEVEL_WARNING,
00395 (_("[%s] DRC Error: check for number of pins is even.")),
00396 footprint_type);
00397 }
00398 result = EXIT_FAILURE;
00399 }
00400
00401 if (number_of_rows != 2)
00402 {
00403 if (verbose)
00404 {
00405 g_log ("", G_LOG_LEVEL_WARNING,
00406 (_("[%s] DRC Error: check for number of rows = 2.")),
00407 footprint_type);
00408 }
00409 result = EXIT_FAILURE;
00410 }
00411
00412 if (number_of_columns < 1)
00413 {
00414 if (verbose)
00415 {
00416 g_log ("", G_LOG_LEVEL_WARNING,
00417 (_("[%s] DRC Error: check for number of columns < 1.")),
00418 footprint_type);
00419 }
00420 result = EXIT_FAILURE;
00421 }
00422
00423 switch (pad_shapes_type)
00424 {
00425 case NO_SHAPE:
00426 {
00427 if (verbose)
00428 {
00429 g_log ("", G_LOG_LEVEL_WARNING,
00430 (_("[%s] DRC Error: NO_SHAPE specified for check for allowed pad shapes.")),
00431 footprint_type);
00432 }
00433 result = EXIT_FAILURE;
00434 break;
00435 }
00436 case ROUND:
00437 {
00438 break;
00439 }
00440 case SQUARE:
00441 {
00442 break;
00443 }
00444 case OCTAGONAL:
00445 {
00446 if (verbose)
00447 {
00448 g_log ("", G_LOG_LEVEL_WARNING,
00449 (_("[%s] DRC Error: octagonal pad shape specified for check for allowed pad shapes.")),
00450 footprint_type);
00451 }
00452 result = EXIT_FAILURE;
00453 break;
00454 }
00455 case ROUND_ELONGATED:
00456 {
00457 if (verbose)
00458 {
00459 g_log ("", G_LOG_LEVEL_WARNING,
00460 (_("[%s] DRC Error: round elongated pad shape specified for check for allowed pad shapes.")),
00461 footprint_type);
00462 }
00463 result = EXIT_FAILURE;
00464 break;
00465 }
00466 default:
00467 {
00468 if (verbose)
00469 {
00470 g_log ("", G_LOG_LEVEL_WARNING,
00471 (_("[%s] DRC Error: no valid pad shape type specified.")),
00472 footprint_type);
00473 }
00474 result = EXIT_FAILURE;
00475 break;
00476 }
00477 }
00478
00479 if (package_body_length <= 0.0)
00480 {
00481 if (verbose)
00482 {
00483 g_log ("", G_LOG_LEVEL_WARNING,
00484 (_("[%s] DRC Error: specified package body length is too small.")),
00485 footprint_type);
00486 }
00487 result = EXIT_FAILURE;
00488 }
00489 if (package_body_width <= 0.0)
00490 {
00491 if (verbose)
00492 {
00493 g_log ("", G_LOG_LEVEL_WARNING,
00494 (_("[%s] DRC Error: specified package body width is too small.")),
00495 footprint_type);
00496 }
00497 result = EXIT_FAILURE;
00498 }
00499 if (package_body_height <= 0.0)
00500 {
00501 if (verbose)
00502 {
00503 g_log ("", G_LOG_LEVEL_WARNING,
00504 (_("[%s] DRC Error: specified package body height is too small.")),
00505 footprint_type);
00506 }
00507 result = EXIT_FAILURE;
00508 }
00509
00510 if (courtyard_length <= 0.0)
00511 {
00512 if (verbose)
00513 {
00514 g_log ("", G_LOG_LEVEL_WARNING,
00515 (_("[%s] DRC Error: specified courtyard length is too small.")),
00516 footprint_type);
00517 }
00518 result = EXIT_FAILURE;
00519 }
00520 if (courtyard_width <= 0.0)
00521 {
00522 if (verbose)
00523 {
00524 g_log ("", G_LOG_LEVEL_WARNING,
00525 (_("[%s] DRC Error: specified courtyard width is too small.")),
00526 footprint_type);
00527 }
00528 return (EXIT_FAILURE);
00529 }
00530
00531 if (pitch_x - pad_diameter < pad_clearance)
00532 {
00533 if (verbose)
00534 {
00535 g_log ("", G_LOG_LEVEL_WARNING,
00536 (_("[%s] DRC Error: minimum clearance between copper (X-direction) is too small.")),
00537 footprint_type);
00538 }
00539 result = EXIT_FAILURE;
00540 }
00541 if (pitch_x - pad_length < pad_clearance)
00542 {
00543 if (verbose)
00544 {
00545 g_log ("", G_LOG_LEVEL_WARNING,
00546 (_("[%s] DRC Error: minimum clearance between copper (X-direction) is too small.")),
00547 footprint_type);
00548 }
00549 result = EXIT_FAILURE;
00550 }
00551
00552 if (pitch_y - pad_diameter < pad_clearance)
00553 {
00554 if (verbose)
00555 {
00556 g_log ("", G_LOG_LEVEL_WARNING,
00557 (_("[%s] DRC Error: minimum clearance between copper (Y-direction) is too small.")),
00558 footprint_type);
00559 }
00560 result = EXIT_FAILURE;
00561 }
00562 if (pitch_y - pad_width < pad_clearance)
00563 {
00564 if (verbose)
00565 {
00566 g_log ("", G_LOG_LEVEL_WARNING,
00567 (_("[%s] DRC Error: minimum clearance between copper (Y-direction) is too small.")),
00568 footprint_type);
00569 }
00570 result = EXIT_FAILURE;
00571 }
00572
00573 if (fiducial)
00574 {
00575 if (verbose)
00576 {
00577 g_log ("", G_LOG_LEVEL_WARNING,
00578 (_("[%s] DRC Error: package should not have a fiducial pad.")),
00579 footprint_type);
00580 }
00581 result = EXIT_FAILURE;
00582 }
00583
00584
00585 if (package_body_length - courtyard_length < courtyard_clearance_with_package)
00586 {
00587 if (verbose)
00588 {
00589 g_log ("", G_LOG_LEVEL_WARNING,
00590 (_("[%s] DRC Error: check for clearance of the package length with regard to the courtyard dimensions.")),
00591 footprint_type);
00592 }
00593 result = EXIT_FAILURE;
00594 }
00595
00596
00597 if (package_body_width - courtyard_width < courtyard_clearance_with_package)
00598 {
00599 if (verbose)
00600 {
00601 g_log ("", G_LOG_LEVEL_WARNING,
00602 (_("[%s] DRC Error: check for clearance of the package width with regard to the courtyard dimensions.")),
00603 footprint_type);
00604 }
00605 result = EXIT_FAILURE;
00606 }
00612
00613 if (silkscreen_package_outline && (silkscreen_line_width == 0.0))
00614 {
00615 if (verbose)
00616 {
00617 g_log ("", G_LOG_LEVEL_WARNING,
00618 (_("[%s] DRC Error: silkscreen line width is too small.")),
00619 footprint_type);
00620 }
00621 result = EXIT_FAILURE;
00622 }
00623 switch (units_type)
00624 {
00625 case NO_UNITS:
00626 {
00627 if (verbose)
00628 {
00629 g_log ("", G_LOG_LEVEL_WARNING,
00630 (_("[%s] DRC Error: no units specified.")),
00631 footprint_type);
00632 }
00633 result = EXIT_FAILURE;
00634 break;
00635 }
00636 case MIL:
00637 if (silkscreen_package_outline && (silkscreen_line_width > 40.0))
00638 {
00639 if (verbose)
00640 {
00641 g_log ("", G_LOG_LEVEL_WARNING,
00642 (_("[%s] DRC Error: silkscreen line width too wide.")),
00643 footprint_type);
00644 }
00645 result = EXIT_FAILURE;
00646 break;
00647 }
00648 case MIL_100:
00649 if (silkscreen_package_outline && (silkscreen_line_width > 4000.0))
00650 {
00651 if (verbose)
00652 {
00653 g_log ("", G_LOG_LEVEL_WARNING,
00654 (_("[%s] DRC Error: silkscreen line width too wide.")),
00655 footprint_type);
00656 }
00657 result = EXIT_FAILURE;
00658 break;
00659 }
00660 case MM:
00661 if (silkscreen_package_outline && (silkscreen_line_width > 1.0))
00662 {
00663 if (verbose)
00664 {
00665 g_log ("", G_LOG_LEVEL_WARNING,
00666 (_("[%s] DRC Error: silkscreen line width too wide.")),
00667 footprint_type);
00668 }
00669 result = EXIT_FAILURE;
00670 break;
00671 }
00672 default:
00673 {
00674 if (verbose)
00675 {
00676 g_log ("", G_LOG_LEVEL_WARNING,
00677 (_("[%s] DRC Error: no valid units type specified.")),
00678 footprint_type);
00679 }
00680 result = EXIT_FAILURE;
00681 break;
00682 }
00683 }
00684
00685 if (verbose && (result == EXIT_SUCCESS))
00686 {
00687 g_log ("", G_LOG_LEVEL_INFO,
00688 (_("[%s] DRC Check: no errors while checking package %s.")),
00689 footprint_type, footprint_name);
00690 }
00691 return (result);
00692 }
00693
00694
00707 int
00708 con_dil_get_default_footprint_values ()
00709 {
00710 if (!strcmp (footprint_name, "?CON_DIL"))
00711 {
00712 footprint_units = g_strdup ("mil");
00713 number_of_pins = 4;
00714 package_body_width = 300;
00715 package_body_length = 100;
00716 package_body_height = 200;
00717 package_is_radial = FALSE;
00718 number_of_columns = 2;
00719 number_of_rows = 0;
00720 pitch_x = 100;
00721 pitch_y = 100;
00722 count_x = 0;
00723 count_y = 2;
00724 pad_shape = g_strdup ("circular pad");
00725 pin_drill_diameter = 28;
00726 pad_diameter = 60;
00727 pad_clearance = 15;
00728 pad_solder_mask_clearance = 6;
00729 g_free (footprint_name);
00730 footprint_name = g_strdup ("CON_DIL");
00731 return (EXIT_SUCCESS);
00732 }
00733 else
00734 {
00735 if (verbose)
00736 {
00737 g_log ("", G_LOG_LEVEL_WARNING,
00738 _("default values for footprint %s not found.\n"),
00739 footprint_name);
00740 }
00741 return (EXIT_FAILURE);
00742 }
00743 }
00744
00745
00753 #if GUI
00754 int
00755 con_dil_set_gui_constraints ()
00756 {
00757
00758 GtkWidget *package_is_radial_checkbutton = lookup_widget (GTK_WIDGET (widget),
00759 "package_is_radial_checkbutton");
00760 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (package_is_radial_checkbutton), FALSE);
00761 gtk_widget_set_sensitive (package_is_radial_checkbutton, FALSE);
00762
00763
00764 GtkWidget *number_of_columns_entry = lookup_widget (GTK_WIDGET (widget),
00765 "number_of_columns_entry");
00766 gtk_entry_set_text (GTK_ENTRY (number_of_columns_entry), "2");
00767 gtk_widget_set_sensitive (number_of_columns_entry, FALSE);
00768 GtkWidget *number_of_rows_entry = lookup_widget (GTK_WIDGET (widget),
00769 "number_of_rows_entry");
00770 gtk_entry_set_text (GTK_ENTRY (number_of_rows_entry), "");
00771 gtk_widget_set_sensitive (number_of_rows_entry, TRUE);
00772 GtkWidget *count_x_entry = lookup_widget (GTK_WIDGET (widget),
00773 "count_x_entry");
00774 gtk_entry_set_text (GTK_ENTRY (count_x_entry), "");
00775 gtk_widget_set_sensitive (count_x_entry, FALSE);
00776 GtkWidget *count_y_entry = lookup_widget (GTK_WIDGET (widget),
00777 "count_y_entry");
00778 gtk_entry_set_text (GTK_ENTRY (count_y_entry), "");
00779 gtk_widget_set_sensitive (count_y_entry, FALSE);
00780 GtkWidget *number_1_position_entry = lookup_widget (GTK_WIDGET (widget),
00781 "number_1_position_entry");
00782 gtk_combo_box_set_active (GTK_COMBO_BOX (number_1_position_entry), 3);
00783 gtk_widget_set_sensitive (number_1_position_entry, FALSE);
00784
00785
00786 gui_constraints_disable_thermal_tab_widgets (widget);
00787
00788
00789 gui_constraints_disable_heel_and_toe_goals_tab_widgets (widget);
00790 return (EXIT_SUCCESS);
00791 }
00792 #endif
00793
00794
00805 int
00806 con_dil_write_footprint ()
00807 {
00808 gdouble xmax;
00809 gdouble xmin;
00810 gdouble ymax;
00811 gdouble ymin;
00812 gdouble x_text;
00813 gdouble y_text;
00814 gint pin_number;
00815 gchar *pin_pad_name = g_strdup ("");
00816 gchar *pin_pad_flags = g_strdup ("");
00817 gint i;
00818
00819
00820 fp = fopen (footprint_filename, "w");
00821 if (!fp)
00822 {
00823 g_log ("", G_LOG_LEVEL_WARNING,
00824 (_("could not open file for %s footprint: %s.")),
00825 footprint_type, footprint_filename);
00826 fclose (fp);
00827 return (EXIT_FAILURE);
00828 }
00829
00830 if (license_in_footprint)
00831 {
00832 write_license ();
00833 }
00834
00835
00836 xmin = multiplier *
00837 (
00838 (((-number_of_columns + 1) / 2.0) * pitch_x) -
00839 (((pad_diameter > pad_length) ? pad_diameter : pad_length) / 2.0) -
00840 pad_solder_mask_clearance
00841 );
00842 xmax = multiplier *
00843 (
00844 (((number_of_columns - 1) / 2.0) * pitch_x) +
00845 (((pad_diameter > pad_length) ? pad_diameter : pad_length) / 2.0) +
00846 pad_solder_mask_clearance
00847 );
00848 ymin = multiplier *
00849 (
00850 (-pitch_y / 2.0) -
00851 (((pad_diameter > pad_width) ? pad_diameter : pad_width) / 2.0) -
00852 pad_solder_mask_clearance
00853 );
00854 ymax = multiplier *
00855 (
00856 (pitch_y / 2.0) +
00857 (((pad_diameter > pad_width) ? pad_diameter : pad_width) / 2.0) +
00858 pad_solder_mask_clearance
00859 );
00860
00861
00862 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00863 {
00864 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00865 }
00866 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00867 {
00868 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00869 }
00870 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00871 {
00872 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00873 }
00874 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00875 {
00876 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00877 }
00878
00879 if (multiplier * (-courtyard_length / 2.0) < xmin)
00880 {
00881 xmin = multiplier * (-courtyard_length / 2.0);
00882 }
00883 if (multiplier * (courtyard_length / 2.0) > xmax)
00884 {
00885 xmax = multiplier * (courtyard_length / 2.0);
00886 }
00887 if (multiplier * (-courtyard_width / 2.0) < ymin)
00888 {
00889 ymin = multiplier * (-courtyard_width / 2.0);
00890 }
00891 if (multiplier * (courtyard_width / 2.0) > ymax)
00892 {
00893 ymax = multiplier * (courtyard_width / 2.0);
00894 }
00895
00896
00897 x_text = 0.0 ;
00898 y_text = (ymin - 10000.0);
00899 write_element_header (x_text, y_text);
00900
00901 for (i = 0; (i < number_of_columns); i++)
00902 {
00903 pin_number = 1 + i;
00904 if (pin1_square && (pin_number == 1))
00905 pin_pad_flags = g_strdup ("square");
00906 else
00907 pin_pad_flags = g_strdup ("");
00908 write_pin
00909 (
00910 pin_number,
00911 pin_pad_name,
00912 multiplier * ((((-number_of_columns - 1) / 2.0) +1 + i) * pitch_x),
00913 multiplier * (pitch_y / 2.0),
00914 multiplier * pad_diameter,
00915 multiplier * pad_clearance,
00916 multiplier * (pad_diameter + pad_solder_mask_clearance),
00917 multiplier * pin_drill_diameter,
00918 pin_pad_flags
00919 );
00920 if (!strcmp (pad_shape, "rounded pad, elongated"))
00921 {
00922 if (!strcmp (pin_pad_flags, ""))
00923 pin_pad_flags = g_strconcat (pin_pad_flags, "onsolder", NULL);
00924 else
00925 pin_pad_flags = g_strconcat (pin_pad_flags, ",onsolder", NULL);
00926 write_pad
00927 (
00928 pin_number,
00929 pin_pad_name,
00930 multiplier * ((((-number_of_columns - 1) / 2.0) + 1 + i) * pitch_x),
00931 multiplier * ((pitch_y + pad_length - pad_width) / 2.0),
00932 multiplier * ((((-number_of_columns - 1) / 2.0) + 1 + i) * pitch_x),
00933 multiplier * ((pitch_y - pad_length + pad_width) / 2.0),
00934 multiplier * pad_length,
00935 multiplier * pad_clearance,
00936 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00937 pin_pad_flags
00938 );
00939 }
00940 pin_number = number_of_columns + 1 + i;
00941 if (pin1_square && (pin_number == 1))
00942 pin_pad_flags = g_strdup ("square");
00943 else
00944 pin_pad_flags = g_strdup ("");
00945 write_pin
00946 (
00947 pin_number,
00948 pin_pad_name,
00949 multiplier * ((((-number_of_columns - 1) / 2.0) + 1 + i) * pitch_x),
00950 multiplier * (-pitch_y / 2.0),
00951 multiplier * pad_diameter,
00952 multiplier * pad_clearance,
00953 multiplier * (pad_diameter + pad_solder_mask_clearance),
00954 multiplier * pin_drill_diameter,
00955 pin_pad_flags
00956 );
00957 if (!strcmp (pad_shape, "rounded pad, elongated"))
00958 {
00959 if (!strcmp (pin_pad_flags, ""))
00960 pin_pad_flags = g_strconcat (pin_pad_flags, "onsolder", NULL);
00961 else
00962 pin_pad_flags = g_strconcat (pin_pad_flags, ",onsolder", NULL);
00963 write_pad
00964 (
00965 pin_number,
00966 pin_pad_name,
00967 multiplier * ((((-number_of_columns - 1) / 2.0) + 1 + i) * pitch_x),
00968 multiplier * ((-pitch_y - pad_length + pad_width) / 2.0),
00969 multiplier * ((((-number_of_columns - 1) / 2.0) + 1 + i) * pitch_x),
00970 multiplier * ((-pitch_y + pad_length - pad_width) / 2.0),
00971 multiplier * pad_length,
00972 multiplier * pad_clearance,
00973 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00974 pin_pad_flags
00975 );
00976 }
00977 }
00978
00979 if (silkscreen_package_outline)
00980 {
00981 fprintf (fp, (_("# Write a package body on the silkscreen\n")));
00982 write_rectangle
00983 (
00984 multiplier * ((-package_body_length - silkscreen_line_width) / 2.0) ,
00985 multiplier * ((-package_body_width - silkscreen_line_width) / 2.0) ,
00986 multiplier * ((package_body_length + silkscreen_line_width) / 2.0) ,
00987 multiplier * ((package_body_width + silkscreen_line_width) / 2.0) ,
00988 multiplier * silkscreen_line_width
00989 );
00990 }
00991
00992 if (silkscreen_indicate_1)
00993 {
00994 fprintf (fp, (_("# Write a pin 1 marker on the silkscreen\n")));
00995 write_element_arc
00996 (
00997 xmin - (multiplier * (pad_solder_mask_clearance + pad_clearance)),
00998 ymax + (multiplier * (pad_solder_mask_clearance + pad_clearance)),
00999 multiplier * 0.5 * silkscreen_line_width,
01000 multiplier * 0.5 * silkscreen_line_width,
01001 0,
01002 360,
01003 multiplier * silkscreen_line_width
01004 );
01005 }
01006
01007 if (courtyard)
01008 {
01009 fprintf (fp, (_("# Write a courtyard on the silkscreen\n")));
01010 write_rectangle
01011 (
01012 xmin,
01013 ymin,
01014 xmax,
01015 ymax,
01016 multiplier * courtyard_line_width
01017 );
01018 }
01019
01020 if (attributes_in_footprint)
01021 {
01022 write_attributes ();
01023 }
01024
01025 fprintf (fp, "\n");
01026 fprintf (fp, ")\n");
01027 fclose (fp);
01028
01029 if (verbose)
01030 {
01031 g_log ("", G_LOG_LEVEL_INFO,
01032 (_("wrote a footprint for a %s package: %s.")),
01033 footprint_type,
01034 footprint_filename);
01035 }
01036 return (EXIT_SUCCESS);
01037 }
01038
01039
01043 static fpw_function_t
01044 con_dil_function_list[] =
01045 {
01046 #if GUI
01047 {
01048 "Set GUI constraints",
01049 con_dil_set_gui_constraints,
01050 "Set GUI constraints for a CON-DIL package",
01051 NULL
01052 },
01053 #endif
01054 {
01055 "Create Element",
01056 con_dil_create_element,
01057 "Create a pcb element for a CON-DIL package",
01058 NULL
01059 },
01060 {
01061 "Create Package List",
01062 con_dil_create_packages_list,
01063 "Create a list of packages with known values",
01064 NULL
01065 },
01066 {
01067 "DRC CON-DIL Element",
01068 con_dil_drc,
01069 "Design Rule Check for a CON-DIL package",
01070 NULL
01071 },
01072 {
01073 "Default Element Values",
01074 con_dil_get_default_footprint_values,
01075 "Get default values for a selected CON-DIL package",
01076 NULL
01077 },
01078 {
01079 "Write footprint",
01080 con_dil_write_footprint,
01081 "Write footprint for a selected CON-DIL package",
01082 NULL
01083 }
01084 };
01085
01086
01090 REGISTER_FUNCTIONS (con_dil_function_list)
01091
01092
01093
01096 void
01097 con_dil_init ()
01098 {
01099 register_con_dil_function_list ();
01100 }
01101
01102
01103