#!/usr/bin/perl

# Copyright (C) 2005 John C. Luciani Jr.

# This program may be distributed or modified under the terms of
# version 0.2 of the No-Fee Software License published by
# John C. Luciani Jr.

# Creates a 1/4 Watt resistor

use strict;
use warnings;

use Pcb_8;

my $Pcb = Pcb_8 -> new(debug => 1);

$Pcb -> element_begin(description => 'resistor',
		      output_file => '025W',
		      dim   => 'mils');

# the resistor centroid is at (0,0) and the pins are placed 400 mils
# apart

my $Body_width = 70;          # y direction
my $Body_length = 240;        # x direction
my @Pins = (-200, 0, 200, 0); # x,y pin centers
my $Pin_num = 1;

while (@Pins) {
    my ($x, $y) = splice @Pins, 0, 2;
    $Pcb -> element_add_pin(x => $x, y => $y,
			    thickness  => 55,
			    drill_hole => 35,
			    mask => 10,
			    clearance => 10,
			    pin_number => $Pin_num++);
}

$Pcb -> element_add_rectangle(width => $Body_width,
			      length=> $Body_length,
			      thickness => 10,
			      x => 0,
			      y => 0);

foreach my $sign (-1, 1) {
    $Pcb -> element_add_line(x1 => $sign * $Body_length / 2,
			     y1 => 0,
			     x2 => $sign * ($Body_length / 2 + 30),
			     y2 => 0,
			     thickness => 10);
}


$Pcb -> element_set_text_xy(x => -$Body_length/2,
			    y => -$Body_width/2 - 20);


$Pcb -> element_output();

