Wow! I just visited your footprint website. There is a *ton* of stuff there! Amazing!
Thank you for providing this valuable resource! Some questions: * Are you thinking about asking the PCB guys to bundle this with the PCB distribution, or do you prefer to keep in on your web page alone? * Do you mind if I put a reference to your site in my next spin of the Newlib footprint doc? Stuart > > I have released a Perl module that can be > used to create PCB elements. An example > program is listed below. I have also > placed my footprint library on my website. > > The Perl module and documentation is at > http://www.luciani.org/geda/pcb-footprint.html > > The footprint library is at > http://www.luciani.org/geda/pcb-footprint-list.html > > The documentation is sparse. I will add > to the documentation as I release more examples. > The documentation is best viewed using acroread in > Full Screen mode. In xpdf the Full Screen > button doesn't seem to work. Also the external > hyperlinks in the Bibliography seem to be > broken. > > > > -------------------- cut here --------------------- > #!/usr/bin/perl > > # Creates the PCB elements for Molex 8624 header > # connectors from 4 to 20 circuits. > > use strict; > use warnings; > > use Pcb_3; > > my $Pcb = Pcb_3 -> new(debug => 1); > > my @Fields = qw(circuits body_length pin_row_length); > > my @Def; # definitions that are common to all > components > > while () { > s/\#.*//; # Remove comments > s/^\s*//; # Remove leading spaces > s/\s*$//; # Revove trailing spaces > next unless length; # Skip empty lines > > # Lines that contain an '=' are global > definitions. > > push(@Def, $1, $2), next if /(\S+)\s*=\s*(\S.*)/; > > my @values = split /\s*\|\s*/; > > # hash for each footprint > > my %f = ( @Def, > map { $_ => shift(@values) } @Fields); > > $Pcb -> element_begin(description => 'TH', > output_file => "tmp/" . > > &package_name($f{package_prefix}, > > $f{circuits}, > > $f{pin_rows}), > input_dim => 'mils', > pin_one_square => 1); > > my $pin_num = 1; > my $pins_per_row = $f{circuits} / 2; > > # lower left corner is pin one > > my $x = -$f{pin_spacing} * ($pins_per_row - 1) / > 2; > my $y = $f{row_spacing} / 2; > > # These header connectors consist of two rows of > pins. > # With pin one in the lower left corner we will > place > # pins from left to right until half the pins are > # placed. At the halfway point we will shift to > the > # top row and place pins from right to left. > > while ($pin_num <= $f{circuits}) { > $Pcb -> element_add_pin(x => $x, y => $y, > thickness => 66, > drill_hole => 46, > pin_number => $pin_num); > > # If this is the last pin in the row then > # update the y value otherwise update the x > # value. If we are past the halfway point move > # left (-) instead of right (+). > > if ($pin_num == $pins_per_row) { > $y -= $f{row_spacing}; > } else { > $x += $pin_num > $pins_per_row > ? -$f{pin_spacing} > : $f{pin_spacing}; > } > $pin_num++; > } > > $Pcb -> element_add_rectangle(width => > $f{body_width}, > length=> $f{body_length}, > x => 0, > y => 0); > > > $Pcb -> element_set_text_xy(x => > -$f{body_length}/2, > y => -$f{body_width}/2 - 20); > > > $Pcb -> element_output(); > } > > sub package_name ($$$) { > my ($prefix, $circuits, $rows) = @_; > sprintf("%s-%ix%i", $prefix, $circuits/$rows, > $rows); > } > > > __DATA__ > > package_prefix = header-Molex-8624 > body_width = 200 > pin_spacing = 100 > row_spacing = 100 > pin_diameter = 35 > pin_rows = 2 > > # circuits | body_length | pin_row_length > > 4 | 190 | 100 > 6 | 290 | 200 > 8 | 390 | 300 > 10 | 490 | 400 > 12 | 590 | 500 > 14 | 690 | 600 > 16 | 790 | 700 > 18 | 890 | 800 > 20 | 990 | 900 > > >
