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