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