def __createMainPad(self):
        pads = []
        if self.size == self.mask_size:
            layers_main = ['F.Cu', 'F.Mask']
        else:
            layers_main = ['F.Cu']
            pads.append(
                Pad(number="",
                    at=self.at,
                    size=self.mask_size,
                    shape=Pad.SHAPE_ROUNDRECT,
                    type=Pad.TYPE_SMT,
                    layers=['F.Mask'],
                    radius_ratio=self.radius_ratio,
                    maximum_radius=self.main_max_radius))

        pads.append(
            Pad(number=self.number,
                at=self.at,
                size=self.size,
                shape=Pad.SHAPE_ROUNDRECT,
                type=Pad.TYPE_SMT,
                layers=layers_main,
                radius_ratio=self.radius_ratio,
                maximum_radius=self.main_max_radius))

        return pads
Ejemplo n.º 2
0
    def _init_base(self):

        # set attributes
        self.setAttribute('virtual')

        # add pads
        small_hole_size = 3.048
        large_hole_size = 3.9878
        top_offset = -6.985
        bottom_offset = 8.225
        offset = self.lu_table[self.size]['offset']
        layers = ['*.Cu', '*.Mask']

        # create pads
        self.append(
            Pad(number="~",
                type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[-offset, top_offset],
                size=small_hole_size,
                drill=small_hole_size,
                layers=layers))
        self.append(
            Pad(number="~",
                type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[offset, top_offset],
                size=small_hole_size,
                drill=small_hole_size,
                layers=layers))
        self.append(
            Pad(number="~",
                type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[-offset, bottom_offset],
                size=large_hole_size,
                drill=large_hole_size,
                layers=layers))
        self.append(
            Pad(number="~",
                type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[offset, bottom_offset],
                size=large_hole_size,
                drill=large_hole_size,
                layers=layers))

        # create reference center point
        self.append(
            Line(start=[0, 2], end=[0, -2], layer='Dwgs.User', width=0.1))
        self.append(
            Line(start=[-2, 0], end=[2, 0], layer='Dwgs.User', width=0.1))
Ejemplo n.º 3
0
    def _createPads(self, **kwargs):

        pads = []

        x_start, y_start = self.startingPosition
        x_spacing, y_spacing = self.spacing

        padShape = kwargs.get('shape')

        # Special case, increment = 0
        # this can be used for creating an array with all the same pad number
        if self.increment == 0:
            pad_numbers = [self.initialPin] * self.pincount

        else:
            pad_numbers = range(
                self.initialPin,
                self.initialPin + (self.pincount * self.increment),
                self.increment)

        for i, number in enumerate(pad_numbers):
            x_pad = x_start + i * x_spacing
            y_pad = y_start + i * y_spacing

            if kwargs.get('type') == Pad.TYPE_THT and number == 1:
                kwargs['shape'] = Pad.SHAPE_RECT
            else:
                kwargs['shape'] = padShape

            pads.append(Pad(number=number, at=[x_pad, y_pad], **kwargs))
        return pads
    def __createVias(self):
        via_layers = ['*.Cu']
        if self.via_tented == ExposedPad.VIA_NOT_TENTED or self.via_tented == ExposedPad.VIA_TENTED_BOTTOM_ONLY:
            via_layers.append('F.Mask')
        if self.via_tented == ExposedPad.VIA_NOT_TENTED or self.via_tented == ExposedPad.VIA_TENTED_TOP_ONLY:
            via_layers.append('B.Mask')

        pads = []
        cy = -((self.via_layout[1] - 1) * self.via_grid[1]) / 2 + self.at.y
        for i in range(self.via_layout[1]):
            pads.append(
                PadArray(center=[self.at.x, cy],
                         initial=self.number,
                         increment=0,
                         pincount=self.via_layout[0],
                         x_spacing=self.via_grid[0],
                         size=self.via_size,
                         type=Pad.TYPE_THT,
                         shape=Pad.SHAPE_CIRCLE,
                         drill=self.via_drill,
                         layers=via_layers))
            cy += self.via_grid[1]

        if self.add_bottom_pad:
            pads.append(
                Pad(number=self.number,
                    at=self.at,
                    size=self.bottom_size,
                    shape=Pad.SHAPE_ROUNDRECT,
                    type=Pad.TYPE_SMT,
                    layers=self.bottom_pad_Layers,
                    radius_ratio=self.radius_ratio,
                    maximum_radius=self.main_max_radius))

        return pads
Ejemplo n.º 5
0
    def add(self,
            x,
            y,
            number=None,
            type=None,
            shape=None,
            size=None,
            x_offset=None,
            y_offset=None):

        if number == None:
            number = self.p
            self.p += 1

        if x_offset == None:
            x_offset = self.x_offset

        if y_offset == None:
            y_offset = self.y_offset

        if shape == None:
            shape = self.shape_first if number == 1 else self.shape

        self.last_pad = Pad(number=number,
                            type=self.type if type == None else type,
                            shape=shape,
                            at=[x + x_offset, y + y_offset],
                            size=self.size if size == None else size,
                            drill=self.drill,
                            layers=self.layers)
        self.footprint.append(self.last_pad)
        return self
Ejemplo n.º 6
0
    def _init_switch(self):
        # create fab outline
        self.append(
            RectLine(start=[-7.75, -6.4],
                     end=[7.75, 6.4],
                     layer='F.Fab',
                     width=0.1))

        # create silkscreen
        self.append(
            RectLine(start=[-7.75, -6.4],
                     end=[7.75, 6.4],
                     layer='F.SilkS',
                     width=0.12,
                     offset=0.1))

        # create courtyard
        self.append(
            RectLine(start=[-7.75, -6.4],
                     end=[7.75, 6.4],
                     layer='F.CrtYd',
                     width=0.05,
                     offset=0.25))

        # create pads
        self.append(
            Pad(number=1,
                type=Pad.TYPE_THT,
                shape=Pad.SHAPE_CIRCLE,
                at=[-2.5, -4],
                size=[2.5, 2.5],
                drill=1.5,
                layers=['*.Cu', 'B.Mask']))
        self.append(
            Pad(number=2,
                type=Pad.TYPE_THT,
                shape=Pad.SHAPE_CIRCLE,
                at=[2.5, -4.5],
                size=[2.5, 2.5],
                drill=1.5,
                layers=['*.Cu', 'B.Mask']))
Ejemplo n.º 7
0
    def _createPads(self, **kwargs):

        pads = []

        x_start, y_start = self.startingPosition
        x_spacing, y_spacing = self.spacing

        padShape = kwargs.get('shape')

        # Special case, increment = 0
        # this can be used for creating an array with all the same pad number
        if self.increment == 0:
            pad_numbers = [self.initialPin] * self.pincount
        elif type(self.increment) == int:
            pad_numbers = range(
                self.initialPin,
                self.initialPin + (self.pincount * self.increment),
                self.increment)
        elif callable(self.increment):
            pad_numbers = [self.initialPin]
            for idx in range(1, self.pincount):
                pad_numbers.append(self.increment(pad_numbers[-1]))
        else:
            raise TypeError(
                "Wrong type for increment. It must be either a int or callable."
            )

        end_pad_params = copy(kwargs)
        if kwargs.get('end_pads_size_reduction'):
            size_reduction = kwargs['end_pads_size_reduction']
            end_pad_params['size'] = toVectorUseCopyIfNumber(
                kwargs.get('size'), low_limit=0)

            delta_size = Vector2D(
                size_reduction.get('x+', 0) + size_reduction.get('x-', 0),
                size_reduction.get('y+', 0) + size_reduction.get('y-', 0))

            end_pad_params['size'] -= delta_size

            delta_pos = Vector2D(
                -size_reduction.get('x+', 0) + size_reduction.get('x-', 0),
                -size_reduction.get('y+', 0) + size_reduction.get('y-', 0)) / 2
        else:
            delta_pos = Vector2D(0, 0)

        for i, number in enumerate(pad_numbers):
            includePad = (i + self.initialPin) not in self.exclude_pin_list
            for exi in self.exclude_pin_list:
                if (i + self.initialPin) == exi:
                    includePad = False

            if includePad:
                current_pad_pos = Vector2D(x_start + i * x_spacing,
                                           y_start + i * y_spacing)
                current_pad_params = copy(kwargs)
                if i == 0 or i == len(pad_numbers) - 1:
                    current_pad_pos += delta_pos
                    current_pad_params = end_pad_params
                if kwargs.get('type') == Pad.TYPE_THT and number == kwargs.get(
                        'tht_pad1_id', 1):
                    current_pad_params['shape'] = kwargs.get(
                        'tht_pad1_shape', Pad.SHAPE_ROUNDRECT)
                    if 'radius_ratio' not in current_pad_params:
                        current_pad_params['radius_ratio'] = 0.25
                    if 'maximum_radius' not in current_pad_params:
                        current_pad_params['maximum_radius'] = 0.25
                else:
                    current_pad_params['shape'] = padShape
                if kwargs.get('chamfer_size'):
                    if i == 0 and 'chamfer_corner_selection_first' in kwargs:
                        pads.append(
                            ChamferedPad(number=number,
                                         at=current_pad_pos,
                                         corner_selection=kwargs.get(
                                             'chamfer_corner_selection_first'),
                                         **current_pad_params))
                        continue
                    if i == len(
                            pad_numbers
                    ) - 1 and 'chamfer_corner_selection_last' in kwargs:
                        pads.append(
                            ChamferedPad(number=number,
                                         at=current_pad_pos,
                                         corner_selection=kwargs.get(
                                             'chamfer_corner_selection_last'),
                                         **current_pad_params))
                        continue
                pads.append(
                    Pad(number=number,
                        at=current_pad_pos,
                        **current_pad_params))

        return pads
Ejemplo n.º 8
0
    def _init_switch(self):
        # create fab outline
        self.append(
            RectLine(start=[-self.choc_mini_w / 2, -self.choc_mini_h / 2],
                     end=[self.choc_mini_w / 2, self.choc_mini_h / 2],
                     layer='F.Fab',
                     width=0.1))

        # create silkscreen
        self.append(
            RectLine(start=[-self.choc_mini_w / 2, -self.choc_mini_h / 2],
                     end=[self.choc_mini_w / 2, self.choc_mini_h / 2],
                     layer='F.SilkS',
                     width=0.12,
                     offset=0.1))

        # create courtyard
        self.append(
            RectLine(start=[-self.choc_mini_w / 2, -self.choc_mini_h / 2],
                     end=[self.choc_mini_w / 2, self.choc_mini_h / 2],
                     layer='F.CrtYd',
                     width=0.05,
                     offset=0.25))

        # center hole
        polyline = [[5.95, -2.9], [-5.9, -2.9], [-5.9, 3], [-2.5, 3],
                    [-2.5, 4.05], [2.05, 4.05], [2.05, 3], [5.95, 3],
                    [5.95, -2.9]]
        self.append(
            PolygoneLine(polygone=polyline, layer='Edge.Cuts', width=0.05))

        # create pads
        self.append(
            Pad(number=1,
                type=Pad.TYPE_THT,
                shape=Pad.SHAPE_CIRCLE,
                at=[2, 5.4],
                size=[1.5, 1.5],
                drill=1.2,
                layers=['*.Cu', 'B.Mask']))
        self.append(
            Pad(number=2,
                type=Pad.TYPE_THT,
                shape=Pad.SHAPE_CIRCLE,
                at=[-4.58, 5.1],
                size=[1.5, 1.5],
                drill=1.2,
                layers=['*.Cu', 'B.Mask']))

        self.append(
            Pad(type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_OVAL,
                at=[-5.29, -4.75],
                size=[1.2, 1.6],
                drill=[0.8, 1.2],
                layers=['*.Cu', '*.Mask']))
        self.append(
            Pad(type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_OVAL,
                at=[5.29, -4.75],
                size=[1.2, 1.6],
                drill=[0.8, 1.2],
                layers=['*.Cu', '*.Mask']))
Ejemplo n.º 9
0
    def _init_switch(self):

        # set attributes
        if self.hotswap is True:
            self.setAttribute('smd')

        # create fab outline
        self.append(
            RectLine(start=[-self.choc_w / 2, -self.choc_h / 2],
                     end=[self.choc_w / 2, self.choc_h / 2],
                     layer='F.Fab',
                     width=0.1))

        # create silkscreen
        self.append(
            RectLine(start=[-self.choc_w / 2, -self.choc_h / 2],
                     end=[self.choc_w / 2, self.choc_h / 2],
                     layer='F.SilkS',
                     width=0.12,
                     offset=0.1))

        # create courtyard
        self.append(
            RectLine(start=[-self.choc_w / 2, -self.choc_h / 2],
                     end=[self.choc_w / 2, self.choc_h / 2],
                     layer='F.CrtYd',
                     width=0.05,
                     offset=0.25))

        if self.hotswap is True:
            # socket outline
            # TODO: this outline is incorrect
            polyline_base = [
                [6.75, -2.25],
                [6.25, -1.75],
                [3.5, -1.75],
                [1.25, -4],
                [-1.25, -4],
                [-1.75, -4.5],
            ]

            polyline_base2 = [
                [-1.75, -7.5],
                [-1.25, -8],
                [1.25, -8],
                [3.5, -5.75],
                [6.25, -5.75],
                [6.75, -5.25],
            ]

            # create fab outline (socket)
            self.append(
                PolygoneLine(polygone=polyline_base, layer='B.Fab', width=0.1))
            self.append(
                PolygoneLine(polygone=polyline_base2, layer='B.Fab',
                             width=0.1))

            # create silkscreen (socket)
            # TODO: offset 0.1
            self.append(
                PolygoneLine(polygone=polyline_base,
                             layer='B.SilkS',
                             width=0.12))
            self.append(
                PolygoneLine(polygone=polyline_base2,
                             layer='B.SilkS',
                             width=0.12))

            # create courtyard (socket)
            # TODO: offset 0.25
            polyline = polyline_base + polyline_base2
            polyline.append(polyline_base[0])
            self.append(
                PolygoneLine(polygone=polyline, layer='B.CrtYd', width=0.05))

        # create pads
        if self.hotswap is True:
            if self.hotswap_plated is True:
                self.append(
                    Pad(number=1,
                        type=Pad.TYPE_THT,
                        shape=Pad.SHAPE_CIRCLE,
                        at=[0, -5.9],
                        size=[3.6, 3.6],
                        drill=3.05,
                        layers=['*.Cu', 'B.Mask']))
                self.append(
                    Pad(number=2,
                        type=Pad.TYPE_THT,
                        shape=Pad.SHAPE_CIRCLE,
                        at=[5, -3.8],
                        size=[3.6, 3.6],
                        drill=3.05,
                        layers=['*.Cu', 'B.Mask']))

                self.append(
                    Pad(number=1,
                        type=Pad.TYPE_SMT,
                        shape=Pad.SHAPE_ROUNDRECT,
                        at=[-2.85, -6],
                        size=[3.85, 2.5],
                        round_radius_exact=0.25,
                        layers=['B.Cu']))
                self.append(
                    Pad(number=2,
                        type=Pad.TYPE_SMT,
                        shape=Pad.SHAPE_ROUNDRECT,
                        at=[7.85, -3.8],
                        size=[3.85, 2.5],
                        round_radius_exact=0.25,
                        layers=['B.Cu']))

                self.append(
                    Pad(type=Pad.TYPE_SMT,
                        shape=Pad.SHAPE_ROUNDRECT,
                        at=[-3.5, -6],
                        size=[2.55, 2.5],
                        round_radius_exact=0.25,
                        layers=['B.Mask', 'B.Paste']))
                self.append(
                    Pad(type=Pad.TYPE_SMT,
                        shape=Pad.SHAPE_ROUNDRECT,
                        at=[8.5, -3.8],
                        size=[2.55, 2.5],
                        round_radius_exact=0.25,
                        layers=['B.Mask', 'B.Paste']))

                self.append(
                    Pad(type=Pad.TYPE_THT,
                        shape=Pad.SHAPE_CIRCLE,
                        at=[-5, 5.15],
                        size=[2.6, 2.6],
                        drill=1.6,
                        layers=['*.Cu', 'B.Mask']))

            else:
                self.append(
                    Pad(type=Pad.TYPE_NPTH,
                        shape=Pad.SHAPE_CIRCLE,
                        at=[0, -5.9],
                        size=[3.05, 3.05],
                        drill=3.05,
                        layers=['*.Cu', '*.Mask']))
                self.append(
                    Pad(type=Pad.TYPE_NPTH,
                        shape=Pad.SHAPE_CIRCLE,
                        at=[5, -3.8],
                        size=[3.05, 3.05],
                        drill=3.05,
                        layers=['*.Cu', '*.Mask']))

                self.append(
                    Pad(number=1,
                        type=Pad.TYPE_SMT,
                        shape=Pad.SHAPE_ROUNDRECT,
                        at=[-3.5, -6],
                        size=[2.55, 2.5],
                        round_radius_exact=0.25,
                        layers=['B.Cu', 'B.Mask', 'B.Paste']))
                self.append(
                    Pad(number=2,
                        type=Pad.TYPE_SMT,
                        shape=Pad.SHAPE_ROUNDRECT,
                        at=[8.5, -3.8],
                        size=[2.55, 2.5],
                        round_radius_exact=0.25,
                        layers=['B.Cu', 'B.Mask', 'B.Paste']))

                self.append(
                    Pad(type=Pad.TYPE_NPTH,
                        shape=Pad.SHAPE_CIRCLE,
                        at=[-5, 5.15],
                        size=[1.6, 1.6],
                        drill=1.6,
                        layers=['*.Cu', '*.Mask']))
        else:
            self.append(
                Pad(number=1,
                    type=Pad.TYPE_THT,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[0, -5.9],
                    size=[2.2, 2.2],
                    drill=1.2,
                    layers=['*.Cu', 'B.Mask']))
            self.append(
                Pad(number=2,
                    type=Pad.TYPE_THT,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[5, -3.8],
                    size=[2.2, 2.2],
                    drill=1.2,
                    layers=['*.Cu', 'B.Mask']))

        if self.switch_type == 'V1':
            self.append(
                Pad(type=Pad.TYPE_NPTH,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[0, 0],
                    size=[3.45, 3.45],
                    drill=3.45,
                    layers=['*.Cu', '*.Mask']))
        else:  # V2 or V1V2
            self.append(
                Pad(type=Pad.TYPE_NPTH,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[0, 0],
                    size=[5.05, 5.05],
                    drill=5.05,
                    layers=['*.Cu', '*.Mask']))

        if self.switch_type in ['V1', 'V1V2']:
            self.append(
                Pad(type=Pad.TYPE_NPTH,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[-5.5, 0],
                    size=[1.9, 1.9],
                    drill=1.9,
                    layers=['*.Cu', '*.Mask']))
            self.append(
                Pad(type=Pad.TYPE_NPTH,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[5.5, 0],
                    size=[1.9, 1.9],
                    drill=1.9,
                    layers=['*.Cu', '*.Mask']))

        if self.switch_type in ['V2', 'V1V2']:
            if self.hotswap is False or self.hotswap_plated is True:
                self.append(
                    Pad(type=Pad.TYPE_THT,
                        shape=Pad.SHAPE_CIRCLE,
                        at=[-5, 5.15],
                        size=[2.6, 2.6],
                        drill=1.6,
                        layers=['*.Cu', 'B.Mask']))
            else:
                self.append(
                    Pad(type=Pad.TYPE_NPTH,
                        shape=Pad.SHAPE_CIRCLE,
                        at=[-5, 5.15],
                        size=[1.6, 1.6],
                        drill=1.6,
                        layers=['*.Cu', '*.Mask']))
Ejemplo n.º 10
0
    def _init_switch(self):

        # Models
        if self.model3d is not None:
            filename = self.model3d
            if self.path3d is not None:
                filename = path.join(self.path3d, filename)

            self.append(
                Model(filename=filename,
                      at=[0, 0, 0],
                      scale=[1, 1, 1],
                      rotate=[0, 0, 0]))
        else:
            filename1 = 'SW_Cherry_MX_PCB.wrl'
            filename2 = 'SW_Alps_Matias.wrl'

            if self.path3d is not None:
                filename1 = path.join(self.path3d, filename1)
                filename2 = path.join(self.path3d, filename2)

            self.append(
                Model(filename=filename1,
                      at=[0, 0, 0],
                      scale=[1, 1, 1],
                      rotate=[0, 0, 0]))
            self.append(
                Model(filename=filename2,
                      at=[0, 0, 0],
                      scale=[1, 1, 1],
                      rotate=[0, 0, 0]))

        base_polyline = [[-self.cherry_w / 2, -self.cherry_h / 2],
                         [self.cherry_w / 2, -self.cherry_h / 2],
                         [self.cherry_w / 2, -self.alps_h / 2],
                         [self.alps_w / 2, -self.alps_h / 2],
                         [self.alps_w / 2, self.alps_h / 2],
                         [self.cherry_w / 2, self.alps_h / 2],
                         [self.cherry_w / 2, self.cherry_h / 2],
                         [-self.cherry_w / 2, self.cherry_h / 2],
                         [-self.cherry_w / 2, self.alps_h / 2],
                         [-self.alps_w / 2, self.alps_h / 2],
                         [-self.alps_w / 2, -self.alps_h / 2],
                         [-self.cherry_w / 2, -self.alps_h / 2],
                         [-self.cherry_w / 2, -self.cherry_h / 2]]

        # create fab outline
        self.append(
            PolygoneLine(polygone=base_polyline, layer='F.Fab', width=0.1))

        # create silkscreen outline
        polyline = util.offset_polyline(base_polyline, 0.1)
        self.append(
            PolygoneLine(polygone=polyline, layer='F.SilkS', width=0.12))

        # create courtyard outline
        polyline = util.offset_polyline(base_polyline, 0.25)
        self.append(
            PolygoneLine(polygone=polyline, layer='F.CrtYd', width=0.05))

        # create pads
        self.append(
            Pad(number=1,
                type=Pad.TYPE_THT,
                shape=Pad.SHAPE_CIRCLE,
                at=[-2.5, -4],
                size=[2.5, 2.5],
                drill=1.5,
                layers=['*.Cu', 'B.Mask']))
        self.append(
            Pad(number=1,
                type=Pad.TYPE_THT,
                shape=Pad.SHAPE_OVAL,
                at=[-3.81, -2.54],
                size=[4.46156, 2.5],
                rotation=48,
                offset=[0.980778, 0],
                drill=1.5,
                layers=['*.Cu', 'B.Mask']))
        self.append(
            Pad(number=2,
                type=Pad.TYPE_THT,
                shape=Pad.SHAPE_OVAL,
                at=[2.52, -4.79],
                size=[3.081378, 2.5],
                drill=[2.08137, 1.5],
                rotation=86,
                layers=['*.Cu', 'B.Mask']))
        self.append(
            Pad(type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[0, 0],
                size=[4, 4],
                drill=4,
                layers=['*.Cu', '*.Mask']))
        self.append(
            Pad(type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[-5.08, 0],
                size=[1.75, 1.75],
                drill=1.75,
                layers=['*.Cu', '*.Mask']))
        self.append(
            Pad(type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[5.08, 0],
                size=[1.75, 1.75],
                drill=1.75,
                layers=['*.Cu', '*.Mask']))
Ejemplo n.º 11
0
    def _init_switch(self):

        # create fab outline
        self.append(
            RectLine(start=[-self.cherry_w / 2, -self.cherry_h / 2],
                     end=[self.cherry_w / 2, self.cherry_h / 2],
                     layer='F.Fab',
                     width=0.1))

        # create silkscreen
        self.append(
            RectLine(start=[-self.cherry_w / 2, -self.cherry_h / 2],
                     end=[self.cherry_w / 2, self.cherry_h / 2],
                     layer='F.SilkS',
                     width=0.12,
                     offset=0.1))

        # create courtyard
        self.append(
            RectLine(start=[-self.cherry_w / 2, -self.cherry_h / 2],
                     end=[self.cherry_w / 2, self.cherry_h / 2],
                     layer='F.CrtYd',
                     width=0.05,
                     offset=0.25))
        # create pads
        self.append(
            Pad(number=1,
                type=Pad.TYPE_THT,
                shape=Pad.SHAPE_CIRCLE,
                at=[-3.81, -2.54],
                size=[2.5, 2.5],
                drill=1.5,
                layers=['*.Cu', 'B.Mask']))
        self.append(
            Pad(number=2,
                type=Pad.TYPE_THT,
                shape=Pad.SHAPE_CIRCLE,
                at=[2.54, -5.08],
                size=[2.5, 2.5],
                drill=1.5,
                layers=['*.Cu', 'B.Mask']))
        self.append(
            Pad(type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[0, 0],
                size=[4, 4],
                drill=4,
                layers=['*.Cu', '*.Mask']))

        if self.switch_type == 'PCB':
            self.append(
                Pad(type=Pad.TYPE_NPTH,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[-5.08, 0],
                    size=[1.75, 1.75],
                    drill=1.75,
                    layers=['*.Cu', '*.Mask']))
            self.append(
                Pad(type=Pad.TYPE_NPTH,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[5.08, 0],
                    size=[1.75, 1.75],
                    drill=1.75,
                    layers=['*.Cu', '*.Mask']))
Ejemplo n.º 12
0
    def _init_switch(self):

        # set attributes
        self.setAttribute('smd')

        # create fab outline (keyswitch)
        self.append(
            RectLine(start=[-self.kailh_hs_w / 2, -self.kailh_hs_h / 2],
                     end=[self.kailh_hs_w / 2, self.kailh_hs_h / 2],
                     layer='F.Fab',
                     width=0.1))

        # create fab outline (socket)
        self.append(
            Line(start=[-4, -6.8], end=[4.8, -6.8], layer='B.Fab', width=0.12))
        self.append(
            Line(start=[4.8, -6.8], end=[4.8, -2.8], layer='B.Fab',
                 width=0.12))
        self.append(
            Line(start=[-0.3, -2.8],
                 end=[4.8, -2.8],
                 layer='B.Fab',
                 width=0.12))
        self.append(
            Line(start=[-6, -0.8], end=[-2.3, -0.8], layer='B.Fab',
                 width=0.12))
        self.append(
            Line(start=[-6, -0.8], end=[-6, -4.8], layer='B.Fab', width=0.12))
        self.append(
            Arc(center=[-4, -4.8],
                start=[-4, -6.8],
                angle=-90,
                layer='B.Fab',
                width=0.12))
        self.append(
            Arc(center=[-0.3, -0.8],
                start=[-0.3, -2.8],
                angle=-90,
                layer='B.Fab',
                width=0.12))

        # create silkscreen (keyswitch)
        self.append(
            RectLine(start=[-self.kailh_hs_w / 2, -self.kailh_hs_h / 2],
                     end=[self.kailh_hs_w / 2, self.kailh_hs_h / 2],
                     layer='F.SilkS',
                     width=0.12,
                     offset=0.1))

        # create silkscreen (socket)
        self.append(
            Line(start=[-4.1, -6.9],
                 end=[1, -6.9],
                 layer='B.SilkS',
                 width=0.12))
        self.append(
            Line(start=[-0.2, -2.7],
                 end=[4.9, -2.7],
                 layer='B.SilkS',
                 width=0.12))
        self.append(
            Arc(center=[-4.1, -4.9],
                start=[-4.1, -6.9],
                angle=-90,
                layer='B.SilkS',
                width=0.12))
        self.append(
            Arc(center=[-0.2, -0.7],
                start=[-0.2, -2.7],
                angle=-90,
                layer='B.SilkS',
                width=0.12))

        # create courtyard (keyswitch)
        self.append(
            RectLine(start=[-self.kailh_hs_w / 2, -self.kailh_hs_h / 2],
                     end=[self.kailh_hs_w / 2, self.kailh_hs_h / 2],
                     layer='F.CrtYd',
                     width=0.05,
                     offset=0.25))

        # create courtyard (socket)
        # !TODO: add KLC correct offset (0.25)
        self.append(
            Line(start=[-4, -6.8],
                 end=[4.8, -6.8],
                 layer='B.CrtYd',
                 width=0.05))
        self.append(
            Line(start=[4.8, -6.8],
                 end=[4.8, -2.8],
                 layer='B.CrtYd',
                 width=0.05))
        self.append(
            Line(start=[-0.3, -2.8],
                 end=[4.8, -2.8],
                 layer='B.CrtYd',
                 width=0.05))
        self.append(
            Line(start=[-6, -0.8],
                 end=[-2.3, -0.8],
                 layer='B.CrtYd',
                 width=0.05))
        self.append(
            Line(start=[-6, -0.8], end=[-6, -4.8], layer='B.CrtYd',
                 width=0.05))
        self.append(
            Arc(center=[-4, -4.8],
                start=[-4, -6.8],
                angle=-90,
                layer='B.CrtYd',
                width=0.05))
        self.append(
            Arc(center=[-0.3, -0.8],
                start=[-0.3, -2.8],
                angle=-90,
                layer='B.CrtYd',
                width=0.05))

        # create pads
        if self.plated_th is True:
            self.append(
                Pad(number=1,
                    type=Pad.TYPE_THT,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[-3.81, -2.54],
                    size=[3.6, 3.6],
                    drill=3.05,
                    layers=['*.Cu', 'B.Mask']))
            self.append(
                Pad(number=2,
                    type=Pad.TYPE_THT,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[2.54, -5.08],
                    size=[3.6, 3.6],
                    drill=3.05,
                    layers=['*.Cu', 'B.Mask']))

            self.append(
                Pad(number=1,
                    type=Pad.TYPE_SMT,
                    shape=Pad.SHAPE_ROUNDRECT,
                    at=[-6.585, -2.54],
                    size=[3.55, 2.5],
                    round_radius_exact=0.25,
                    layers=['B.Cu']))
            self.append(
                Pad(number=2,
                    type=Pad.TYPE_SMT,
                    shape=Pad.SHAPE_ROUNDRECT,
                    at=[5.32, -5.08],
                    size=[3.55, 2.5],
                    round_radius_exact=0.25,
                    layers=['B.Cu']))

            self.append(
                Pad(type=Pad.TYPE_SMT,
                    shape=Pad.SHAPE_ROUNDRECT,
                    at=[-7.085, -2.54],
                    size=[2.55, 2.5],
                    round_radius_exact=0.25,
                    layers=['B.Mask', 'B.Paste']))
            self.append(
                Pad(type=Pad.TYPE_SMT,
                    shape=Pad.SHAPE_ROUNDRECT,
                    at=[5.842, -5.08],
                    size=[2.55, 2.5],
                    round_radius_exact=0.25,
                    layers=['B.Mask', 'B.Paste']))
        else:
            self.append(
                Pad(type=Pad.TYPE_NPTH,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[-3.81, -2.54],
                    size=[3.05, 3.05],
                    drill=3.05,
                    layers=['*.Cu', '*.Mask']))
            self.append(
                Pad(type=Pad.TYPE_NPTH,
                    shape=Pad.SHAPE_CIRCLE,
                    at=[2.54, -5.08],
                    size=[3.05, 3.05],
                    drill=3.05,
                    layers=['*.Cu', '*.Mask']))

            self.append(
                Pad(number=1,
                    type=Pad.TYPE_SMT,
                    shape=Pad.SHAPE_ROUNDRECT,
                    at=[-7.085, -2.54],
                    size=[2.55, 2.5],
                    round_radius_exact=0.25,
                    layers=['B.Cu', 'B.Mask', 'B.Paste']))
            self.append(
                Pad(number=2,
                    type=Pad.TYPE_SMT,
                    shape=Pad.SHAPE_ROUNDRECT,
                    at=[5.842, -5.08],
                    size=[2.55, 2.5],
                    round_radius_exact=0.25,
                    layers=['B.Cu', 'B.Mask', 'B.Paste']))

        self.append(
            Pad(type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[0, 0],
                size=[4, 4],
                drill=4,
                layers=['*.Cu', '*.Mask']))
        self.append(
            Pad(type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[-5.08, 0],
                size=[1.75, 1.75],
                drill=1.75,
                layers=['*.Cu', '*.Mask']))
        self.append(
            Pad(type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[5.08, 0],
                size=[1.75, 1.75],
                drill=1.75,
                layers=['*.Cu', '*.Mask']))
Ejemplo n.º 13
0
    def _init_switch(self):
        # create fab outline
        self.append(
            RectLine(start=[-self.kailh_nb_w / 2, -self.kailh_nb_h / 2],
                     end=[self.kailh_nb_w / 2, self.kailh_nb_h / 2],
                     layer='F.Fab',
                     width=0.1))

        # create silkscreen
        self.append(
            RectLine(start=[-self.kailh_nb_w / 2, -self.kailh_nb_h / 2],
                     end=[self.kailh_nb_w / 2, self.kailh_nb_h / 2],
                     layer='F.SilkS',
                     width=0.12,
                     offset=0.1))

        # create courtyard
        self.append(
            RectLine(start=[-self.kailh_nb_w / 2, -self.kailh_nb_h / 2],
                     end=[self.kailh_nb_w / 2, self.kailh_nb_h / 2],
                     layer='F.CrtYd',
                     width=0.05,
                     offset=0.25))

        # center hole
        self.append(
            RectLine(start=[1.1, -2.5],
                     end=[-2.9, 2.5],
                     layer='Edge.Cuts',
                     width=0.05))

        # create pads
        self.append(
            Pad(number=1,
                type=Pad.TYPE_THT,
                shape=Pad.SHAPE_CIRCLE,
                at=[-2, -3.4],
                size=[1.4, 1.4],
                drill=1.1,
                layers=['*.Cu', 'B.Mask']))
        self.append(
            Pad(number=2,
                type=Pad.TYPE_THT,
                shape=Pad.SHAPE_CIRCLE,
                at=[2.9, -3.4],
                size=[1.4, 1.4],
                drill=1.1,
                layers=['*.Cu', 'B.Mask']))

        self.append(
            Pad(type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[5.5, -5.50],
                size=[1.3, 1.3],
                drill=1.3,
                layers=['*.Cu', '*.Mask']))
        self.append(
            Pad(type=Pad.TYPE_NPTH,
                shape=Pad.SHAPE_CIRCLE,
                at=[-5.5, 5.5],
                size=[1.3, 1.3],
                drill=1.3,
                layers=['*.Cu', '*.Mask']))