00001
00026 #include "register_functions.c"
00027 #include "capmp.h"
00028
00029
00036 int
00037 capmp_create_element ()
00038 {
00039 gdouble xmax;
00040 gdouble xmin;
00041 gdouble ymax;
00042 gdouble ymin;
00043 gdouble x_text;
00044 gdouble y_text;
00045 gdouble dx;
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 g_log ("", G_LOG_LEVEL_WARNING,
00055 (_("[%s] could not create a valid element pointer for an element.")),
00056 footprint_type);
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 "N",
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 "P",
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 "N",
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 "P",
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 (_("[%s] created an element for element: %s.")),
00377 footprint_type,
00378 footprint_filename);
00379 }
00380 current_element = (ElementTypePtr) &element;
00381 return (EXIT_SUCCESS);
00382 }
00383
00384
00394 int
00395 capmp_create_packages_list ()
00396 {
00397 g_list_free (packages_list);
00398 packages_list = g_list_append (packages_list, "CAPMP");
00399 return (EXIT_SUCCESS);
00400 }
00401
00402
00432 int
00433 capmp_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: specified package body length is too small.")),
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: specified package body width is too small.")),
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: specified package body height is too small.")),
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: specified courtyard length is too small.")),
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: specified courtyard width is too small.")),
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: minimum clearance between copper (X-direction) is too small.")),
00568 footprint_type);
00569 }
00570 result = EXIT_FAILURE;
00571 }
00572
00573 if (pitch_y != 0.0)
00574 {
00575 if (verbose)
00576 {
00577 g_log ("", G_LOG_LEVEL_WARNING,
00578 (_("[%s] DRC Error: pitch in Y-direction should be 0.")),
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: package should not have a fiducial pad.")),
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: silkscreen line width is too small.")),
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.")),
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: silkscreen line width too wide.")),
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: silkscreen line width too wide.")),
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: silkscreen line width too wide.")),
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.")),
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 capmp_get_default_footprint_values ()
00721 {
00722 if (!strcmp (footprint_name, "?CAPMP"))
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 ("CAPMP");
00750 return (EXIT_SUCCESS);
00751 }
00752 else
00753 {
00754 g_log ("", G_LOG_LEVEL_WARNING,
00755 (_("default values for footprint %s not found.\n")),
00756 footprint_name);
00757 return (EXIT_FAILURE);
00758 }
00759 }
00760
00761
00769 #if GUI
00770 int
00771 capmp_set_gui_constraints ()
00772 {
00773
00774 GtkWidget *package_is_radial_checkbutton = lookup_widget (GTK_WIDGET (widget),
00775 "package_is_radial_checkbutton");
00776 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (package_is_radial_checkbutton), FALSE);
00777 gtk_widget_set_sensitive (package_is_radial_checkbutton, FALSE);
00778
00779
00780 GtkWidget *number_of_columns_entry = lookup_widget (GTK_WIDGET (widget),
00781 "number_of_columns_entry");
00782 gtk_entry_set_text (GTK_ENTRY (number_of_columns_entry), "2");
00783 gtk_widget_set_sensitive (number_of_columns_entry, FALSE);
00784 GtkWidget *number_of_rows_entry = lookup_widget (GTK_WIDGET (widget),
00785 "number_of_rows_entry");
00786 gtk_entry_set_text (GTK_ENTRY (number_of_rows_entry), "1");
00787 gtk_widget_set_sensitive (number_of_rows_entry, FALSE);
00788 GtkWidget *pitch_y_entry = lookup_widget (GTK_WIDGET (widget),
00789 "pitch_y_entry");
00790 gtk_entry_set_text (GTK_ENTRY (pitch_y_entry), "");
00791 gtk_widget_set_sensitive (pitch_y_entry, FALSE);
00792 GtkWidget *count_x_entry = lookup_widget (GTK_WIDGET (widget),
00793 "count_x_entry");
00794 gtk_entry_set_text (GTK_ENTRY (count_x_entry), "");
00795 gtk_widget_set_sensitive (count_x_entry, FALSE);
00796 GtkWidget *count_y_entry = lookup_widget (GTK_WIDGET (widget),
00797 "count_y_entry");
00798 gtk_entry_set_text (GTK_ENTRY (count_y_entry), "");
00799 gtk_widget_set_sensitive (count_y_entry, FALSE);
00800 GtkWidget *number_1_position_entry = lookup_widget (GTK_WIDGET (widget),
00801 "number_1_position_entry");
00802 gtk_combo_box_set_active (GTK_COMBO_BOX (number_1_position_entry), UPPER_LEFT);
00803 gtk_widget_set_sensitive (number_1_position_entry, FALSE);
00804
00805
00806 gui_constraints_disable_thermal_tab_widgets (widget);
00807
00808
00809 gui_constraints_disable_heel_and_toe_goals_tab_widgets (widget);
00810 return (EXIT_SUCCESS);
00811 }
00812 #endif
00813
00814
00821 int
00822 capmp_write_footprint ()
00823 {
00824 gdouble xmax;
00825 gdouble xmin;
00826 gdouble ymax;
00827 gdouble ymin;
00828 gdouble x_text;
00829 gdouble y_text;
00830 gchar *pin_pad_flags = g_strdup ("");
00831
00832
00833 fp = fopen (footprint_filename, "w");
00834 if (!fp)
00835 {
00836 g_log ("", G_LOG_LEVEL_WARNING,
00837 (_("could not open file for %s footprint: %s.")),
00838 footprint_type, footprint_filename);
00839 fclose (fp);
00840 return (EXIT_FAILURE);
00841 }
00842
00843 if (license_in_footprint)
00844 {
00845 write_license ();
00846 }
00847
00848
00849 xmin = multiplier * ((-pitch_x / 2.0) - (pad_length / 2.0) - pad_solder_mask_clearance);
00850 xmax = multiplier * (pitch_x / 2.0 + pad_length / 2.0 + pad_solder_mask_clearance);
00851 ymin = multiplier * ((-pad_width / 2.0) - pad_solder_mask_clearance);
00852 ymax = multiplier * (pad_width / 2.0 + pad_solder_mask_clearance);
00853
00854
00855 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00856 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00857 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00858 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00859 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00860 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00861 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00862 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00863
00864 if (multiplier * (-courtyard_length / 2.0) < xmin)
00865 xmin = multiplier * (-courtyard_length / 2.0);
00866 if (multiplier * (courtyard_length / 2.0) > xmax)
00867 xmax = multiplier * (courtyard_length / 2.0);
00868 if (multiplier * (-courtyard_width / 2.0) < ymin)
00869 ymin = multiplier * (-courtyard_width / 2.0);
00870 if (multiplier * (courtyard_width / 2.0) > ymax)
00871 ymax = multiplier * (courtyard_width / 2.0);
00872
00873
00874 x_text = 0.0 ;
00875 y_text = (ymin - 10000.0);
00876 write_element_header (x_text, y_text);
00877
00878 if (!strcmp (pad_shape, "rectangular pad"))
00879 pin_pad_flags = g_strdup ("square");
00880 if (pad_length > pad_width)
00881 {
00882
00883 write_pad
00884 (
00885 1,
00886 "P",
00887 multiplier * ((-pitch_x - pad_length + pad_width) / 2.0),
00888 0,
00889 multiplier * ((-pitch_x + pad_length - pad_width) / 2.0),
00890 0,
00891 multiplier * pad_width,
00892 multiplier * pad_clearance,
00893 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00894
00895 (pin1_square) ? "square" : pin_pad_flags
00896 );
00897
00898 write_pad
00899 (
00900 2,
00901 "N",
00902 multiplier * ((pitch_x - pad_length + pad_width) / 2.0),
00903 0,
00904 multiplier * ((pitch_x + pad_length - pad_width) / 2.0),
00905 0,
00906 multiplier * pad_width,
00907 multiplier * pad_clearance,
00908 multiplier * (pad_width + (2 * pad_solder_mask_clearance)),
00909 pin_pad_flags
00910 );
00911 }
00912 else
00913 {
00914
00915 write_pad
00916 (
00917 1,
00918 "P",
00919 multiplier * (-pitch_x / 2.0),
00920 multiplier * ((pad_width - pad_length) / 2.0),
00921 multiplier * (-pitch_x / 2),
00922 multiplier * ((-pad_width + pad_length) / 2.0),
00923 multiplier * pad_length,
00924 multiplier * pad_clearance,
00925 multiplier * (pad_length + (2 * pad_solder_mask_clearance)),
00926
00927 (pin1_square) ? "square" : pin_pad_flags
00928 );
00929
00930 write_pad
00931 (
00932 2,
00933 "N",
00934 multiplier * (pitch_x / 2.0),
00935 multiplier * ((pad_width - pad_length) / 2.0),
00936 multiplier * (pitch_x / 2.0),
00937 multiplier * ((-pad_width + pad_length) / 2.0),
00938 multiplier * pad_length,
00939 multiplier * pad_clearance,
00940 multiplier * (pad_length + (2 * pad_solder_mask_clearance)),
00941 pin_pad_flags
00942 );
00943 }
00944
00945 if (silkscreen_package_outline && package_body_width)
00946 {
00947 fprintf (fp, (_("# Write a package body on the silkscreen\n")));
00948 if (pad_width >= package_body_width)
00949 {
00950 write_element_line
00951 (
00952 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
00953 multiplier * (package_body_width / 2.0),
00954 multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width),
00955 multiplier * (package_body_width / 2.0),
00956 multiplier * silkscreen_line_width
00957 );
00958 write_element_line
00959 (
00960 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
00961 multiplier * (-package_body_width / 2.0),
00962 multiplier * (((pitch_x - pad_length) / 2.0) - pad_solder_mask_clearance - silkscreen_line_width),
00963 multiplier * (-package_body_width / 2.0),
00964 multiplier * silkscreen_line_width
00965 );
00966 }
00967 else
00968 {
00969
00970 write_element_line
00971 (
00972 multiplier * (-package_body_length / 2.0),
00973 multiplier * (package_body_width / 2.0),
00974 multiplier * (package_body_length / 2.0),
00975 multiplier * (package_body_width / 2.0),
00976 multiplier * silkscreen_line_width
00977 );
00978 write_element_line
00979 (
00980 multiplier * (-package_body_length / 2.0),
00981 multiplier * (-package_body_width / 2.0),
00982 multiplier * (package_body_length / 2.0),
00983 multiplier * (-package_body_width / 2.0),
00984 multiplier * silkscreen_line_width
00985 );
00986
00987 write_element_line
00988 (
00989 multiplier * (-package_body_length / 2.0),
00990 multiplier * (-package_body_width / 2.0),
00991 multiplier * (-package_body_length / 2.0),
00992 multiplier * (((-pad_width - silkscreen_line_width) / 2.0) - pad_solder_mask_clearance),
00993 multiplier * silkscreen_line_width
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 * (((pad_width + silkscreen_line_width) / 2.0) + pad_solder_mask_clearance),
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 * (((-pad_width - silkscreen_line_width) / 2.0) - pad_solder_mask_clearance),
01009 multiplier * silkscreen_line_width
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 }
01020 }
01021
01022 if (silkscreen_indicate_1)
01023 {
01024 fprintf (fp, (_("# Write a pin 1 marker on the silkscreen\n")));
01025 if (pad_width >= package_body_width)
01026 {
01027 write_element_line
01028 (
01029 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
01030 multiplier * (-package_body_width / 2.0),
01031 multiplier * (((-pitch_x + pad_length) / 2.0) + pad_solder_mask_clearance + silkscreen_line_width),
01032 multiplier * (package_body_width / 2.0),
01033 multiplier * silkscreen_line_width
01034 );
01035 }
01036 else
01037 {
01038 write_element_arc
01039 (
01040 multiplier * (((-package_body_length) / 2.0) - 2 * silkscreen_line_width),
01041 multiplier * (-package_body_width / 2.0),
01042 multiplier * 0.5 * silkscreen_line_width,
01043 multiplier * 0.5 * silkscreen_line_width,
01044 0,
01045 360,
01046 multiplier * silkscreen_line_width
01047 );
01048 }
01049 }
01050
01051 if (courtyard)
01052 {
01053 fprintf (fp, (_("# Write a courtyard on the silkscreen\n")));
01054 write_rectangle
01055 (
01056 xmin,
01057 ymin,
01058 xmax,
01059 ymax,
01060 multiplier * courtyard_line_width
01061 );
01062 }
01063
01064 if (attributes_in_footprint)
01065 {
01066 write_attributes ();
01067 }
01068
01069 fprintf (fp, "\n");
01070 fprintf (fp, ")\n");
01071 fclose (fp);
01072
01073 if (verbose)
01074 {
01075 g_log ("", G_LOG_LEVEL_INFO,
01076 (_("wrote a footprint for a %s package: %s.")),
01077 footprint_type,
01078 footprint_filename);
01079 }
01080 return (EXIT_SUCCESS);
01081 }
01082
01083
01087 static fpw_function_t
01088 capmp_function_list[] =
01089 {
01090 #if GUI
01091 {
01092 "Set GUI constraints",
01093 capmp_set_gui_constraints,
01094 "Set GUI constraints for a CAPMP package",
01095 NULL
01096 },
01097 #endif
01098 {
01099 "Create Element",
01100 capmp_create_element,
01101 "Create a pcb element for a CAPMP package",
01102 NULL
01103 },
01104 {
01105 "Create Packages List",
01106 capmp_create_packages_list,
01107 "Create a list of known CAPMP packages",
01108 NULL
01109 },
01110 {
01111 "DRC CAPMP Element",
01112 capmp_drc,
01113 "Design Rule Check for a CAPMP package",
01114 NULL
01115 },
01116 {
01117 "Default Element Values",
01118 capmp_get_default_footprint_values,
01119 "Get default values for a CAPMP package",
01120 NULL
01121 },
01122 {
01123 "Write footprint",
01124 capmp_write_footprint,
01125 "Write a footprint for a CAPMP package",
01126 NULL
01127 }
01128 };
01129
01130
01134 REGISTER_FUNCTIONS (capmp_function_list)
01135
01136
01137
01140 void
01141 capmp_init ()
01142 {
01143 register_capmp_function_list ();
01144 }
01145
01146
01147