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