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