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