00001
00025 #include "register_functions.c"
00026 #include "sip.h"
00027
00028
00035 int
00036 sip_create_element ()
00037 {
00038 gdouble xmax;
00039 gdouble xmin;
00040 gdouble ymax;
00041 gdouble ymin;
00042 gdouble x_text;
00043 gdouble y_text;
00044 gint i;
00045 gint pin_number;
00046 gchar *pin_pad_name = g_strdup ("");
00047 FlagType pad_flag;
00048 ElementTypePtr element;
00049
00050 if (!element)
00051 {
00052 if (verbose)
00053 {
00054 g_log ("", G_LOG_LEVEL_WARNING,
00055 _("could not create a valid element pointer for a %s package."),
00056 footprint_type);
00057 }
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_rows); 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 * (-pitch_x / 2.0)),
00146 (int) (multiplier * ((((-number_of_rows - 1) / 2.0) +1 + i) * pitch_y)),
00147 (int) (multiplier * pad_diameter),
00148 (int) (multiplier * 2 * pad_clearance),
00149 (int) (multiplier * (pad_diameter + (2 * 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 * (-pitch_x - pad_width + pad_length) / 2.0),
00162 (int) (multiplier * ((((-number_of_rows - 1) / 2.0) + 1 + i) * pitch_y)),
00163 (int) (multiplier * (-pitch_x + pad_width - pad_length) / 2.0),
00164 (int) (multiplier * ((((-number_of_rows - 1) / 2.0) + 1 + i) * pitch_y)),
00165 (int) (multiplier * pad_width),
00166 (int) (multiplier * 2 * 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 }
00174
00175 if (silkscreen_package_outline)
00176 {
00177 create_new_line
00178 (
00179 element,
00180 (int) (multiplier * (-package_body_length / 2.0)),
00181 (int) (multiplier * (-package_body_width / 2.0)),
00182 (int) (multiplier * (-package_body_length / 2.0)),
00183 (int) (multiplier * (package_body_width / 2.0)),
00184 (int) (multiplier * silkscreen_line_width)
00185 );
00186 create_new_line
00187 (
00188 element,
00189 (int) (multiplier * (package_body_length / 2.0)),
00190 (int) (multiplier * (-package_body_width / 2.0)),
00191 (int) (multiplier * (package_body_length / 2.0)),
00192 (int) (multiplier * (package_body_width / 2.0)),
00193 (int) (multiplier * silkscreen_line_width)
00194 );
00195 create_new_line
00196 (
00197 element,
00198 (int) (multiplier * (-package_body_length / 2.0)),
00199 (int) (multiplier * (-package_body_width / 2.0)),
00200 (int) (multiplier * (package_body_length / 2.0)),
00201 (int) (multiplier * (-package_body_width / 2.0)),
00202 (int) (multiplier * silkscreen_line_width)
00203 );
00204 create_new_line
00205 (
00206 element,
00207 (int) (multiplier * (package_body_length / 2.0)),
00208 (int) (multiplier * (package_body_width / 2.0)),
00209 (int) (multiplier * (-package_body_length / 2.0)),
00210 (int) (multiplier * (package_body_width / 2.0)),
00211 (int) (multiplier * silkscreen_line_width)
00212 );
00213 }
00214
00215 if (silkscreen_indicate_1)
00216 {
00217
00218 create_new_line
00219 (
00220 element,
00221 (int) (multiplier * (-package_body_length / 2.0)),
00222 (int) (multiplier * ((((-number_of_rows - 1) / 2.0) + 1.5) * pitch_y)),
00223 (int) (multiplier * (package_body_length / 2.0)),
00224 (int) (multiplier * ((((-number_of_rows - 1) / 2.0) + 1.5) * pitch_y)),
00225 (int) (multiplier * silkscreen_line_width)
00226 );
00227
00228 if (xmax > ((multiplier * package_body_length) / 2))
00229 {
00230 create_new_line
00231 (
00232 element,
00233 (int) (multiplier * (-package_body_length / 2.0)),
00234 (int) (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)),
00235 (int) ((multiplier * (-package_body_length / 2.0)) - 2500),
00236 (int) ((multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) - 1250),
00237 (int) (multiplier * silkscreen_line_width)
00238 );
00239 create_new_line
00240 (
00241 element,
00242 (int) (multiplier * (-package_body_length / 2.0)),
00243 (int) (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)),
00244 (int) ((multiplier * (-package_body_length / 2.0)) - 2500),
00245 (int) ((multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) + 1250),
00246 (int) (multiplier * silkscreen_line_width)
00247 );
00248 create_new_line
00249 (
00250 element,
00251 (int) ((multiplier * (-package_body_length / 2.0)) - 2500),
00252 (int) ((multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) - 1250),
00253 (int) ((multiplier * (-package_body_length / 2.0)) - 2500),
00254 (int) ((multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) + 1250),
00255 (int) (multiplier * silkscreen_line_width)
00256 );
00257 }
00258 }
00259
00260 if (courtyard)
00261 {
00262 create_new_line
00263 (
00264 element,
00265 (int) (xmin),
00266 (int) (ymin),
00267 (int) (xmin),
00268 (int) (ymax),
00269 (int) (multiplier * courtyard_line_width)
00270 );
00271 create_new_line
00272 (
00273 element,
00274 (int) (xmax),
00275 (int) (ymin),
00276 (int) (xmax),
00277 (int) (ymax),
00278 (int) (multiplier * courtyard_line_width)
00279 );
00280 create_new_line
00281 (
00282 element,
00283 (int) (xmin),
00284 (int) (ymin),
00285 (int) (xmax),
00286 (int) (ymin),
00287 (int) (multiplier * courtyard_line_width)
00288 );
00289 create_new_line
00290 (
00291 element,
00292 (int) (xmax),
00293 (int) (ymax),
00294 (int) (xmin),
00295 (int) (ymax),
00296 (int) (multiplier * courtyard_line_width)
00297 );
00298 }
00299
00300 if (attributes_in_footprint)
00301 {
00302 element = create_attributes_in_element (element);
00303 }
00304
00305 if (verbose)
00306 {
00307 g_log ("", G_LOG_LEVEL_INFO,
00308 _("created an element for a %s package: %s."),
00309 footprint_type,
00310 footprint_filename);
00311 }
00312 current_element = (ElementTypePtr) &element;
00313 return (EXIT_SUCCESS);
00314 }
00315
00316
00326 int
00327 sip_create_packages_list ()
00328 {
00329 g_list_free (packages_list);
00330 packages_list = g_list_append (packages_list, "SIP");
00331 return (EXIT_SUCCESS);
00332 }
00333
00334
00361 int
00362 sip_drc ()
00363 {
00364 int result = EXIT_SUCCESS;
00365 if (verbose)
00366 {
00367 g_log ("", G_LOG_LEVEL_INFO,
00368 (_("[%s] DRC Check: checking package %s.")),
00369 footprint_type, footprint_name);
00370 }
00371
00372 if (number_of_rows < 1)
00373 {
00374 if (verbose)
00375 {
00376 g_log ("", G_LOG_LEVEL_WARNING,
00377 (_("[%s] DRC Error: number of rows < 1.")),
00378 footprint_type);
00379 }
00380 result = EXIT_FAILURE;
00381 }
00382
00383 if (number_of_columns > 1)
00384 {
00385 if (verbose)
00386 {
00387 g_log ("", G_LOG_LEVEL_WARNING,
00388 (_("[%s] DRC Error: number of columns is > 1.")),
00389 footprint_type);
00390 }
00391 number_of_columns = 1;
00392 result = EXIT_FAILURE;
00393 }
00394
00395 if (pitch_y != 0.0)
00396 {
00397 if (verbose)
00398 {
00399 g_log ("", G_LOG_LEVEL_WARNING,
00400 (_("[%s] DRC Error: pitch (Y-direction) should be 0.")),
00401 footprint_type);
00402 pitch_x = 0.0;
00403 }
00404 result = EXIT_FAILURE;
00405 }
00406
00407 switch (pad_shapes_type)
00408 {
00409 case NO_SHAPE:
00410 {
00411 if (verbose)
00412 {
00413 g_log ("", G_LOG_LEVEL_WARNING,
00414 (_("[%s] DRC Error: NO_SHAPE specified for check for allowed pad shapes.")),
00415 footprint_type);
00416 }
00417 result = EXIT_FAILURE;
00418 break;
00419 }
00420 case ROUND:
00421 {
00422 break;
00423 }
00424 case SQUARE:
00425 {
00426 if (verbose)
00427 {
00428 g_log ("", G_LOG_LEVEL_WARNING,
00429 (_("[%s] DRC Error: square pad shape specified for check for allowed pad shapes.")),
00430 footprint_type);
00431 }
00432 result = EXIT_FAILURE;
00433 break;
00434 }
00435 case OCTAGONAL:
00436 {
00437 if (verbose)
00438 {
00439 g_log ("", G_LOG_LEVEL_WARNING,
00440 (_("[%s] DRC Error: octagonal pad shape specified for check for allowed pad shapes.")),
00441 footprint_type);
00442 }
00443 result = EXIT_FAILURE;
00444 break;
00445 }
00446 case ROUND_ELONGATED:
00447 {
00448 break;
00449 }
00450 default:
00451 {
00452 if (verbose)
00453 {
00454 g_log ("", G_LOG_LEVEL_WARNING,
00455 (_("[%s] DRC Error: no valid pad shape type specified.")),
00456 footprint_type);
00457 }
00458 result = EXIT_FAILURE;
00459 break;
00460 }
00461 }
00462
00463 if (package_body_length <= 0.0)
00464 {
00465 if (verbose)
00466 {
00467 g_log ("", G_LOG_LEVEL_WARNING,
00468 (_("[%s] DRC Error: specified package body length is too small.")),
00469 footprint_type);
00470 }
00471 result = EXIT_FAILURE;
00472 }
00473 if (package_body_width <= 0.0)
00474 {
00475 if (verbose)
00476 {
00477 g_log ("", G_LOG_LEVEL_WARNING,
00478 (_("[%s] DRC Error: specified package body width is too small.")),
00479 footprint_type);
00480 }
00481 result = EXIT_FAILURE;
00482 }
00483 if (package_body_height <= 0.0)
00484 {
00485 if (verbose)
00486 {
00487 g_log ("", G_LOG_LEVEL_WARNING,
00488 (_("[%s] DRC Error: specified package body height is too small.")),
00489 footprint_type);
00490 }
00491 result = EXIT_FAILURE;
00492 }
00493
00494 if (courtyard_length <= 0.0)
00495 {
00496 if (verbose)
00497 {
00498 g_log ("", G_LOG_LEVEL_WARNING,
00499 (_("[%s] DRC Error: specified courtyard length is too small.")),
00500 footprint_type);
00501 }
00502 result = EXIT_FAILURE;
00503 }
00504 if (courtyard_width <= 0.0)
00505 {
00506 if (verbose)
00507 {
00508 g_log ("", G_LOG_LEVEL_WARNING,
00509 (_("[%s] DRC Error: specified courtyard width is too small.")),
00510 footprint_type);
00511 }
00512 result = EXIT_FAILURE;
00513 }
00514
00515 if ((pitch_y - pad_diameter < pad_clearance) || (pitch_y - pad_width < pad_clearance))
00516 {
00517 if (verbose)
00518 {
00519 g_log ("", G_LOG_LEVEL_WARNING,
00520 (_("[%s] DRC Error: minimum clearance between copper (Y-direction) is too small.")),
00521 footprint_type);
00522 }
00523 result = EXIT_FAILURE;
00524 }
00525
00526 if (fiducial)
00527 {
00528 if (verbose)
00529 {
00530 g_log ("", G_LOG_LEVEL_WARNING,
00531 (_("[%s] DRC Error: package should not have any fiducials.")),
00532 footprint_type);
00533 }
00534 result = EXIT_FAILURE;
00535 }
00536
00537
00538 if (package_body_length - courtyard_length < courtyard_clearance_with_package)
00539 {
00540 if (verbose)
00541 {
00542 g_log ("", G_LOG_LEVEL_WARNING,
00543 (_("[%s] DRC Error: clearance of the package length with regard to the courtyard dimensions is too small.")),
00544 footprint_type);
00545 }
00546 result = EXIT_FAILURE;
00547 }
00548
00549
00550 if (package_body_width - courtyard_width < courtyard_clearance_with_package)
00551 {
00552 if (verbose)
00553 {
00554 g_log ("", G_LOG_LEVEL_WARNING,
00555 (_("[%s] DRC Error: clearance of the package width with regard to the courtyard dimensions is too small.")),
00556 footprint_type);
00557 }
00558 result = EXIT_FAILURE;
00559 }
00565
00566 if (silkscreen_package_outline && (silkscreen_line_width == 0.0))
00567 {
00568 if (verbose)
00569 {
00570 g_log ("", G_LOG_LEVEL_WARNING,
00571 (_("[%s] DRC Error: silkscreen line width is too small.")),
00572 footprint_type);
00573 }
00574 result = EXIT_FAILURE;
00575 }
00576 switch (units_type)
00577 {
00578 case NO_UNITS:
00579 {
00580 if (verbose)
00581 {
00582 g_log ("", G_LOG_LEVEL_WARNING,
00583 (_("[%s] DRC Error: no units specified.")),
00584 footprint_type);
00585 }
00586 result = EXIT_FAILURE;
00587 break;
00588 }
00589 case MIL:
00590 if (silkscreen_package_outline && (silkscreen_line_width > 40.0))
00591 {
00592 if (verbose)
00593 {
00594 g_log ("", G_LOG_LEVEL_WARNING,
00595 (_("[%s] DRC Error: silkscreen line width too wide.")),
00596 footprint_type);
00597 }
00598 result = EXIT_FAILURE;
00599 break;
00600 }
00601 case MIL_100:
00602 if (silkscreen_package_outline && (silkscreen_line_width > 4000.0))
00603 {
00604 if (verbose)
00605 {
00606 g_log ("", G_LOG_LEVEL_WARNING,
00607 (_("[%s] DRC Error: silkscreen line width too wide.")),
00608 footprint_type);
00609 }
00610 result = EXIT_FAILURE;
00611 break;
00612 }
00613 case MM:
00614 if (silkscreen_package_outline && (silkscreen_line_width > 1.0))
00615 {
00616 if (verbose)
00617 {
00618 g_log ("", G_LOG_LEVEL_WARNING,
00619 (_("[%s] DRC Error: silkscreen line width too wide.")),
00620 footprint_type);
00621 }
00622 result = EXIT_FAILURE;
00623 break;
00624 }
00625 default:
00626 {
00627 if (verbose)
00628 {
00629 g_log ("", G_LOG_LEVEL_WARNING,
00630 (_("[%s] DRC Error: no valid units type specified.")),
00631 footprint_type);
00632 }
00633 result = EXIT_FAILURE;
00634 break;
00635 }
00636 }
00637
00638 if (verbose && (result == EXIT_SUCCESS))
00639 {
00640 g_log ("", G_LOG_LEVEL_INFO,
00641 (_("[%s] DRC Check: no errors while checking package %s.")),
00642 footprint_type, footprint_name);
00643 }
00644 return (result);
00645 }
00646
00647
00661 int
00662 sip_get_default_footprint_values ()
00663 {
00664 if (!strcmp (footprint_name, "?SIP04"))
00665 {
00666 footprint_units = g_strdup ("mil");
00667 number_of_pins = 4;
00668 package_body_width = 200;
00669 package_body_length = 100;
00670 package_body_height = 200;
00671 package_is_radial = FALSE;
00672 number_of_columns = 1;
00673 number_of_rows = 2;
00674 pitch_x = 0;
00675 pitch_y = 100;
00676 count_x = 0;
00677 count_y = 0;
00678 pad_shape = g_strdup ("circular pad");
00679 pin_drill_diameter = 28;
00680 pad_diameter = 60;
00681 pad_clearance = 6;
00682 pad_solder_mask_clearance = 6;
00683 g_free (footprint_name);
00684 footprint_name = g_strdup ("SIP04");
00685 return (EXIT_SUCCESS);
00686 }
00687 else
00688 {
00689 fprintf (stderr,
00690 _("WARNING: default values for footprint %s not found.\n"),
00691 footprint_name);
00692 return (EXIT_FAILURE);
00693 }
00694 return (EXIT_SUCCESS);
00695 }
00696
00697
00705 #if GUI
00706 int
00707 sip_set_gui_constraints ()
00708 {
00709
00710 GtkWidget *package_is_radial_checkbutton = lookup_widget (GTK_WIDGET (widget),
00711 "package_is_radial_checkbutton");
00712 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (package_is_radial_checkbutton), FALSE);
00713 gtk_widget_set_sensitive (package_is_radial_checkbutton, FALSE);
00714
00715
00716 GtkWidget *number_of_columns_entry = lookup_widget (GTK_WIDGET (widget),
00717 "number_of_columns_entry");
00718 gtk_entry_set_text (GTK_ENTRY (number_of_columns_entry), "1");
00719 gtk_widget_set_sensitive (number_of_columns_entry, FALSE);
00720 GtkWidget *number_of_rows_entry = lookup_widget (GTK_WIDGET (widget),
00721 "number_of_rows_entry");
00722 gtk_entry_set_text (GTK_ENTRY (number_of_rows_entry), "");
00723 gtk_widget_set_sensitive (number_of_rows_entry, TRUE);
00724 GtkWidget *count_x_entry = lookup_widget (GTK_WIDGET (widget),
00725 "count_x_entry");
00726 gtk_entry_set_text (GTK_ENTRY (count_x_entry), "");
00727 gtk_widget_set_sensitive (count_x_entry, FALSE);
00728 GtkWidget *count_y_entry = lookup_widget (GTK_WIDGET (widget),
00729 "count_y_entry");
00730 gtk_entry_set_text (GTK_ENTRY (count_y_entry), "");
00731 gtk_widget_set_sensitive (count_y_entry, FALSE);
00732 GtkWidget *number_1_position_entry = lookup_widget (GTK_WIDGET (widget),
00733 "number_1_position_entry");
00734 gtk_combo_box_set_active (GTK_COMBO_BOX (number_1_position_entry), UPPER_LEFT);
00735 gtk_widget_set_sensitive (number_1_position_entry, FALSE);
00736
00737
00738 gui_constraints_disable_thermal_tab_widgets (widget);
00739
00740
00741 gui_constraints_disable_heel_and_toe_goals_tab_widgets (widget);
00742 return (EXIT_SUCCESS);
00743 }
00744 #endif
00745
00746
00759 int
00760 sip_write_footprint ()
00761 {
00762 gdouble xmax;
00763 gdouble xmin;
00764 gdouble ymax;
00765 gdouble ymin;
00766 gdouble x_text;
00767 gdouble y_text;
00768 gint pin_number;
00769 gchar *pin_pad_name = g_strdup ("");
00770 gchar *pin_pad_flags = g_strdup ("");
00771 gint i;
00772
00773 number_of_columns = 1;
00774
00775 fp = fopen (footprint_filename, "w");
00776 if (!fp)
00777 {
00778 g_log ("", G_LOG_LEVEL_WARNING,
00779 _("could not open file for %s footprint: %s."),
00780 footprint_type, footprint_filename);
00781 fclose (fp);
00782 return (EXIT_FAILURE);
00783 }
00784
00785 if (license_in_footprint)
00786 {
00787 write_license ();
00788 }
00789
00790
00791 xmin = multiplier *
00792 (
00793 (((pad_diameter > pad_length) ? pad_diameter : pad_length) / -2.0) - pad_solder_mask_clearance
00794 );
00795 xmax = multiplier *
00796 (
00797 (((pad_diameter > pad_length) ? pad_diameter : pad_length) / 2.0) + pad_solder_mask_clearance
00798 );
00799 ymin = multiplier *
00800 (
00801 (((-number_of_rows + 1) / 2.0) * pitch_y) -
00802 (((pad_diameter > pad_width) ? pad_diameter : pad_width) / 2.0) -
00803 pad_solder_mask_clearance
00804 );
00805 ymax = multiplier *
00806 (
00807 (((number_of_rows - 1 ) / 2.0) * pitch_y) +
00808 (((pad_diameter > pad_width) ? pad_diameter : pad_width) / 2.0) +
00809 pad_solder_mask_clearance
00810 );
00811
00812
00813 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00814 {
00815 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00816 }
00817 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00818 {
00819 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00820 }
00821 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00822 {
00823 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00824 }
00825 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00826 {
00827 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00828 }
00829
00830 if (multiplier * (-courtyard_length / 2.0) < xmin)
00831 {
00832 xmin = multiplier * (-courtyard_length / 2.0);
00833 }
00834 if (multiplier * (courtyard_length / 2.0) > xmax)
00835 {
00836 xmax = multiplier * (courtyard_length / 2.0);
00837 }
00838 if (multiplier * (-courtyard_width / 2.0) < ymin)
00839 {
00840 ymin = multiplier * (-courtyard_width / 2.0);
00841 }
00842 if (multiplier * (courtyard_width / 2.0) > ymax)
00843 {
00844 ymax = multiplier * (courtyard_width / 2.0);
00845 }
00846
00847
00848 x_text = 0.0 ;
00849 y_text = (ymin - 10000.0);
00850 write_element_header (x_text, y_text);
00851
00852 for (i = 0; (i < number_of_rows); i++)
00853 {
00854 pin_number = 1 + i;
00855 write_pin
00856 (
00857 pin_number,
00858 pin_pad_name,
00859 0,
00860 multiplier * ((((-number_of_rows - 1) / 2.0) +1 + i) * pitch_y),
00861 multiplier * pad_diameter,
00862 multiplier * 2 * pad_clearance,
00863 multiplier * (pad_diameter + (2 * pad_solder_mask_clearance)),
00864 multiplier * pin_drill_diameter,
00865 (pin1_square && (pin_number == 1)) ? "square" : pin_pad_flags
00866 );
00867 if (!strcmp (pad_shape, "rounded pad, elongated"))
00868 {
00869 if (!strcmp (pin_pad_flags, ""))
00870 pin_pad_flags = g_strconcat (pin_pad_flags, "onsolder", NULL);
00871 else
00872 pin_pad_flags = g_strconcat (pin_pad_flags, ",onsolder", NULL);
00873 write_pad
00874 (
00875 pin_number,
00876 pin_pad_name,
00877 multiplier * (-pad_width + pad_length) / 2.0,
00878 multiplier * ((((-number_of_rows - 1) / 2.0) + 1 + i) * pitch_y),
00879 multiplier * (pad_width - pad_length) / 2.0,
00880 multiplier * ((((-number_of_rows - 1) / 2.0) + 1 + i) * pitch_y),
00881 multiplier * pad_width,
00882 multiplier * 2 * pad_clearance,
00883 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00884 pin_pad_flags
00885 );
00886 }
00887 }
00888
00889 if (silkscreen_package_outline)
00890 {
00891 fprintf (fp, "# Write a package body on the silkscreen\n");
00892 write_rectangle
00893 (
00894 multiplier * ((-package_body_length) / 2.0),
00895 multiplier * ((-package_body_width) / 2.0),
00896 multiplier * ((package_body_length) / 2.0),
00897 multiplier * ((package_body_width) / 2.0),
00898 multiplier * silkscreen_line_width
00899 );
00900 }
00901
00902 if (silkscreen_indicate_1)
00903 {
00904 fprintf (fp, "# Write a pin 1 marker on the silkscreen\n");
00905
00906 write_element_line
00907 (
00908 multiplier * (-package_body_length / 2.0),
00909 multiplier * ((((-number_of_rows - 1) / 2.0) + 1.5) * pitch_y),
00910 multiplier * (package_body_length / 2.0),
00911 multiplier * ((((-number_of_rows - 1) / 2.0) + 1.5) * pitch_y),
00912 multiplier * (silkscreen_line_width)
00913 );
00914
00915 if (xmax > ((multiplier * package_body_length) / 2))
00916 {
00917 write_element_line
00918 (
00919 multiplier * (-package_body_length / 2.0),
00920 multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y),
00921 (multiplier * (-package_body_length / 2.0)) - 2500 ,
00922 (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) - 1250,
00923 multiplier * (silkscreen_line_width)
00924 );
00925 write_element_line
00926 (
00927 multiplier * (-package_body_length / 2.0),
00928 multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y),
00929 (multiplier * (-package_body_length / 2.0)) - 2500 ,
00930 (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) + 1250,
00931 multiplier * (silkscreen_line_width)
00932 );
00933 write_element_line
00934 (
00935 (multiplier * (-package_body_length / 2.0)) - 2500 ,
00936 (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) - 1250,
00937 (multiplier * (-package_body_length / 2.0)) - 2500 ,
00938 (multiplier * (((-number_of_rows + 1) / 2.0) * pitch_y)) + 1250,
00939 multiplier * (silkscreen_line_width)
00940 );
00941 }
00942 }
00943
00944 if (courtyard)
00945 {
00946 fprintf (fp, "# Write a courtyard on the silkscreen\n");
00947 write_rectangle
00948 (
00949 xmin,
00950 ymin,
00951 xmax,
00952 ymax,
00953 multiplier * courtyard_line_width
00954 );
00955 }
00956
00957 if (attributes_in_footprint)
00958 {
00959 write_attributes ();
00960 }
00961
00962 fprintf (fp, "\n");
00963 fprintf (fp, ")\n");
00964 fclose (fp);
00965
00966 if (verbose)
00967 {
00968 g_log ("", G_LOG_LEVEL_INFO,
00969 _("wrote a footprint for a %s package: %s."),
00970 footprint_type,
00971 footprint_filename);
00972 }
00973 return (EXIT_SUCCESS);
00974 }
00975
00976
00980 static fpw_function_t
00981 sip_function_list[] =
00982 {
00983 #if GUI
00984 {
00985 "Set GUI constraints",
00986 sip_set_gui_constraints,
00987 "Set GUI constraints for a SIP package",
00988 NULL
00989 },
00990 #endif
00991 {
00992 "Create Package List",
00993 sip_create_packages_list,
00994 "Create a list of packages with known values",
00995 NULL
00996 },
00997 {
00998 "DRC SIP Element",
00999 sip_drc,
01000 "Design Rule Check for a SIP package",
01001 NULL
01002 },
01003 {
01004 "Default Element Values",
01005 sip_get_default_footprint_values,
01006 "Get default values for a selected SIP package",
01007 NULL
01008 },
01009 {
01010 "Write footprint",
01011 sip_write_footprint,
01012 "Write footprint for a selected SIP package",
01013 NULL
01014 }
01015 };
01016
01017
01021 REGISTER_FUNCTIONS (sip_function_list)
01022
01023
01024
01027 void
01028 sip_init ()
01029 {
01030 register_sip_function_list ();
01031 }
01032
01033
01034