00001
00025 #include "register_functions.c"
00026 #include "indm.h"
00027
00028
00035 int
00036 indm_create_element ()
00037 {
00038 gdouble xmax;
00039 gdouble xmin;
00040 gdouble ymax;
00041 gdouble ymin;
00042 gdouble x_text;
00043 gdouble y_text;
00044 gdouble dx;
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 xmin = multiplier * ((-pitch_x / 2.0) - (pad_length / 2.0) - pad_solder_mask_clearance);
00067 xmax = multiplier * (pitch_x / 2.0 + pad_length / 2.0 + pad_solder_mask_clearance);
00068 ymin = multiplier * ((-pad_width / 2.0) - pad_solder_mask_clearance);
00069 ymax = multiplier * (pad_width / 2.0 + pad_solder_mask_clearance);
00070
00071
00072 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00073 {
00074 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00075 }
00076 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00077 {
00078 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00079 }
00080 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00081 {
00082 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00083 }
00084 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00085 {
00086 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00087 }
00088
00089 if (multiplier * (-courtyard_length / 2.0) < xmin)
00090 {
00091 xmin = multiplier * (-courtyard_length / 2.0);
00092 }
00093 if (multiplier * (courtyard_length / 2.0) > xmax)
00094 {
00095 xmax = multiplier * (courtyard_length / 2.0);
00096 }
00097 if (multiplier * (-courtyard_width / 2.0) < ymin)
00098 {
00099 ymin = multiplier * (-courtyard_width / 2.0);
00100 }
00101 if (multiplier * (courtyard_width / 2.0) > ymax)
00102 {
00103 ymax = multiplier * (courtyard_width / 2.0);
00104 }
00105
00106 element->Name[1].Scale = 100;
00107 element->Name[1].X = 0.0 ;
00108 element->Name[1].Y = (ymin - 10000.0);
00109 element->Name[1].TextString = footprint_name;
00110 element->Name[1].Element = element;
00111 element->Name[1].Direction = EAST;
00112 element->Name[1].ID = ID++;
00113
00114 element->Name[2].Scale = 100;
00115 element->Name[2].X = 0.0 ;
00116 element->Name[2].Y = (ymin - 10000.0);
00117 element->Name[2].TextString = footprint_refdes;
00118 element->Name[2].Element = element;
00119 element->Name[2].Direction = EAST;
00120 element->Name[2].ID = ID++;
00121
00122 element->Name[3].Scale = 100;
00123 element->Name[3].X = 0.0 ;
00124 element->Name[3].Y = (ymin - 10000.0);
00125 element->Name[3].TextString = footprint_value;
00126 element->Name[3].Element = element;
00127 element->Name[3].Direction = EAST;
00128 element->Name[3].ID = ID++;
00129
00130 if (pad_shapes_type == SQUARE)
00131 {
00132 pad_flag.f = SQUARE;
00133 }
00134 else
00135 {
00136 pad_flag.f = CLEAR;
00137 }
00138 if (pad_length > pad_width)
00139 {
00140
00141 create_new_pad
00142 (
00143 element,
00144 (int) (multiplier * ((pitch_x - pad_length + pad_width) / 2.0)),
00145 0,
00146 (int) (multiplier * ((pitch_x + pad_length - pad_width) / 2.0)),
00147 0,
00148 (int) (multiplier * pad_width),
00149 (int) (multiplier * pad_clearance),
00150 (int) (multiplier * (pad_width + (2 * pad_solder_mask_clearance))),
00151 "",
00152 "2",
00153 pad_flag
00154 );
00155
00156 if (pin1_square)
00157 {
00158 pad_flag.f = SQUARE;
00159 }
00160
00161 create_new_pad
00162 (
00163 element,
00164 (int) (multiplier * ((-pitch_x - pad_length + pad_width) / 2.0)),
00165 0,
00166 (int) (multiplier * ((-pitch_x + pad_length - pad_width) / 2.0)),
00167 0,
00168 (int) (multiplier * pad_width),
00169 (int) (multiplier * pad_clearance),
00170 (int) (multiplier * (pad_width + (2 * pad_solder_mask_clearance))),
00171 "",
00172 "1",
00173 pad_flag
00174 );
00175 }
00176 else
00177 {
00178
00179 create_new_pad
00180 (
00181 element,
00182 (int) (multiplier * (pitch_x / 2.0)),
00183 (int) (multiplier * ((pad_width - pad_length) / 2.0)),
00184 (int) (multiplier * (pitch_x / 2.0)),
00185 (int) (multiplier * ((-pad_width + pad_length) / 2.0)),
00186 (int) (multiplier * pad_length),
00187 (int) (multiplier * pad_clearance),
00188 (int) (multiplier * (pad_length + (2 * pad_solder_mask_clearance))),
00189 "",
00190 "2",
00191 pad_flag
00192 );
00193
00194 if (pin1_square)
00195 {
00196 pad_flag.f = SQUARE;
00197 }
00198
00199 create_new_pad
00200 (
00201 element,
00202 (int) (multiplier * (-pitch_x / 2.0)),
00203 (int) (multiplier * ((pad_width - pad_length) / 2.0)),
00204 (int) (multiplier * (-pitch_x / 2)),
00205 (int) (multiplier * ((-pad_width + pad_length) / 2.0)),
00206 (int) (multiplier * pad_length),
00207 (int) (multiplier * pad_clearance),
00208 (int) (multiplier * (pad_length + (2 * pad_solder_mask_clearance))),
00209 "",
00210 "1",
00211 pad_flag
00212 );
00213 }
00214
00215 if (silkscreen_package_outline && package_body_width)
00216 {
00217 if (pad_width >= package_body_width)
00218 {
00219 create_new_line
00220 (
00221 element,
00222 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00223 (int) (multiplier * (package_body_width / 2.0)),
00224 (int) (multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width)),
00225 (int) (multiplier * (package_body_width / 2.0)),
00226 (int) (multiplier * silkscreen_line_width)
00227 );
00228 create_new_line
00229 (
00230 element,
00231 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00232 (int) (multiplier * (-package_body_width / 2.0)),
00233 (int) (multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width)),
00234 (int) (multiplier * (-package_body_width / 2.0)),
00235 (int) (multiplier * silkscreen_line_width)
00236 );
00237 }
00238 else
00239 {
00240
00241 create_new_line
00242 (
00243 element,
00244 (int) (multiplier * (-package_body_length / 2.0)),
00245 (int) (multiplier * (package_body_width / 2.0)),
00246 (int) (multiplier * (package_body_length / 2.0)),
00247 (int) (multiplier * (package_body_width / 2.0)),
00248 (int) (multiplier * silkscreen_line_width)
00249 );
00250 create_new_line
00251 (
00252 element,
00253 (int) (multiplier * (-package_body_length / 2.0)),
00254 (int) (multiplier * (-package_body_width / 2.0)),
00255 (int) (multiplier * (package_body_length / 2.0)),
00256 (int) (multiplier * (-package_body_width / 2.0)),
00257 (int) (multiplier * silkscreen_line_width)
00258 );
00259
00260 create_new_line
00261 (
00262 element,
00263 (int) (multiplier * (-package_body_length / 2.0)),
00264 (int) (multiplier * (-package_body_width / 2.0)),
00265 (int) (multiplier * (-package_body_length / 2.0)),
00266 (int) (multiplier * (((-pad_width - silkscreen_line_width) / 2.0) - pad_solder_mask_clearance)),
00267 (int) (multiplier * silkscreen_line_width)
00268 );
00269 create_new_line
00270 (
00271 element,
00272 (int) (multiplier * (-package_body_length / 2.0)),
00273 (int) (multiplier * (package_body_width / 2.0)),
00274 (int) (multiplier * (-package_body_length / 2.0)),
00275 (int) (multiplier * (((pad_width + silkscreen_line_width) / 2.0) + pad_solder_mask_clearance)),
00276 (int) (multiplier * silkscreen_line_width)
00277 );
00278 create_new_line
00279 (
00280 element,
00281 (int) (multiplier * (package_body_length / 2.0)),
00282 (int) (multiplier * (-package_body_width / 2.0)),
00283 (int) (multiplier * (package_body_length / 2.0)),
00284 (int) (multiplier * (((-pad_width - silkscreen_line_width) / 2.0) - pad_solder_mask_clearance)),
00285 (int) (multiplier * silkscreen_line_width)
00286 );
00287 create_new_line
00288 (
00289 element,
00290 (int) (multiplier * (package_body_length / 2.0)),
00291 (int) (multiplier * (package_body_width / 2.0)),
00292 (int) (multiplier * (package_body_length / 2.0)),
00293 (int) (multiplier * (((pad_width + silkscreen_line_width) / 2.0) + pad_solder_mask_clearance)),
00294 (int) (multiplier * silkscreen_line_width)
00295 );
00296 }
00297 }
00298
00299 if (silkscreen_indicate_1)
00300 {
00301 if (pad_width >= package_body_width)
00302 {
00303 create_new_line
00304 (
00305 element,
00306 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00307 (int) (multiplier * (-package_body_width / 2.0)),
00308 (int) (multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width)),
00309 (int) (multiplier * (package_body_width / 2.0)),
00310 (int) (multiplier * silkscreen_line_width)
00311 );
00312 }
00313 else
00314 {
00315 create_new_arc
00316 (
00317 element,
00318 (int) (multiplier * (((-package_body_length) / 2.0) - 2 * silkscreen_line_width)),
00319 (int) (multiplier * (-package_body_width / 2.0)),
00320 (int) (multiplier * 0.5 * silkscreen_line_width),
00321 (int) (multiplier * 0.5 * silkscreen_line_width),
00322 0,
00323 360,
00324 (int) (multiplier * silkscreen_line_width)
00325 );
00326 }
00327 }
00328
00329 if (courtyard)
00330 {
00331 create_new_line
00332 (
00333 element,
00334 (int) (xmin),
00335 (int) (ymin),
00336 (int) (xmin),
00337 (int) (ymax),
00338 (int) (multiplier * courtyard_line_width)
00339 );
00340 create_new_line
00341 (
00342 element,
00343 (int) (xmax),
00344 (int) (ymin),
00345 (int) (xmax),
00346 (int) (ymax),
00347 (int) (multiplier * courtyard_line_width)
00348 );
00349 create_new_line
00350 (
00351 element,
00352 (int) (xmin),
00353 (int) (ymin),
00354 (int) (xmax),
00355 (int) (ymin),
00356 (int) (multiplier * courtyard_line_width)
00357 );
00358 create_new_line
00359 (
00360 element,
00361 (int) (xmax),
00362 (int) (ymax),
00363 (int) (xmin),
00364 (int) (ymax),
00365 (int) (multiplier * courtyard_line_width)
00366 );
00367 }
00368
00369 if (attributes_in_footprint)
00370 {
00371 element = create_attributes_in_element (element);
00372 }
00373
00374 if (verbose)
00375 {
00376 g_log ("", G_LOG_LEVEL_INFO,
00377 _("created an element for a %s package: %s."),
00378 footprint_type,
00379 footprint_filename);
00380 }
00381 current_element = (ElementTypePtr) &element;
00382 return (EXIT_SUCCESS);
00383 }
00384
00385
00395 int
00396 indm_create_packages_list ()
00397 {
00398 g_list_free (packages_list);
00399 packages_list = g_list_append (packages_list, "INDM");
00400 return (EXIT_SUCCESS);
00401 }
00402
00403
00433 int
00434 indm_drc ()
00435 {
00436 int result = EXIT_SUCCESS;
00437 if (verbose)
00438 {
00439 g_log ("", G_LOG_LEVEL_INFO,
00440 (_("[%s] DRC Check: checking package %s.")),
00441 footprint_type, footprint_name);
00442 }
00443
00444 if (number_of_pins != 2)
00445 {
00446 if (verbose)
00447 {
00448 g_log ("", G_LOG_LEVEL_WARNING,
00449 (_("[%s] DRC Error: check for number of pins/pads <> 2.")),
00450 footprint_type);
00451 }
00452 result = EXIT_FAILURE;
00453 }
00454
00455 switch (pad_shapes_type)
00456 {
00457 case NO_SHAPE:
00458 {
00459 if (verbose)
00460 {
00461 g_log ("", G_LOG_LEVEL_WARNING,
00462 (_("[%s] DRC Error: NO_SHAPE specified for check for allowed pad shapes.")),
00463 footprint_type);
00464 }
00465 result = EXIT_FAILURE;
00466 break;
00467 }
00468 case ROUND:
00469 {
00470 if (verbose)
00471 {
00472 g_log ("", G_LOG_LEVEL_WARNING,
00473 (_("[%s] DRC Error: circular pad shape specified for check for allowed pad shapes.")),
00474 footprint_type);
00475 }
00476 result = EXIT_FAILURE;
00477 break;
00478 }
00479 case SQUARE:
00480 {
00481 break;
00482 }
00483 case OCTAGONAL:
00484 {
00485 if (verbose)
00486 {
00487 g_log ("", G_LOG_LEVEL_WARNING,
00488 (_("[%s] DRC Error: octagonal pad shape specified for check for allowed pad shapes.")),
00489 footprint_type);
00490 }
00491 result = EXIT_FAILURE;
00492 break;
00493 }
00494 case ROUND_ELONGATED:
00495 {
00496 break;
00497 }
00498 default:
00499 {
00500 if (verbose)
00501 {
00502 g_log ("", G_LOG_LEVEL_WARNING,
00503 (_("[%s] DRC Error: no valid pad shape type specified.")),
00504 footprint_type);
00505 }
00506 result = EXIT_FAILURE;
00507 break;
00508 }
00509 }
00510
00511 if (package_body_length <= 0.0)
00512 {
00513 if (verbose)
00514 {
00515 g_log ("", G_LOG_LEVEL_WARNING,
00516 (_("[%s] DRC Error: check for package body length is <= 0.0.")),
00517 footprint_type);
00518 }
00519 result = EXIT_FAILURE;
00520 }
00521 if (package_body_width <= 0.0)
00522 {
00523 if (verbose)
00524 {
00525 g_log ("", G_LOG_LEVEL_WARNING,
00526 (_("[%s] DRC Error: check for package body width is <= 0.0.")),
00527 footprint_type);
00528 }
00529 result = EXIT_FAILURE;
00530 }
00531 if (package_body_height <= 0.0)
00532 {
00533 if (verbose)
00534 {
00535 g_log ("", G_LOG_LEVEL_WARNING,
00536 (_("[%s] DRC Error: check for package body height is <= 0.0.")),
00537 footprint_type);
00538 }
00539 result = EXIT_FAILURE;
00540 }
00541
00542 if (courtyard_length <= 0.0)
00543 {
00544 if (verbose)
00545 {
00546 g_log ("", G_LOG_LEVEL_WARNING,
00547 (_("[%s] DRC Error: check for courtyard length is <= 0.0.")),
00548 footprint_type);
00549 }
00550 result = EXIT_FAILURE;
00551 }
00552 if (courtyard_width <= 0.0)
00553 {
00554 if (verbose)
00555 {
00556 g_log ("", G_LOG_LEVEL_WARNING,
00557 (_("[%s] DRC Error: check for courtyard width is <= 0.0.")),
00558 footprint_type);
00559 }
00560 return (EXIT_FAILURE);
00561 }
00562
00563 if (pitch_x - pad_length < pad_clearance)
00564 {
00565 if (verbose)
00566 {
00567 g_log ("", G_LOG_LEVEL_WARNING,
00568 (_("[%s] DRC Error: check for minimum clearance between copper (X-direction).")),
00569 footprint_type);
00570 }
00571 result = EXIT_FAILURE;
00572 }
00573
00574 if (pitch_y - pad_width < pad_clearance)
00575 {
00576 if (verbose)
00577 {
00578 g_log ("", G_LOG_LEVEL_WARNING,
00579 (_("[%s] DRC Error: check for minimum clearance between copper (Y-direction).")),
00580 footprint_type);
00581 }
00582 result = EXIT_FAILURE;
00583 }
00584
00585 if (fiducial)
00586 {
00587 if (verbose)
00588 {
00589 g_log ("", G_LOG_LEVEL_WARNING,
00590 (_("[%s] DRC Error: check for fiducials, package should not have fiducials.")),
00591 footprint_type);
00592 }
00593 result = EXIT_FAILURE;
00594 }
00595
00596
00597 if (package_body_length - courtyard_length < 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 length with regard to the courtyard dimensions.")),
00603 footprint_type);
00604 }
00605 result = EXIT_FAILURE;
00606 }
00607
00608
00609 if (package_body_width - courtyard_width < courtyard_clearance_with_package)
00610 {
00611 if (verbose)
00612 {
00613 g_log ("", G_LOG_LEVEL_WARNING,
00614 (_("[%s] DRC Error: check for clearance of the package width with regard to the courtyard dimensions.")),
00615 footprint_type);
00616 }
00617 result = EXIT_FAILURE;
00618 }
00624
00625 if (silkscreen_package_outline && (silkscreen_line_width == 0.0))
00626 {
00627 if (verbose)
00628 {
00629 g_log ("", G_LOG_LEVEL_WARNING,
00630 (_("[%s] DRC Error: line width 0.0 specified for check for a reasonable silk line width.")),
00631 footprint_type);
00632 }
00633 result = EXIT_FAILURE;
00634 }
00635 switch (units_type)
00636 {
00637 case NO_UNITS:
00638 {
00639 if (verbose)
00640 {
00641 g_log ("", G_LOG_LEVEL_WARNING,
00642 (_("[%s] DRC Error: no units specified for check for a reasonable silk line width.")),
00643 footprint_type);
00644 }
00645 result = EXIT_FAILURE;
00646 break;
00647 }
00648 case MIL:
00649 if (silkscreen_package_outline && (silkscreen_line_width > 40.0))
00650 {
00651 if (verbose)
00652 {
00653 g_log ("", G_LOG_LEVEL_WARNING,
00654 (_("[%s] DRC Error: line width > 40.0 mil specified check for a reasonable silk line width.")),
00655 footprint_type);
00656 }
00657 result = EXIT_FAILURE;
00658 break;
00659 }
00660 case MIL_100:
00661 if (silkscreen_package_outline && (silkscreen_line_width > 4000.0))
00662 {
00663 if (verbose)
00664 {
00665 g_log ("", G_LOG_LEVEL_WARNING,
00666 (_("[%s] DRC Error: line width > 40.0 mil specified check for a reasonable silk line width.")),
00667 footprint_type);
00668 }
00669 result = EXIT_FAILURE;
00670 break;
00671 }
00672 case MM:
00673 if (silkscreen_package_outline && (silkscreen_line_width > 1.0))
00674 {
00675 if (verbose)
00676 {
00677 g_log ("", G_LOG_LEVEL_WARNING,
00678 (_("[%s] DRC Error: line width > 1.0 mm specified check for a reasonable silk line width.")),
00679 footprint_type);
00680 }
00681 result = EXIT_FAILURE;
00682 break;
00683 }
00684 default:
00685 {
00686 if (verbose)
00687 {
00688 g_log ("", G_LOG_LEVEL_WARNING,
00689 (_("[%s] DRC Error: no valid units type specified for check for a reasonable silk line width.")),
00690 footprint_type);
00691 }
00692 result = EXIT_FAILURE;
00693 break;
00694 }
00695 }
00696
00697 if (verbose && (result == EXIT_SUCCESS))
00698 {
00699 g_log ("", G_LOG_LEVEL_INFO,
00700 (_("[%s] DRC Check: no errors while checking package %s.")),
00701 footprint_type, footprint_name);
00702 }
00703 return result;
00704 }
00705
00706
00720 int
00721 indm_get_default_footprint_values ()
00722 {
00723 if (!strcmp (footprint_name, "?INDM"))
00724 {
00725 pitch_y = 0.0;
00726 number_of_pins = 2;
00727 package_body_length = 0.0;
00728 package_body_width = 0.0;
00729 package_body_height = 0.0;
00730 package_is_radial = FALSE;
00731 number_of_columns = 0;
00732 number_of_rows = 0;
00733 pitch_x = 0.0;
00734 pad_length = 0.0;
00735 pad_width = 0.0;
00736 pad_shape = g_strdup ("rectangular pad");
00737 pad_shapes_type = SQUARE;
00738 thermal = FALSE;
00739 thermal_length = 0.0;
00740 thermal_width = 0.0;
00741 silkscreen_package_outline = FALSE;
00742 silkscreen_length = 0.0;
00743 silkscreen_width = 0.0;
00744 courtyard_length = 0.0;
00745 courtyard_width = 0.0;
00746 count_x = 0;
00747 count_y = 0;
00748 footprint_units = g_strdup ("mm");
00749 g_free (footprint_name);
00750 footprint_name = g_strdup ("INDM");
00751 return (EXIT_SUCCESS);
00752 }
00753 else
00754 {
00755 if (verbose)
00756 {
00757 g_log ("", G_LOG_LEVEL_WARNING,
00758 _("default values for footprint %s not found.\n"),
00759 footprint_name);
00760 }
00761 return (EXIT_FAILURE);
00762 }
00763 }
00764
00765
00773 #if GUI
00774 int
00775 indm_set_gui_constraints ()
00776 {
00777
00778 GtkWidget *package_is_radial_checkbutton = lookup_widget (GTK_WIDGET (widget),
00779 "package_is_radial_checkbutton");
00780 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (package_is_radial_checkbutton), FALSE);
00781 gtk_widget_set_sensitive (package_is_radial_checkbutton, FALSE);
00782
00783
00784 GtkWidget *number_of_columns_entry = lookup_widget (GTK_WIDGET (widget),
00785 "number_of_columns_entry");
00786 gtk_entry_set_text (GTK_ENTRY (number_of_columns_entry), "2");
00787 gtk_widget_set_sensitive (number_of_columns_entry, FALSE);
00788 GtkWidget *number_of_rows_entry = lookup_widget (GTK_WIDGET (widget),
00789 "number_of_rows_entry");
00790 gtk_entry_set_text (GTK_ENTRY (number_of_rows_entry), "1");
00791 gtk_widget_set_sensitive (number_of_rows_entry, FALSE);
00792 GtkWidget *pitch_y_entry = lookup_widget (GTK_WIDGET (widget),
00793 "pitch_y_entry");
00794 gtk_entry_set_text (GTK_ENTRY (pitch_y_entry), "");
00795 gtk_widget_set_sensitive (pitch_y_entry, FALSE);
00796 GtkWidget *count_x_entry = lookup_widget (GTK_WIDGET (widget),
00797 "count_x_entry");
00798 gtk_entry_set_text (GTK_ENTRY (count_x_entry), "");
00799 gtk_widget_set_sensitive (count_x_entry, FALSE);
00800 GtkWidget *count_y_entry = lookup_widget (GTK_WIDGET (widget),
00801 "count_y_entry");
00802 gtk_entry_set_text (GTK_ENTRY (count_y_entry), "");
00803 gtk_widget_set_sensitive (count_y_entry, FALSE);
00804 GtkWidget *number_1_position_entry = lookup_widget (GTK_WIDGET (widget),
00805 "number_1_position_entry");
00806 gtk_combo_box_set_active (GTK_COMBO_BOX (number_1_position_entry), UPPER_LEFT);
00807 gtk_widget_set_sensitive (number_1_position_entry, FALSE);
00808
00809
00810 gui_constraints_disable_thermal_tab_widgets (widget);
00811
00812
00813 gui_constraints_disable_heel_and_toe_goals_tab_widgets (widget);
00814 return (EXIT_SUCCESS);
00815 }
00816 #endif
00817
00818
00825 int
00826 indm_write_footprint ()
00827 {
00828 gdouble xmax;
00829 gdouble xmin;
00830 gdouble ymax;
00831 gdouble ymin;
00832 gdouble x_text;
00833 gdouble y_text;
00834 gchar *pin_pad_flags = g_strdup ("");
00835
00836
00837 fp = fopen (footprint_filename, "w");
00838 if (!fp)
00839 {
00840 if (verbose)
00841 {
00842 g_log ("", G_LOG_LEVEL_WARNING,
00843 _("could not open file for %s footprint: %s."),
00844 footprint_type, footprint_filename);
00845 }
00846 fclose (fp);
00847 return (EXIT_FAILURE);
00848 }
00849
00850 if (license_in_footprint)
00851 {
00852 write_license ();
00853 }
00854
00855
00856 xmin = multiplier * ((-pitch_x / 2.0) - (pad_length / 2.0) - pad_solder_mask_clearance);
00857 xmax = multiplier * (pitch_x / 2.0 + pad_length / 2.0 + pad_solder_mask_clearance);
00858 ymin = multiplier * ((-pad_width / 2.0) - pad_solder_mask_clearance);
00859 ymax = multiplier * (pad_width / 2.0 + pad_solder_mask_clearance);
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 if (!strcmp (pad_shape, "rectangular pad"))
00902 {
00903 pin_pad_flags = g_strdup ("square");
00904 }
00905 if (pad_length > pad_width)
00906 {
00907
00908 write_pad
00909 (
00910 1,
00911 "P",
00912 multiplier * ((-pitch_x - pad_length + pad_width) / 2.0),
00913 0,
00914 multiplier * ((-pitch_x + pad_length - pad_width) / 2.0),
00915 0,
00916 multiplier * pad_width,
00917 multiplier * pad_clearance,
00918 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00919
00920 (pin1_square) ? "square" : pin_pad_flags
00921 );
00922
00923 write_pad
00924 (
00925 2,
00926 "N",
00927 multiplier * ((pitch_x - pad_length + pad_width) / 2.0),
00928 0,
00929 multiplier * ((pitch_x + pad_length - pad_width) / 2.0),
00930 0,
00931 multiplier * pad_width,
00932 multiplier * pad_clearance,
00933 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00934 pin_pad_flags
00935 );
00936 }
00937 else
00938 {
00939
00940 write_pad
00941 (
00942 1,
00943 "P",
00944 multiplier * (-pitch_x / 2.0),
00945 multiplier * ((pad_width - pad_length) / 2.0),
00946 multiplier * (-pitch_x / 2),
00947 multiplier * ((-pad_width + pad_length) / 2.0),
00948 multiplier * pad_length,
00949 multiplier * pad_clearance,
00950 multiplier * (pad_length + (2 * pad_solder_mask_clearance)),
00951
00952 (pin1_square) ? "square" : pin_pad_flags
00953 );
00954
00955 write_pad
00956 (
00957 2,
00958 "N",
00959 multiplier * (pitch_x / 2.0),
00960 multiplier * ((pad_width - pad_length) / 2.0),
00961 multiplier * (pitch_x / 2.0),
00962 multiplier * ((-pad_width + pad_length) / 2.0),
00963 multiplier * pad_length,
00964 multiplier * pad_clearance,
00965 multiplier * (pad_length + (2 * pad_solder_mask_clearance)),
00966 pin_pad_flags
00967 );
00968 }
00969
00970 if (silkscreen_package_outline && package_body_width)
00971 {
00972 fprintf (fp, "# Write a package body on the silkscreen\n");
00973 if (pad_width >= package_body_width)
00974 {
00975 write_element_line
00976 (
00977 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
00978 multiplier * (package_body_width / 2.0),
00979 multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width),
00980 multiplier * (package_body_width / 2.0),
00981 multiplier * silkscreen_line_width
00982 );
00983 write_element_line
00984 (
00985 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
00986 multiplier * (-package_body_width / 2.0),
00987 multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width),
00988 multiplier * (-package_body_width / 2.0),
00989 multiplier * silkscreen_line_width
00990 );
00991 }
00992 else
00993 {
00994
00995 write_element_line
00996 (
00997 multiplier * (-package_body_length / 2.0),
00998 multiplier * (package_body_width / 2.0),
00999 multiplier * (package_body_length / 2.0),
01000 multiplier * (package_body_width / 2.0),
01001 multiplier * silkscreen_line_width
01002 );
01003 write_element_line
01004 (
01005 multiplier * (-package_body_length / 2.0),
01006 multiplier * (-package_body_width / 2.0),
01007 multiplier * (package_body_length / 2.0),
01008 multiplier * (-package_body_width / 2.0),
01009 multiplier * silkscreen_line_width
01010 );
01011
01012 write_element_line
01013 (
01014 multiplier * (-package_body_length / 2.0),
01015 multiplier * (-package_body_width / 2.0),
01016 multiplier * (-package_body_length / 2.0),
01017 multiplier * (((-pad_width - silkscreen_line_width) / 2.0) - pad_solder_mask_clearance),
01018 multiplier * silkscreen_line_width
01019 );
01020 write_element_line
01021 (
01022 multiplier * (-package_body_length / 2.0),
01023 multiplier * (package_body_width / 2.0),
01024 multiplier * (-package_body_length / 2.0),
01025 multiplier * (((pad_width + silkscreen_line_width) / 2.0) + pad_solder_mask_clearance),
01026 multiplier * silkscreen_line_width
01027 );
01028 write_element_line
01029 (
01030 multiplier * (package_body_length / 2.0),
01031 multiplier * (-package_body_width / 2.0),
01032 multiplier * (package_body_length / 2.0),
01033 multiplier * (((-pad_width - silkscreen_line_width) / 2.0) - pad_solder_mask_clearance),
01034 multiplier * silkscreen_line_width
01035 );
01036 write_element_line
01037 (
01038 multiplier * (package_body_length / 2.0),
01039 multiplier * (package_body_width / 2.0),
01040 multiplier * (package_body_length / 2.0),
01041 multiplier * (((pad_width + silkscreen_line_width) / 2.0) + pad_solder_mask_clearance),
01042 multiplier * silkscreen_line_width
01043 );
01044 }
01045 }
01046
01047 if (silkscreen_indicate_1)
01048 {
01049 fprintf (fp, "# Write a pin 1 marker on the silkscreen\n");
01050 if (pad_width >= package_body_width)
01051 {
01052 write_element_line
01053 (
01054 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
01055 multiplier * (-package_body_width / 2.0),
01056 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
01057 multiplier * (package_body_width / 2.0),
01058 multiplier * silkscreen_line_width
01059 );
01060 }
01061 else
01062 {
01063 write_element_arc
01064 (
01065 multiplier * (((-package_body_length) / 2.0) - 2 * silkscreen_line_width),
01066 multiplier * (-package_body_width / 2.0),
01067 multiplier * 0.5 * silkscreen_line_width,
01068 multiplier * 0.5 * silkscreen_line_width,
01069 0,
01070 360,
01071 multiplier * silkscreen_line_width
01072 );
01073 }
01074 }
01075
01076 if (courtyard)
01077 {
01078 fprintf (fp, "# Write a courtyard on the silkscreen\n");
01079 write_rectangle
01080 (
01081 xmin,
01082 ymin,
01083 xmax,
01084 ymax,
01085 multiplier * courtyard_line_width
01086 );
01087 }
01088
01089 if (attributes_in_footprint)
01090 {
01091 write_attributes ();
01092 }
01093
01094 fprintf (fp, "\n");
01095 fprintf (fp, ")\n");
01096 fclose (fp);
01097
01098 if (verbose)
01099 {
01100 g_log ("", G_LOG_LEVEL_INFO,
01101 _("wrote a footprint for a %s package: %s."),
01102 footprint_type,
01103 footprint_filename);
01104 }
01105 return (EXIT_SUCCESS);
01106 }
01107
01108
01112 static fpw_function_t
01113 indm_function_list[] =
01114 {
01115 #if GUI
01116 {
01117 "Set GUI constraints",
01118 indm_set_gui_constraints,
01119 "Set GUI constraints for an INDM package",
01120 NULL
01121 },
01122 #endif
01123 {
01124 "Create Element",
01125 indm_create_element,
01126 "Create a pcb element for an INDM package",
01127 NULL
01128 },
01129 {
01130 "Create Packages List",
01131 indm_create_packages_list,
01132 "Create a list of known INDM packages",
01133 NULL
01134 },
01135 {
01136 "DRC indm Element",
01137 indm_drc,
01138 "Design Rule Check for an INDM package",
01139 NULL
01140 },
01141 {
01142 "Default Element Values",
01143 indm_get_default_footprint_values,
01144 "Get default values for an INDM package",
01145 NULL
01146 },
01147 {
01148 "Write footprint",
01149 indm_write_footprint,
01150 "Write a footprint for an INDM package",
01151 NULL
01152 }
01153 };
01154
01155
01159 REGISTER_FUNCTIONS (indm_function_list)
01160
01161
01162
01165 void
01166 indm_init ()
01167 {
01168 register_indm_function_list ();
01169 }
01170
01171
01172