diff --git a/AUTHORS.md b/AUTHORS.md index f69f136a1..0fd7bc467 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,8 +1,7 @@ **Maintainer:** * Thomas Pointhuber @pointhi -* Rene Pöschl, @poeschlr -* @evanshultz + **Contributors:** @@ -10,13 +9,15 @@ People who have submitted patches, reported bugs, consulted features or generall * Oliver, @SchrodingersGat * Jan W. Krieger, @jkriege2 +* Rene Pöschl, @poeschlr * Frank, @Frankkkkk * @Hackscribble * @stoth * Patrick Pelletier, @ppelleti * @DASFrank * Dominik Baack, @matyro -* Jordi Pakey-Rodriguez, @0xdec +* Jordi Orlando, @0xdec +* @evanshultz * George, @grob6000 * Tobias Müller, @twam * Terje Io, @terjeio @@ -26,58 +27,3 @@ People who have submitted patches, reported bugs, consulted features or generall * Trevor Vannoy, @tvannoy * Kari Hautio, @kh4 * Stefan, @Misca1234 -* Antonio Vazquez, @antoniovazquezblanco -* Hendrik v. Raven, @lorem-ipsum -* Asuki Kono, @asukiaaa -* Xathar, @jneiva08 -* @matthuszagh -* @ferdymercury -* @jhalmen -* @herostrat -* @fauxpark -* @matthijskooijman -* Clara Hobbs, @Ratfink -* @MRQ -* Stefan Krüger, @s-light -* John Whitmore, @johnfwhitmore -* Daniel Mack, @zonque -* @dominformant -* @tpambor -* @nivekg -* Joel, @myfreescalewebpage -* JonRB, @eeyrjmr -* Alexander Ransmann, @cronJ -* Christian Schlüter, @chschlue -* Chase Patterson, @chapatt -* Rolf Schäuble, @rschaeuble -* @penoud -* @ki5libs -* @fvollmer -* @cp-aquila -* Anders Wallin, @aewallin -* Jonas Schievink, @jonas-schievink -* Diego Herranz, @diegoherranz -* Alexandre Oliveira, @RockyTV -* Konstantin Oblaukhov, @ObKo -* Jesper, @JeppeSRC -* Jacob E. F. Overgaard @JacobEFO -* Ed Peguillan III, @yankee14 -* Thomas Schmid, @rckTom -* @mitch354 -* Jan Krueger, @einball -* @dogtopus -* Darrell Harmon, @dlharmon -* David Imhoff, @dimhoff -* marble, @cyber-murmel -* @chemicstry -* @awygle -* @TiZed -* Sean Leavey, @SeanDS -* @Schlumpf -* Daniel Giesbrecht, @DanSGiesbrecht -* Caleb Reister, @calebreister -* Greg Cormier, @gcormier -* Ilya Elenskiy, @EvilMav -* Mathias Walter, @tolot27 -* Michael Munch, @Munken -* @waschhauser diff --git a/KicadModTree/KicadFileHandler.py b/KicadModTree/KicadFileHandler.py index a4104d99a..4372dea1d 100644 --- a/KicadModTree/KicadFileHandler.py +++ b/KicadModTree/KicadFileHandler.py @@ -186,7 +186,7 @@ def _serialize_Arc(self, node): def _serialize_CirclePoints(self, node): center_pos = node.getRealPosition(node.center_pos) - end_pos = node.getRealPosition(node.center_pos + (node.radius, 0)) + end_pos = node.getRealPosition(node.end_pos) return [ ['center', center_pos.x, center_pos.y], @@ -238,16 +238,13 @@ def _serialize_Text(self, node): sexpr.append('hide') sexpr.append(SexprSerializer.NEW_LINE) - effects = [ - 'effects', - ['font', - ['size', node.size.x, node.size.y], - ['thickness', node.thickness]]] - - if node.mirror: - effects.append(['justify', 'mirror']) - - sexpr.append(effects) + sexpr.append(['effects', + ['font', + ['size', node.size.x, node.size.y], + ['thickness', node.thickness] + ] + ] + ) # NOQA sexpr.append(SexprSerializer.NEW_LINE) return sexpr diff --git a/KicadModTree/PolygonPoints.py b/KicadModTree/PolygonPoints.py index 0f05c925f..172cf00dc 100644 --- a/KicadModTree/PolygonPoints.py +++ b/KicadModTree/PolygonPoints.py @@ -143,37 +143,6 @@ def cut(self, other): self.nodes.insert(idx_self+1, other[idx_other]) - def rotate(self, angle, origin=(0, 0), use_degrees=True): - r""" Rotate points around given origin - - :params: - * *angle* (``float``) - rotation angle - * *origin* (``Vector2D``) - origin point for the rotation. default: (0, 0) - * *use_degrees* (``boolean``) - rotation angle is given in degrees. default:True - """ - - for p in self.nodes: - p.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - return self - - def translate(self, distance_vector): - r""" Translate points - - :params: - * *distance_vector* (``Vector2D``) - 2D vector defining by how much and in what direction to translate. - """ - - for p in self.nodes: - p += distance_vector - return self - - def __copy__(self): - return PolygonPoints(nodes=self.nodes) - def __iter__(self): for n in self.nodes: yield n diff --git a/KicadModTree/Vector.py b/KicadModTree/Vector.py index cd97873c1..65c0ef1a5 100644 --- a/KicadModTree/Vector.py +++ b/KicadModTree/Vector.py @@ -19,7 +19,7 @@ import warnings from KicadModTree.util.kicad_util import formatFloat -from math import sqrt, sin, cos, hypot, atan2, degrees, radians +from math import sqrt class Vector2D(object): @@ -85,8 +85,7 @@ def distance_to(self, value): :return: distance between self and other point """ other = Vector2D.__arithmetic_parse(value) - d = other - self - return hypot(d.x, d.y) + return sqrt((other.x - self.x)**2 + (other.y - self.y)**2) @staticmethod def __arithmetic_parse(value): @@ -192,90 +191,6 @@ def __iter__(self): def __copy__(self): return Vector2D(self.x, self.y) - def rotate(self, angle, origin=(0, 0), use_degrees=True): - r""" Rotate vector around given origin - - :params: - * *angle* (``float``) - rotation angle - * *origin* (``Vector2D``) - origin point for the rotation. default: (0, 0) - * *use_degrees* (``boolean``) - rotation angle is given in degrees. default:True - """ - - op = Vector2D(origin) - - if use_degrees: - angle = radians(angle) - - temp = op.x + cos(angle) * (self.x - op.x) - sin(angle) * (self.y - op.y) - self.y = op.y + sin(angle) * (self.x - op.x) + cos(angle) * (self.y - op.y) - self.x = temp - - return self - - def to_polar(self, origin=(0, 0), use_degrees=True): - r""" Get polar representation of the vector - - :params: - * *origin* (``Vector2D``) - origin point for polar conversion. default: (0, 0) - * *use_degrees* (``boolean``) - angle in degrees. default:True - """ - - op = Vector2D(origin) - - diff = self - op - radius = hypot(diff.x, diff.y) - - angle = atan2(diff.y, diff.x) - if use_degrees: - angle = degrees(angle) - - return (radius, angle) - - @staticmethod - def from_polar(radius, angle, origin=(0, 0), use_degrees=True): - r""" Generate a vector from its polar representation - - :params: - * *radius* (``float``) - lenght of the vector - * *angle* (``float``) - angle of the vector - * *origin* (``Vector2D``) - origin point for polar conversion. default: (0, 0) - * *use_degrees* (``boolean``) - angle in degrees. default:True - """ - - if use_degrees: - angle = radians(angle) - - x = radius * cos(angle) - y = radius * sin(angle) - - return Vector2D({'x': x, 'y': y})+Vector2D(origin) - - def to_homogeneous(self): - r""" Get homogeneous representation - """ - - return Vector3D(self.x, self.y, 1) - - @staticmethod - def from_homogeneous(source): - r""" Recover 2d vector from its homogeneous representation - - :params: - * *source* (``Vector3D``) - 3d homogeneous representation - """ - - return Vector2D(source.x/source.z, source.y/source.z) - class Vector3D(Vector2D): r"""Representation of a 3D Vector in space @@ -349,19 +264,6 @@ def round_to(self, base): return Vector3D([round(v / base) * base for v in self]) - def cross_product(self, other): - other = Vector3D.__arithmetic_parse(other) - - return Vector3D({ - 'x': self.y*other.z - self.z*other.y, - 'y': self.z*other.x - self.x*other.z, - 'z': self.x*other.y - self.y*other.x}) - - def dot_product(self, other): - other = Vector3D.__arithmetic_parse(other) - - return self.x*other.x + self.y*other.y + self.z*other.z - @staticmethod def __arithmetic_parse(value): if isinstance(value, Vector3D): diff --git a/KicadModTree/nodes/base/Arc.py b/KicadModTree/nodes/base/Arc.py index a738104d2..6b5af6dcb 100644 --- a/KicadModTree/nodes/base/Arc.py +++ b/KicadModTree/nodes/base/Arc.py @@ -16,29 +16,19 @@ from KicadModTree.Vector import * from KicadModTree.nodes.Node import Node import math -from KicadModTree.util.geometric_util import geometricArc, BaseNodeIntersection -class Arc(Node, geometricArc): +class Arc(Node): r"""Add an Arc to the render tree :param \**kwargs: See below :Keyword Arguments: - * *geometry* (``geometricArc``) - alternative to using geometric parameters * *center* (``Vector2D``) -- center of arc * *start* (``Vector2D``) -- start point of arc - * *midpoint* (``Vector2D``) -- - alternative to start point - point is on arc and defines point of equal distance to both arc ends - arcs of this form are given as midpoint, center plus angle - * *end* (``Vector2D``) -- - alternative to angle - arcs of this form are given as start, end and center * *angle* (``float``) -- angle of arc * *layer* (``str``) -- @@ -54,34 +44,13 @@ class Arc(Node, geometricArc): def __init__(self, **kwargs): Node.__init__(self) - geometricArc.__init__(self, **kwargs) + self.center_pos = Vector2D(kwargs['center']) + self.start_pos = Vector2D(kwargs['start']) + self.angle = kwargs['angle'] self.layer = kwargs.get('layer', 'F.SilkS') self.width = kwargs.get('width') - def copyReplaceGeometry(self, geometry): - return Arc(geometry=geometry, layer=self.layer, width=self.width) - - def copy(self): - return Arc( - center=self.center_pos, start=self.start_pos, angle=self.angle, - layer=self.layer, width=self.width - ) - - def cut(self, *other): - r""" cut line with given other element - - :params: - * *other* (``Line``, ``Circle``, ``Arc``) - cut the element on any intersection with the given geometric element - """ - result = [] - garcs = geometricArc.cut(self, *other) - for g in garcs: - result.append(self.copyReplaceGeometry(g)) - - return result - def calculateBoundingBox(self): # TODO: finish implementation min_x = min(self.start_pos.x, self._calulateEndPos().x) @@ -107,6 +76,25 @@ def calculateBoundingBox(self): return Node.calculateBoundingBox({'min': Vector2D((min_x, min_y)), 'max': Vector2D((max_x, max_y))}) + def _calulateEndPos(self): + radius = self._calculateRadius() + + angle = self._calculateStartAngle() + math.radians(self.angle) + + return Vector2D(math.sin(angle)*radius, math.cos(angle)*radius) + + def _calculateRadius(self): + x_size = self.start_pos.x - self.center_pos.x + y_size = self.start_pos.y - self.center_pos.y + + return math.sqrt(math.pow(x_size, 2) + math.pow(y_size, 2)) + + def _calculateStartAngle(self): + x_size = self.start_pos.x - self.center_pos.x + y_size = self.start_pos.y - self.center_pos.y + + return math.atan2(y_size, x_size) + def _getRenderTreeText(self): render_strings = ['fp_arc'] render_strings.append(self.center_pos.render('(center {x} {y})')) diff --git a/KicadModTree/nodes/base/Circle.py b/KicadModTree/nodes/base/Circle.py index def7fc3e0..1a6eb6dbe 100644 --- a/KicadModTree/nodes/base/Circle.py +++ b/KicadModTree/nodes/base/Circle.py @@ -15,10 +15,9 @@ from KicadModTree.Vector import * from KicadModTree.nodes.Node import Node -from KicadModTree.util.geometric_util import geometricCircle, BaseNodeIntersection -class Circle(Node, geometricCircle): +class Circle(Node): r"""Add a Circle to the render tree :param \**kwargs: @@ -42,43 +41,14 @@ class Circle(Node, geometricCircle): def __init__(self, **kwargs): Node.__init__(self) - geometricCircle.__init__(self, Vector2D(kwargs['center']), float(kwargs['radius'])) + self.center_pos = Vector2D(kwargs['center']) + self.radius = kwargs['radius'] + + self.end_pos = Vector2D([self.center_pos.x+self.radius, self.center_pos.y]) self.layer = kwargs.get('layer', 'F.SilkS') self.width = kwargs.get('width') - def rotate(self, angle, origin=(0, 0), use_degrees=True): - r""" Rotate circle around given origin - - :params: - * *angle* (``float``) - rotation angle - * *origin* (``Vector2D``) - origin point for the rotation. default: (0, 0) - * *use_degrees* (``boolean``) - rotation angle is given in degrees. default:True - """ - - self.center_pos.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - return self - - def translate(self, distance_vector): - r""" Translate circle - - :params: - * *distance_vector* (``Vector2D``) - 2D vector defining by how much and in what direction to translate. - """ - - self.center_pos += distance_vector - return self - - def cut(self, *other): - raise NotImplemented("cut for circles not yet implemented") - - def getRadius(self): - return self.radius - def calculateBoundingBox(self): min_x = self.center_pos.x-self.radius min_y = self.center_pos.y-self.radius diff --git a/KicadModTree/nodes/base/Line.py b/KicadModTree/nodes/base/Line.py index 8672c9b1a..8eba5d409 100644 --- a/KicadModTree/nodes/base/Line.py +++ b/KicadModTree/nodes/base/Line.py @@ -15,10 +15,9 @@ from KicadModTree.Vector import * from KicadModTree.nodes.Node import Node -from KicadModTree.util.geometric_util import geometricLine, BaseNodeIntersection -class Line(Node, geometricLine): +class Line(Node): r"""Add a Line to the render tree :param \**kwargs: @@ -42,44 +41,22 @@ class Line(Node, geometricLine): def __init__(self, **kwargs): Node.__init__(self) - if 'geometry' in kwargs: - geometry = kwargs['geometry'] - geometricLine.__init__(self, geometry.start_pos, geometry.end_pos) - else: - geometricLine.__init__( - self, - start=Vector2D(kwargs['start']), - end=Vector2D(kwargs['end']) - ) + self.start_pos = Vector2D(kwargs['start']) + self.end_pos = Vector2D(kwargs['end']) self.layer = kwargs.get('layer', 'F.SilkS') self.width = kwargs.get('width') - def copyReplaceGeometry(self, geometry): - return Line( - start=geometry.start_pos, end=geometry.end_pos, - layer=self.layer, width=self.width - ) - - def copy(self): - return Line( - start=self.start_pos, end=self.end_pos, - layer=self.layer, width=self.width - ) - - def cut(self, *other): - r""" cut line with given other element + def calculateBoundingBox(self): + render_start_pos = self.getRealPosition(self.start_pos) + render_end_pos = self.getRealPosition(self.end_pos) - :params: - * *other* (``Line``, ``Circle``, ``Arc``) - cut the element on any intersection with the given geometric element - """ - result = [] - glines = geometricLine.cut(self, *other) - for g in glines: - result.append(self.copyReplaceGeometry(g)) + min_x = min([render_start_pos.x, render_end_pos.x]) + min_y = min([render_start_pos.y, render_end_pos.y]) + max_x = max([render_start_pos.x, render_end_pos.x]) + max_y = max([render_start_pos.y, render_end_pos.y]) - return result + return Node.calculateBoundingBox({'min': Vector2D(min_x, min_y), 'max': Vector2D(max_x, max_y)}) def _getRenderTreeText(self): render_strings = ['fp_line'] @@ -92,14 +69,3 @@ def _getRenderTreeText(self): render_text += ' ({})'.format(' '.join(render_strings)) return render_text - - def calculateBoundingBox(self): - render_start_pos = self.getRealPosition(self.start_pos) - render_end_pos = self.getRealPosition(self.end_pos) - - min_x = min([render_start_pos.x, render_end_pos.x]) - min_y = min([render_start_pos.y, render_end_pos.y]) - max_x = max([render_start_pos.x, render_end_pos.x]) - max_y = max([render_start_pos.y, render_end_pos.y]) - - return Node.calculateBoundingBox({'min': Vector2D(min_x, min_y), 'max': Vector2D(max_x, max_y)}) diff --git a/KicadModTree/nodes/base/Pad.py b/KicadModTree/nodes/base/Pad.py index e3d92dd85..a501e9ae7 100644 --- a/KicadModTree/nodes/base/Pad.py +++ b/KicadModTree/nodes/base/Pad.py @@ -241,36 +241,6 @@ def _initShapeInZone(self, **kwargs): raise ValueError('{shape} is an illegal specifier for the shape in zone option' .format(shape=self.shape_in_zone)) - def rotate(self, angle, origin=(0, 0), use_degrees=True): - r""" Rotate pad around given origin - - :params: - * *angle* (``float``) - rotation angle - * *origin* (``Vector2D``) - origin point for the rotation. default: (0, 0) - * *use_degrees* (``boolean``) - rotation angle is given in degrees. default:True - """ - - self.at.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - a = angle if use_degrees else math.degrees(angle) - - # subtraction because kicad text field rotation is the wrong way round - self.rotation -= a - return self - - def translate(self, distance_vector): - r""" Translate pad - - :params: - * *distance_vector* (``Vector2D``) - 2D vector defining by how much and in what direction to translate. - """ - - self.at += distance_vector - return self - # calculate the outline of a pad def calculateBoundingBox(self): return Node.calculateBoundingBox(self) diff --git a/KicadModTree/nodes/base/Polygon.py b/KicadModTree/nodes/base/Polygon.py index b91981e04..cb1be1986 100644 --- a/KicadModTree/nodes/base/Polygon.py +++ b/KicadModTree/nodes/base/Polygon.py @@ -49,32 +49,6 @@ def __init__(self, **kwargs): self.layer = kwargs.get('layer', 'F.SilkS') self.width = kwargs.get('width') - def rotate(self, angle, origin=(0, 0), use_degrees=True): - r""" Rotate polygon around given origin - - :params: - * *angle* (``float``) - rotation angle - * *origin* (``Vector2D``) - origin point for the rotation. default: (0, 0) - * *use_degrees* (``boolean``) - rotation angle is given in degrees. default:True - """ - - self.nodes.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - return self - - def translate(self, distance_vector): - r""" Translate polygon - - :params: - * *distance_vector* (``Vector2D``) - 2D vector defining by how much and in what direction to translate. - """ - - self.nodes.translate(distance_vector) - return self - def calculateBoundingBox(self): return nodes.calculateBoundingBox() diff --git a/KicadModTree/nodes/base/Text.py b/KicadModTree/nodes/base/Text.py index ff8921785..64b686a7f 100644 --- a/KicadModTree/nodes/base/Text.py +++ b/KicadModTree/nodes/base/Text.py @@ -32,8 +32,6 @@ class Text(Node): position of text * *rotation* (``float``) -- rotation of text (default: 0) - * *mirror* (``bool``) -- - mirror text (default: False) * *layer* (``str``) -- layer on which the text is drawn (default: 'F.SilkS') * *size* (``Vector2D``) -- @@ -50,19 +48,12 @@ class Text(Node): >>> Text(type='value', text="footprint name", at=[0, 3], layer='F.Fab') """ - TYPE_REFERENCE = 'reference' - TYPE_VALUE = 'value' - TYPE_USER = 'user' - _TYPES = [TYPE_REFERENCE, TYPE_VALUE, TYPE_USER] - def __init__(self, **kwargs): Node.__init__(self) - self._initType(**kwargs) - + self.type = kwargs['type'] self.text = kwargs['text'] self.at = Vector2D(kwargs['at']) self.rotation = kwargs.get('rotation', 0) - self.mirror = kwargs.get('mirror', False) self.layer = kwargs.get('layer', 'F.SilkS') self.size = Vector2D(kwargs.get('size', [1, 1])) @@ -70,41 +61,6 @@ def __init__(self, **kwargs): self.hide = kwargs.get('hide', False) - def _initType(self, **kwargs): - self.type = kwargs['type'] - if self.type not in Text._TYPES: - raise ValueError('Illegal type selected for text field.') - - def rotate(self, angle, origin=(0, 0), use_degrees=True): - r""" Rotate text around given origin - - :params: - * *angle* (``float``) - rotation angle - * *origin* (``Vector2D``) - origin point for the rotation. default: (0, 0) - * *use_degrees* (``boolean``) - rotation angle is given in degrees. default:True - """ - - self.at.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - a = angle if use_degrees else math.degrees(angle) - - # subtraction because kicad text field rotation is the wrong way round - self.rotation -= a - return self - - def translate(self, distance_vector): - r""" Translate text - - :params: - * *distance_vector* (``Vector2D``) - 2D vector defining by how much and in what direction to translate. - """ - - self.at += distance_vector - return self - def calculateBoundingBox(self): width = len(self.text)*self.size['x'] height = self.size['y'] diff --git a/KicadModTree/nodes/specialized/ExposedPad.py b/KicadModTree/nodes/specialized/ExposedPad.py index 922292552..242fb4f9b 100644 --- a/KicadModTree/nodes/specialized/ExposedPad.py +++ b/KicadModTree/nodes/specialized/ExposedPad.py @@ -206,7 +206,7 @@ def __viasInMaskCount(self, idx): if (self.via_layout[idx]-1)*self.via_grid[idx] <= self.paste_area_size[idx]: return self.via_layout[idx] else: - return int(self.paste_area_size[idx]//(self.via_grid[idx])) + return self.paste_area_size[idx]//(self.via_grid[idx]) def _initPasteForAvoidingVias(self, **kwargs): self.via_clarance = kwargs.get('via_paste_clarance', 0.05) diff --git a/KicadModTree/nodes/specialized/RingPad.py b/KicadModTree/nodes/specialized/RingPad.py deleted file mode 100644 index 50e688237..000000000 --- a/KicadModTree/nodes/specialized/RingPad.py +++ /dev/null @@ -1,458 +0,0 @@ -# KicadModTree is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# KicadModTree is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with kicad-footprint-generator. If not, see < http://www.gnu.org/licenses/ >. -# -# (C) 2016 by Thomas Pointhuber, -# (C) 2018 by Rene Poeschl, github @poeschlr -from __future__ import division - -from copy import copy -from KicadModTree.nodes.Node import Node -from KicadModTree.util.paramUtil import * -from KicadModTree.util.geometric_util import geometricArc, geometricLine, BaseNodeIntersection -from KicadModTree.Vector import * -from KicadModTree.nodes.base.Pad import Pad -from KicadModTree.nodes.base.Circle import Circle -from KicadModTree.nodes.base.Arc import Arc -from KicadModTree.nodes.base.Line import Line -from math import sqrt, sin, cos, pi, ceil - - -class RingPadPrimitive(Node): - r"""Add a RingPad to the render tree - - :param \**kwargs: - See below - - :Keyword Arguments: - * *radius*: (``float``) -- - middle radius of the ring - * *width*: (``float``) -- - width of the ring (outer radius - inner radius) - * *at*: (``Vector2D``) -- - position of the center - * *layers*: (``Pad.Layers``) -- - layers used for creating the pad - * *number* (``int``, ``str``) -- - number/name of the pad (default: \"\") - """ - - def __init__(self, **kwargs): - Node.__init__(self) - self.at = Vector2D(kwargs.get('at', (0, 0))) - self.radius = float(kwargs['radius']) - self.width = float(kwargs['width']) - self.layers = kwargs['layers'] - self.number = kwargs.get('number', "") - - def copy(self): - return RingPadPrimitive( - at=self.at, radius=self.radius, - width=self.width, layers=self.layers, - number=self.number - ) - - def getVirtualChilds(self): - return [Pad(number=self.number, - type=Pad.TYPE_SMT, shape=Pad.SHAPE_CUSTOM, - at=(self.at+Vector2D(self.radius, 0)), - size=self.width, layers=self.layers, - primitives=[Circle( - center=(-self.radius, 0), - radius=self.radius, - width=self.width - )] - )] - - -class ArcPadPrimitive(Node): - r"""Add a RingPad to the render tree - - :param \**kwargs: - See below - - :Keyword Arguments: - * *number* (``int``, ``str``) -- - number/name of the pad (default: \"\") - * *width* (``float``) -- - width of the pad - * *layers* (``Pad.Layers``) -- - layers on which are used for the pad - * *round_radius_ratio* (``float``) -- - round radius. - default: 25\% of ring width - * *max_round_radius* (``float``) -- - maximum round radius, default: 0.25 - Use none to ignore - * *reference_arc* (``geometricArc``) -- - the reference arc used for this pad - * *start_line* (``geometricLine``) -- - line confining the side near the reference points start point - * *end_line* (``geometricLine``) -- - line confining the side near the reference points end point - * *minimum_overlap* (``float``) - minimum overlap. default 0.1 - """ - - def __init__(self, **kwargs): - Node.__init__(self) - self.reference_arc = geometricArc(geometry=kwargs['reference_arc']) - self.width = float(kwargs['width']) - - self.number = kwargs.get('number', "") - self.layers = kwargs['layers'] - self.minimum_overlap = kwargs.get('minimum_overlap', 0.1) - - self.setRoundRadius(**kwargs) - self.setLimitingLines(**kwargs) - - def setRoundRadius(self, **kwargs): - if 'round_radius' in kwargs: - self.round_radius = kwargs['round_radius'] - return - - round_radius_ratio = kwargs.get('round_radius_ratio', 0.25) - max_round_radius = kwargs.get('max_round_radius', 0.25) - r = self.width*round_radius_ratio - if max_round_radius is not None and max_round_radius > 0: - self.round_radius = min(r, max_round_radius) - - def setLimitingLines(self, **kwargs): - if kwargs.get('start_line') is not None: - self.start_line = geometricLine(geometry=kwargs.get('start_line')) - else: - self.start_line = None - if kwargs.get('end_line') is not None: - self.end_line = geometricLine(geometry=kwargs.get('end_line')) - else: - self.end_line = None - - def copy(self): - return ArcPadPrimitive( - reference_arc=self.reference_arc, - width=self.width, - round_radius=self.round_radius, - number=self.number, - layers=self.layers, - start_line=self.start_line, - end_line=self.end_line, - minimum_overlap=self.minimum_overlap - ) - - def rotate(self, angle, origin=(0, 0), use_degrees=True): - r""" Rotate around given origin - - :params: - * *angle* (``float``) - rotation angle - * *origin* (``Vector2D``) - origin point for the rotation. default: (0, 0) - * *use_degrees* (``boolean``) - rotation angle is given in degrees. default:True - """ - - self.reference_arc.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - if self.start_line is not None: - self.start_line.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - if self.end_line is not None: - self.end_line.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - return self - - def translate(self, distance_vector): - r""" Translate - - :params: - * *distance_vector* (``Vector2D``) - 2D vector defining by how much and in what direction to translate. - """ - - self.reference_arc.translate(distance_vector) - if self.start_line is not None: - self.start_line.translate(distance_vector) - if self.end_line is not None: - self.end_line.translate(distance_vector) - return self - - def _getStep(self): - line_width = self.round_radius*2 - if self.minimum_overlap >= line_width: - raise ValueError('arc line width (round radius) too small for requested overlap') - - required_arcs = ceil((self.width-self.minimum_overlap) / (line_width-self.minimum_overlap)) - return (self.width-line_width)/(required_arcs-1) - - def _getArcPrimitives(self): - line_width = self.round_radius*2 - step = self._getStep() - - r_inner = self.reference_arc.getRadius()-self.width/2+line_width/2 - r_outer = self.reference_arc.getRadius()+self.width/2-line_width/2 - - ref_arc = Arc(geometry=self.reference_arc, width=line_width).setRadius(r_outer) - - nodes = [] - r = r_inner - while r < r_outer: - nodes.append(ref_arc.copy().setRadius(r)) - r += step - nodes.append(ref_arc) - - if self.start_line is not None: - nodes = self.__cutArcs(nodes, self.start_line, 1) - if self.end_line is not None: - nodes = self.__cutArcs(nodes, self.end_line, 0) - nodes.append(Line(start=nodes[0].getEndPoint(), end=nodes[-1].getEndPoint(), width=line_width)) - nodes.append(Line(start=nodes[0].getStartPoint(), end=nodes[-2].getStartPoint(), width=line_width)) - - return nodes - - def __cutArcs(self, arcs, line, index_to_keep): - if line is None: - return arcs - result = [] - for current_arc in arcs: - try: - result.append(current_arc.cut(line)[index_to_keep]) - except IndexError as e: - raise ValueError("Cutting the arc primitive with one of its endlines " + - "did not result in the expected number of arcs.") - return result - - def getVirtualChilds(self): - at = self.reference_arc.getMidPoint() - primitives = self._getArcPrimitives() - for p in primitives: - p.translate(-at) - return [Pad( - number=self.number, - type=Pad.TYPE_SMT, shape=Pad.SHAPE_CUSTOM, - at=at, size=self.width/2, layers=self.layers, - primitives=primitives - )] - - -class RingPad(Node): - r"""Add a RingPad to the render tree - - :param \**kwargs: - See below - - :Keyword Arguments: - * *number* (``int``, ``str``) -- - number/name of the pad (default: \"\") - * *at* (``Vector2D``) -- - center position of the pad - * *rotation* (``float``) -- - rotation of the pad - * *inner_diameter* (``float``) -- - diameter of the copper free inner zone - * *size* (``float``) -- - outside diameter of the pad - * *num_anchors* (``int``) -- - number of anchor pads around the circle - * *num_paste_zones* (``int``) -- - number of paste zones - * *paste_to_paste_clearance* (``float``) -- - clearance between two paste zones, - needed only if number of paste zones > 1 - default: 2*abs(solder_paste_margin) - * *paste_round_radius_radio* (``float``) -- - round over radius ratio. default 0.25 - resulting radius must be larger than minimum overlap - * *paste_max_round_radius* (``float``) -- - maximum round radius. - Only used if number of paste zones > 1 - default: 0.25 - set to None to ignore - * *solder_paste_margin* (``float``) -- - solder paste margin of the pad (default: 0) - * *paste_outer_diameter* (``float``) -- - together with paste inner diameter an alternative for defining the paste area - * *paste_inner_diameter* (``float``) -- - together with paste outer diameter an alternative for defining the paste area - * *solder_mask_margin* (``float``) -- - solder mask margin of the pad (default: 0) - * *minimum_overlap* (``float``) -- - minimum arc overlap. default 0.1 - """ - - def __init__(self, **kwargs): - Node.__init__(self) - self.solder_mask_margin = kwargs.get('solder_mask_margin', 0) - self.minimum_overlap = kwargs.get('minimum_overlap', 0.1) - self._initPosition(**kwargs) - self._initSize(**kwargs) - self._initNumber(**kwargs) - self._initPasteSettings(**kwargs) - self._initNumAnchor(**kwargs) - self._generatePads() - - def _initSize(self, **kwargs): - _id = kwargs.get('inner_diameter') - _od = kwargs.get('size') - if _od is None or _id is None: - raise KeyError('pad size or inside diameter not declared (like "size=1, inner_diameter=0.5")') - if type(_id) not in [int, float] or type(_od) not in [int, float]: - raise ValueError('ring pad size and inner_diameter only support int or float') - if _id >= _od: - raise ValueError('inner diameter must be larger than size') - - self.radius = (_id+_od)/4 - self.width = (_od-_id)/2 - self.size = _od - self.is_circle = _id == 0 - - def _initNumber(self, **kwargs): - self.number = kwargs.get('number', "") # default to an un-numbered pad - - def _initNumAnchor(self, **kwargs): - self.num_anchor = int(kwargs.get('num_anchor', 1)) - if self.num_anchor < 1: - raise ValueError('num_anchor must be a positive integer') - - def _initPosition(self, **kwargs): - if 'at' not in kwargs: - raise KeyError('center position not declared (like "at=[0,0]")') - self.at = Vector2D(kwargs.get('at')) - - def _initPasteSettings(self, **kwargs): - self.solder_paste_margin = kwargs.get('solder_paste_margin', 0) - if 'paste_outer_diameter' in kwargs and 'paste_inner_diameter' in kwargs: - self.paste_width = (kwargs['paste_outer_diameter'] - kwargs['paste_inner_diameter'])/2 - self.paste_center = (kwargs['paste_outer_diameter'] + kwargs['paste_inner_diameter'])/4 - else: - self.paste_width = self.width + 2*self.solder_paste_margin - self.paste_center = self.radius - - self.num_paste_zones = int(kwargs.get('num_paste_zones', 1)) - if self.num_paste_zones < 1: - raise ValueError('num_paste_zones must be a positive integer') - - if self.num_paste_zones > 1: - self.paste_max_round_radius = float(kwargs.get('paste_max_round_radius', 0.25)) - self.paste_round_radius_radio = float( - kwargs.get('paste_round_radius_radio', 0.25)) - - self.paste_to_paste_clearance = kwargs.get('paste_to_paste_clearance') - if self.paste_to_paste_clearance is None: - self.paste_to_paste_clearance = -self.solder_paste_margin - - if self.paste_round_radius_radio <= 0: - raise ValueError('paste_round_radius_radio must be > 0') - if self.paste_max_round_radius is not None and self.paste_max_round_radius <= 0: - raise ValueError('paste_max_round_radius must be > 0') - - if self.paste_to_paste_clearance <= 0: - raise ValueError('paste_to_paste_clearance must be > 0') - - def _generatePads(self): - self.pads = [] - if self.num_paste_zones > 1: - layers = ['F.Cu', 'F.Mask'] - self._generatePastePads() - else: - layers = ['F.Cu', 'F.Mask', 'F.Paste'] - - if not self.is_circle: - self._generateCopperPads() - else: - self.pads.append( - Pad(number=self.number, - type=Pad.TYPE_SMT, shape=Pad.SHAPE_CIRCLE, - at=(self.at), size=self.size, - layers=layers - )) - - def _generatePastePads(self): - ref_angle = 360/self.num_paste_zones - - ref_arc = geometricArc( - center=self.at, - start=self.at+(self.paste_center, 0), - angle=ref_angle) - - pad = ArcPadPrimitive( - number="", width=self.paste_width, - round_radius_ratio=self.paste_round_radius_radio, - max_round_radius=self.paste_max_round_radius, - layers=['F.Paste'], reference_arc=ref_arc, - minimum_overlap=self.minimum_overlap - ) - - w = pad.round_radius*2 - y = (self.paste_to_paste_clearance + w)/2 - - start_line = geometricLine(start=self.at+(0, y), end=self.at+(1, y)) - end_line = geometricLine(start=self.at+(0, -y), end=self.at+(1, -y)).rotate(ref_angle, origin=self.at) - - if self.num_paste_zones == 2: - end_line = None - - pad.setLimitingLines(start_line=start_line, end_line=end_line) - - self.pads.append(pad) - for i in range(1, self.num_paste_zones): - self.pads.append(pad.copy().rotate(i*ref_angle, origin=self.at)) - - def _generateMaskPads(self): - w = self.width+2*self.solder_mask_margin - self.pads.append( - RingPadPrimitive( - number="", - at=self.at, - width=self.width+2*self.solder_mask_margin, - layers=['F.Mask'], - radius=self.radius - )) - - def _generateCopperPads(self): - # kicad_mod.append(c) - layers = ['F.Cu'] - if self.num_paste_zones == 1: - if self.solder_paste_margin == 0: - layers.append('F.Paste') - else: - self.pads.append( - RingPadPrimitive( - number="", - at=self.at, - width=self.width+2*self.solder_paste_margin, - layers=['F.Paste'], - radius=self.radius - )) - - if self.solder_mask_margin == 0: - # bug in kicad so any clearance other than 0 needs a workaround - layers.append('F.Mask') - else: - self._generateMaskPads() - self.pads.append( - RingPadPrimitive( - number=self.number, - at=self.at, - width=self.width, - layers=layers, - radius=self.radius - )) - - a = 360/self.num_anchor - pos = Vector2D(self.radius, 0) - for i in range(1, self.num_anchor): - pos.rotate(a) - self.pads.append(Pad(number=self.number, - type=Pad.TYPE_SMT, shape=Pad.SHAPE_CIRCLE, - at=(self.at+pos), size=self.width-0.0001, - layers=['F.Cu'], - )) - - def getVirtualChilds(self): - return self.pads diff --git a/KicadModTree/nodes/specialized/__init__.py b/KicadModTree/nodes/specialized/__init__.py index b651603d9..9e51790db 100644 --- a/KicadModTree/nodes/specialized/__init__.py +++ b/KicadModTree/nodes/specialized/__init__.py @@ -25,4 +25,3 @@ from .ExposedPad import ExposedPad from .ChamferedPad import ChamferedPad, CornerSelection from .ChamferedPadGrid import * -from .RingPad import RingPad diff --git a/KicadModTree/tests/datatypes/test_Vector2D.py b/KicadModTree/tests/datatypes/test_Vector2D.py index 00661297b..0124f8241 100644 --- a/KicadModTree/tests/datatypes/test_Vector2D.py +++ b/KicadModTree/tests/datatypes/test_Vector2D.py @@ -14,7 +14,7 @@ # (C) 2018 by Thomas Pointhuber, import unittest -import math + from KicadModTree.Vector import * @@ -162,32 +162,3 @@ def test_div(self): # TODO: division by zero tests # TODO: invalid type tests - - def test_polar(self): - p1 = Vector2D.from_polar(math.sqrt(2), 45, use_degrees=True) - self.assertAlmostEqual(p1.x, 1) - self.assertAlmostEqual(p1.y, 1) - - p1 = Vector2D.from_polar(2, -90, use_degrees=True, origin=(6, 1)) - self.assertAlmostEqual(p1.x, 6) - self.assertAlmostEqual(p1.y, -1) - - r, a = p1.to_polar(use_degrees=True, origin=(6, 1)) - self.assertAlmostEqual(r, 2) - self.assertAlmostEqual(a, -90) - - p1.rotate(90, use_degrees=True, origin=(6, 1)) - self.assertAlmostEqual(p1.x, 8) - self.assertAlmostEqual(p1.y, 1) - - p1 = Vector2D.from_polar(math.sqrt(2), 135, use_degrees=True) - self.assertAlmostEqual(p1.x, -1) - self.assertAlmostEqual(p1.y, 1) - - p1.rotate(90, use_degrees=True) - self.assertAlmostEqual(p1.x, -1) - self.assertAlmostEqual(p1.y, -1) - - r, a = p1.to_polar(use_degrees=True) - self.assertAlmostEqual(r, math.sqrt(2)) - self.assertAlmostEqual(a, -135) diff --git a/KicadModTree/tests/moduletests/__init__.py b/KicadModTree/tests/moduletests/__init__.py index 87c008fe9..ec07c3380 100644 --- a/KicadModTree/tests/moduletests/__init__.py +++ b/KicadModTree/tests/moduletests/__init__.py @@ -16,5 +16,3 @@ from .test_simple_footprints import SimpleFootprintTests from .test_kicad5_padshapes import Kicad5PadsTests from .test_exposed_pad import ExposedPadTests -from .test_arc import ArcTests -from .test_rotation import RotationTests diff --git a/KicadModTree/tests/moduletests/test_arc.py b/KicadModTree/tests/moduletests/test_arc.py deleted file mode 100644 index fcac596ba..000000000 --- a/KicadModTree/tests/moduletests/test_arc.py +++ /dev/null @@ -1,388 +0,0 @@ -import unittest -import math -from KicadModTree import * - -RESULT_kx90DEG = """(module test (layer F.Cu) (tedit 0) - (fp_arc (start 0 0) (end 1 0) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 0 -1.2) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end -1.4 0) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 0 1.6) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 2 0) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 0 2.2) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end -2.4 0) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 0 -2.6) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 3 0) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 0 -3.2) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end -3.4 0) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 0 3.6) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 4 0) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 0 4.2) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end -4.4 0) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 0 -4.6) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 5 0) (angle 270) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 0 -5.2) (angle 270) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end -5.4 0) (angle 270) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 0 5.6) (angle 270) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 6 0) (angle -180) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end -6.2 0) (angle -180) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 6.6 0) (angle 180) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end -6.8 0) (angle 180) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 4.949747 -4.949747) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end -5.091169 -5.091169) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end -5.23259 5.23259) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 5.374012 5.374012) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 5.656854 5.656854) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end 5.798276 -5.798276) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end -5.939697 -5.939697) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 0 0) (end -6.081118 6.081118) (angle -90) (layer F.SilkS) (width 0.12)) -)""" - -RESULT_kx90DEG_45deg = """(module test (layer F.Cu) (tedit 0) - (fp_arc (start -5 5) (end -4.292893 5.707107) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -4.151472 4.151472) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -5.989949 4.010051) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -6.131371 6.131371) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -3.585786 6.414214) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -6.555635 6.555635) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -6.697056 3.302944) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -3.161522 3.161522) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -2.87868 7.12132) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -2.737258 2.737258) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -7.404163 2.595837) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -7.545584 7.545584) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -2.171573 7.828427) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -7.969848 7.969848) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -8.11127 1.88873) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -1.747309 1.747309) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -1.464466 8.535534) (angle 270) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -1.323045 1.323045) (angle 270) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -8.818377 1.181623) (angle 270) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -8.959798 8.959798) (angle 270) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -0.757359 9.242641) (angle -180) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -9.384062 0.615938) (angle -180) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -0.333095 9.666905) (angle 180) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -9.808326 0.191674) (angle 180) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end 2 5) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -5 -2.2) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -12.4 5) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -5 12.6) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -5 13) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end 3.2 5) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -5 -3.4) (angle -90) (layer F.SilkS) (width 0.12)) - (fp_arc (start -5 5) (end -13.6 5) (angle -90) (layer F.SilkS) (width 0.12)) -)""" - - -class ArcTests(unittest.TestCase): - - def testArcsKx90deg(self): - kicad_mod = Footprint("test") - - center = Vector2D(0, 0) - kicad_mod.append( - Arc(center=center, start=Vector2D(1, 0), angle=-90)) - kicad_mod.append( - Arc(center=center, start=Vector2D(0, -1.2), angle=-90)) - - kicad_mod.append( - Arc(center=center, start=Vector2D(-1.4, 0), angle=-90)) - kicad_mod.append( - Arc(center=center, start=Vector2D(0, 1.6), angle=-90)) - - kicad_mod.append( - Arc(center=center, start=Vector2D(2, 0), angle=90)) - kicad_mod.append( - Arc(center=center, start=Vector2D(0, 2.2), angle=90)) - - kicad_mod.append( - Arc(center=center, start=Vector2D(-2.4, 0), angle=90)) - kicad_mod.append( - Arc(center=center, start=Vector2D(0, -2.6), angle=90)) - - kicad_mod.append( - Arc(center=center, start=Vector2D(3, 0), end=Vector2D(0, -3))) - kicad_mod.append( - Arc(center=center, start=Vector2D(0, -3.2), end=Vector2D(-3.2, 0))) - - kicad_mod.append( - Arc(center=center, start=Vector2D(-3.4, 0), end=Vector2D(0, 3.4))) - kicad_mod.append( - Arc(center=center, start=Vector2D(0, 3.6), end=Vector2D(3.6, 0))) - - kicad_mod.append( - Arc(center=center, start=Vector2D(4, 0), end=Vector2D(0, 4))) - kicad_mod.append( - Arc(center=center, start=Vector2D(0, 4.2), end=Vector2D(-4.2, 0))) - - kicad_mod.append( - Arc(center=center, start=Vector2D(-4.4, 0), end=Vector2D(0, -4.4))) - kicad_mod.append( - Arc(center=center, start=Vector2D(0, -4.6), end=Vector2D(4.6, 0))) - - kicad_mod.append( - Arc(center=center, start=Vector2D(5, 0), end=Vector2D(0, -5), - long_way=True)) - kicad_mod.append( - Arc(center=center, start=Vector2D(0, -5.2), end=Vector2D(-5.2, 0), - long_way=True)) - - kicad_mod.append( - Arc(center=center, start=Vector2D(-5.4, 0), end=Vector2D(0, 5.4), - long_way=True)) - kicad_mod.append( - Arc(center=center, start=Vector2D(0, 5.6), end=Vector2D(5.6, 0), - long_way=True)) - - kicad_mod.append( - Arc(center=center, start=Vector2D(6, 0), end=Vector2D(-6, 0))) - kicad_mod.append( - Arc(center=center, start=Vector2D(-6.2, 0), end=Vector2D(6.2, 0))) - - kicad_mod.append( - Arc(center=center, start=Vector2D(6.6, 0), end=Vector2D(-6.6, 0), - long_way=True)) - kicad_mod.append( - Arc(center=center, start=Vector2D(-6.8, 0), end=Vector2D(6.8, 0), - long_way=True)) - - kicad_mod.append( - Arc(center=center, midpoint=Vector2D(7, 0), angle=90)) - kicad_mod.append( - Arc(center=center, midpoint=Vector2D(0, -7.2), angle=90)) - kicad_mod.append( - Arc(center=center, midpoint=Vector2D(-7.4, 0), angle=90)) - kicad_mod.append( - Arc(center=center, midpoint=Vector2D(0, 7.6), angle=90)) - - kicad_mod.append( - Arc(center=center, midpoint=Vector2D(8, 0), angle=-90)) - kicad_mod.append( - Arc(center=center, midpoint=Vector2D(0, -8.2), angle=-90)) - kicad_mod.append( - Arc(center=center, midpoint=Vector2D(-8.4, 0), angle=-90)) - kicad_mod.append( - Arc(center=center, midpoint=Vector2D(0, 8.6), angle=-90)) - - file_handler = KicadFileHandler(kicad_mod) - self.assertEqual(file_handler.serialize(timestamp=0), RESULT_kx90DEG) - # file_handler.writeFile('test_arc4.kicad_mod') - - def testArcsKx90degOffsetRotated(self): - kicad_mod = Footprint("test") - - center = Vector2D(-5, 5) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(1, 0)+center).rotate(45, origin=center), - angle=-90 - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(0, -1.2)+center).rotate(45, origin=center), - angle=-90 - )) - - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(-1.4, 0)+center).rotate(45, origin=center), - angle=-90 - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(0, 1.6)+center).rotate(45, origin=center), - angle=-90 - )) - - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(2, 0)+center).rotate(45, origin=center), - angle=90 - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(0, 2.2)+center).rotate(45, origin=center), - angle=90 - )) - - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(-2.4, 0)+center).rotate(45, origin=center), - angle=90 - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(0, -2.6)+center).rotate(45, origin=center), - angle=90 - )) - - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(3, 0)+center).rotate(45, origin=center), - end=(Vector2D(0, -3)+center).rotate(45, origin=center) - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(0, -3.2)+center).rotate(45, origin=center), - end=(Vector2D(-3.2, 0)+center).rotate(45, origin=center) - )) - - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(-3.4, 0)+center).rotate(45, origin=center), - end=(Vector2D(0, 3.4)+center).rotate(45, origin=center) - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(0, 3.6)+center).rotate(45, origin=center), - end=(Vector2D(3.6, 0)+center).rotate(45, origin=center) - )) - - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(4, 0)+center).rotate(45, origin=center), - end=(Vector2D(0, 4)+center).rotate(45, origin=center) - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(0, 4.2)+center).rotate(45, origin=center), - end=(Vector2D(-4.2, 0)+center).rotate(45, origin=center) - )) - - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(-4.4, 0)+center).rotate(45, origin=center), - end=(Vector2D(0, -4.4)+center).rotate(45, origin=center) - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(0, -4.6)+center).rotate(45, origin=center), - end=(Vector2D(4.6, 0)+center).rotate(45, origin=center) - )) - - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(5, 0)+center).rotate(45, origin=center), - end=(Vector2D(0, -5)+center).rotate(45, origin=center), - long_way=True - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(0, -5.2)+center).rotate(45, origin=center), - end=(Vector2D(-5.2, 0)+center).rotate(45, origin=center), - long_way=True - )) - - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(-5.4, 0)+center).rotate(45, origin=center), - end=(Vector2D(0, 5.4)+center).rotate(45, origin=center), - long_way=True - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(0, 5.6)+center).rotate(45, origin=center), - end=(Vector2D(5.6, 0)+center).rotate(45, origin=center), - long_way=True - )) - - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(6, 0)+center).rotate(45, origin=center), - end=(Vector2D(-6, 0)+center).rotate(45, origin=center) - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(-6.2, 0)+center).rotate(45, origin=center), - end=(Vector2D(6.2, 0)+center).rotate(45, origin=center) - )) - - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(6.6, 0)+center).rotate(45, origin=center), - end=(Vector2D(-6.6, 0)+center).rotate(45, origin=center), - long_way=True - )) - kicad_mod.append( - Arc( - center=center, - start=(Vector2D(-6.8, 0)+center).rotate(45, origin=center), - end=(Vector2D(6.8, 0)+center).rotate(45, origin=center), - long_way=True - )) - - kicad_mod.append( - Arc( - center=center, - midpoint=(Vector2D(7, 0)+center).rotate(45, origin=center), - angle=90 - )) - kicad_mod.append( - Arc( - center=center, - midpoint=(Vector2D(0, -7.2)+center).rotate(45, origin=center), - angle=90 - )) - kicad_mod.append( - Arc( - center=center, - midpoint=(Vector2D(-7.4, 0)+center).rotate(45, origin=center), - angle=90 - )) - kicad_mod.append( - Arc( - center=center, - midpoint=(Vector2D(0, 7.6)+center).rotate(45, origin=center), - angle=90 - )) - - kicad_mod.append( - Arc( - center=center, - midpoint=(Vector2D(8, 0)+center).rotate(45, origin=center), - angle=-90 - )) - kicad_mod.append( - Arc( - center=center, - midpoint=(Vector2D(0, -8.2)+center).rotate(45, origin=center), - angle=-90 - )) - kicad_mod.append( - Arc( - center=center, - midpoint=(Vector2D(-8.4, 0)+center).rotate(45, origin=center), - angle=-90 - )) - kicad_mod.append( - Arc( - center=center, - midpoint=(Vector2D(0, 8.6)+center).rotate(45, origin=center), - angle=-90 - )) - - file_handler = KicadFileHandler(kicad_mod) - self.assertEqual(file_handler.serialize(timestamp=0), RESULT_kx90DEG_45deg) - # file_handler.writeFile('test_arc5.kicad_mod') diff --git a/KicadModTree/tests/moduletests/test_exposed_pad.py b/KicadModTree/tests/moduletests/test_exposed_pad.py index 57a32646f..da8db8062 100644 --- a/KicadModTree/tests/moduletests/test_exposed_pad.py +++ b/KicadModTree/tests/moduletests/test_exposed_pad.py @@ -1335,7 +1335,7 @@ def testExposedPasteAutogenInner2(self): file_handler = KicadFileHandler(kicad_mod) result = file_handler.serialize(timestamp=0) - # file_handler.writeFile('test_ep1.kicad_mod') + file_handler.writeFile('test_ep1.kicad_mod') self.assertEqual(result, RESULT_EP_PASTE_GEN_INNER2) def testExposedPasteAutogenInnerAndOuther(self): diff --git a/KicadModTree/tests/moduletests/test_rotation.py b/KicadModTree/tests/moduletests/test_rotation.py deleted file mode 100644 index 543ad0a6a..000000000 --- a/KicadModTree/tests/moduletests/test_rotation.py +++ /dev/null @@ -1,253 +0,0 @@ -import unittest -import math -from KicadModTree import * - -RESULT_rotText = """(module test_rotate (layer F.Cu) (tedit 0) - (fp_text user -1 (at 2 0) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text user -1 (at 1.414214 1.414214 -45) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text user -1 (at 0 2 -90) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text user -1 (at -1.414214 1.414214 -135) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text user -1 (at -2 0 -180) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text user -1 (at -1.414214 -1.414214 -225) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text user -1 (at 0 -2 -270) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) - (fp_text user -1 (at 1.414214 -1.414214 -315) (layer F.SilkS) - (effects (font (size 1 1) (thickness 0.15))) - ) -)""" - -RESULT_rotLine = """(module test_rotate (layer F.Cu) (tedit 0) - (fp_line (start 6 0) (end 7 1) (layer F.SilkS) (width 0.12)) - (fp_line (start 5.931852 0.517638) (end 6.638958 1.742383) (layer F.SilkS) (width 0.12)) - (fp_line (start 5.732051 1) (end 6.098076 2.366025) (layer F.SilkS) (width 0.12)) - (fp_line (start 5.414214 1.414214) (end 5.414214 2.828427) (layer F.SilkS) (width 0.12)) - (fp_line (start 5 1.732051) (end 4.633975 3.098076) (layer F.SilkS) (width 0.12)) - (fp_line (start 4.517638 1.931852) (end 3.810531 3.156597) (layer F.SilkS) (width 0.12)) - (fp_line (start 4 2) (end 3 3) (layer F.SilkS) (width 0.12)) - (fp_line (start 3.482362 1.931852) (end 2.257617 2.638958) (layer F.SilkS) (width 0.12)) - (fp_line (start 3 1.732051) (end 1.633975 2.098076) (layer F.SilkS) (width 0.12)) - (fp_line (start 2.585786 1.414214) (end 1.171573 1.414214) (layer F.SilkS) (width 0.12)) - (fp_line (start 2.267949 1) (end 0.901924 0.633975) (layer F.SilkS) (width 0.12)) - (fp_line (start 2.068148 0.517638) (end 0.843403 -0.189469) (layer F.SilkS) (width 0.12)) - (fp_line (start 2 0) (end 1 -1) (layer F.SilkS) (width 0.12)) - (fp_line (start 2.068148 -0.517638) (end 1.361042 -1.742383) (layer F.SilkS) (width 0.12)) - (fp_line (start 2.267949 -1) (end 1.901924 -2.366025) (layer F.SilkS) (width 0.12)) - (fp_line (start 2.585786 -1.414214) (end 2.585786 -2.828427) (layer F.SilkS) (width 0.12)) - (fp_line (start 3 -1.732051) (end 3.366025 -3.098076) (layer F.SilkS) (width 0.12)) - (fp_line (start 3.482362 -1.931852) (end 4.189469 -3.156597) (layer F.SilkS) (width 0.12)) - (fp_line (start 4 -2) (end 5 -3) (layer F.SilkS) (width 0.12)) - (fp_line (start 4.517638 -1.931852) (end 5.742383 -2.638958) (layer F.SilkS) (width 0.12)) - (fp_line (start 5 -1.732051) (end 6.366025 -2.098076) (layer F.SilkS) (width 0.12)) - (fp_line (start 5.414214 -1.414214) (end 6.828427 -1.414214) (layer F.SilkS) (width 0.12)) - (fp_line (start 5.732051 -1) (end 7.098076 -0.633975) (layer F.SilkS) (width 0.12)) - (fp_line (start 5.931852 -0.517638) (end 7.156597 0.189469) (layer F.SilkS) (width 0.12)) -)""" - -RESULT_rotArc = """(module test_rotate (layer F.Cu) (tedit 0) - (fp_arc (start 6 1) (end 5.741181 0.034074) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 5.673033 1.483564) (end 5.673033 0.483564) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 5.232051 1.866025) (end 5.49087 0.9001) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 4.707107 2.12132) (end 5.207107 1.255295) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 4.133975 2.232051) (end 4.841081 1.524944) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 3.551712 2.190671) (end 4.417738 1.690671) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 3 2) (end 3.965926 1.741181) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 2.516436 1.673033) (end 3.516436 1.673033) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 2.133975 1.232051) (end 3.0999 1.49087) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 1.87868 0.707107) (end 2.744705 1.207107) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 1.767949 0.133975) (end 2.475056 0.841081) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 1.809329 -0.448288) (end 2.309329 0.417738) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 2 -1) (end 2.258819 -0.034074) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 2.326967 -1.483564) (end 2.326967 -0.483564) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 2.767949 -1.866025) (end 2.50913 -0.9001) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 3.292893 -2.12132) (end 2.792893 -1.255295) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 3.866025 -2.232051) (end 3.158919 -1.524944) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 4.448288 -2.190671) (end 3.582262 -1.690671) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 5 -2) (end 4.034074 -1.741181) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 5.483564 -1.673033) (end 4.483564 -1.673033) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 5.866025 -1.232051) (end 4.9001 -1.49087) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 6.12132 -0.707107) (end 5.255295 -1.207107) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 6.232051 -0.133975) (end 5.524944 -0.841081) (angle 90) (layer F.SilkS) (width 0.12)) - (fp_arc (start 6.190671 0.448288) (end 5.690671 -0.417738) (angle 90) (layer F.SilkS) (width 0.12)) -)""" - -RESULT_rotCircle = """(module test_rotate (layer F.Cu) (tedit 0) - (fp_circle (center 6 -1) (end 7 -1) (layer F.SilkS) (width 0.12)) - (fp_circle (center 5.673033 -0.516436) (end 6.673033 -0.516436) (layer F.SilkS) (width 0.12)) - (fp_circle (center 5.232051 -0.133975) (end 6.232051 -0.133975) (layer F.SilkS) (width 0.12)) - (fp_circle (center 4.707107 0.12132) (end 5.707107 0.12132) (layer F.SilkS) (width 0.12)) - (fp_circle (center 4.133975 0.232051) (end 5.133975 0.232051) (layer F.SilkS) (width 0.12)) - (fp_circle (center 3.551712 0.190671) (end 4.551712 0.190671) (layer F.SilkS) (width 0.12)) - (fp_circle (center 3 0) (end 4 0) (layer F.SilkS) (width 0.12)) - (fp_circle (center 2.516436 -0.326967) (end 3.516436 -0.326967) (layer F.SilkS) (width 0.12)) - (fp_circle (center 2.133975 -0.767949) (end 3.133975 -0.767949) (layer F.SilkS) (width 0.12)) - (fp_circle (center 1.87868 -1.292893) (end 2.87868 -1.292893) (layer F.SilkS) (width 0.12)) - (fp_circle (center 1.767949 -1.866025) (end 2.767949 -1.866025) (layer F.SilkS) (width 0.12)) - (fp_circle (center 1.809329 -2.448288) (end 2.809329 -2.448288) (layer F.SilkS) (width 0.12)) - (fp_circle (center 2 -3) (end 3 -3) (layer F.SilkS) (width 0.12)) - (fp_circle (center 2.326967 -3.483564) (end 3.326967 -3.483564) (layer F.SilkS) (width 0.12)) - (fp_circle (center 2.767949 -3.866025) (end 3.767949 -3.866025) (layer F.SilkS) (width 0.12)) - (fp_circle (center 3.292893 -4.12132) (end 4.292893 -4.12132) (layer F.SilkS) (width 0.12)) - (fp_circle (center 3.866025 -4.232051) (end 4.866025 -4.232051) (layer F.SilkS) (width 0.12)) - (fp_circle (center 4.448288 -4.190671) (end 5.448288 -4.190671) (layer F.SilkS) (width 0.12)) - (fp_circle (center 5 -4) (end 6 -4) (layer F.SilkS) (width 0.12)) - (fp_circle (center 5.483564 -3.673033) (end 6.483564 -3.673033) (layer F.SilkS) (width 0.12)) - (fp_circle (center 5.866025 -3.232051) (end 6.866025 -3.232051) (layer F.SilkS) (width 0.12)) - (fp_circle (center 6.12132 -2.707107) (end 7.12132 -2.707107) (layer F.SilkS) (width 0.12)) - (fp_circle (center 6.232051 -2.133975) (end 7.232051 -2.133975) (layer F.SilkS) (width 0.12)) - (fp_circle (center 6.190671 -1.551712) (end 7.190671 -1.551712) (layer F.SilkS) (width 0.12)) -)""" - -RESULT_rotPoly = """(module test_rotate (layer F.Cu) (tedit 0) - (fp_poly (pts (xy -1 0) (xy -1.2 0.5) (xy 0 0) (xy -1.2 -0.5)) (layer F.SilkS) (width 0.12)) - (fp_poly (pts (xy -0.575833 -3.334679) (xy -1.108846 -3.257884) (xy -0.075833 -2.468653) (xy -0.24282 -3.757884)) (layer F.SilkS) (width 0.12)) - (fp_poly (pts (xy 2.524167 -4.634679) (xy 2.191154 -5.057884) (xy 2.024167 -3.768653) (xy 3.05718 -4.557884)) (layer F.SilkS) (width 0.12)) - (fp_poly (pts (xy 5.2 -2.6) (xy 5.4 -3.1) (xy 4.2 -2.6) (xy 5.4 -2.1)) (layer F.SilkS) (width 0.12)) - (fp_poly (pts (xy 4.775833 0.734679) (xy 5.308846 0.657884) (xy 4.275833 -0.131347) (xy 4.44282 1.157884)) (layer F.SilkS) (width 0.12)) - (fp_poly (pts (xy 1.675833 2.034679) (xy 2.008846 2.457884) (xy 2.175833 1.168653) (xy 1.14282 1.957884)) (layer F.SilkS) (width 0.12)) -)""" # NOQA: E501 - -RESULT_rotPad = """(module test_rotate (layer F.Cu) (tedit 0) - (pad 1 smd custom (at 0 0) (size 0.2 0.2) (layers F.Cu F.Mask F.Paste) - (options (clearance outline) (anchor circle)) - (primitives - (gr_poly (pts - (xy -1 0) (xy -1.2 0.5) (xy 0 0) (xy -1.2 -0.5)) (width 0)) - )) - (pad 2 smd custom (at 0.175 -0.303109 -60) (size 0.2 0.2) (layers F.Cu F.Mask F.Paste) - (options (clearance outline) (anchor circle)) - (primitives - (gr_poly (pts - (xy -1 0) (xy -1.2 0.5) (xy 0 0) (xy -1.2 -0.5)) (width 0)) - )) - (pad 3 smd custom (at 0.525 -0.303109 -120) (size 0.2 0.2) (layers F.Cu F.Mask F.Paste) - (options (clearance outline) (anchor circle)) - (primitives - (gr_poly (pts - (xy -1 0) (xy -1.2 0.5) (xy 0 0) (xy -1.2 -0.5)) (width 0)) - )) - (pad 4 smd custom (at 0.7 0 -180) (size 0.2 0.2) (layers F.Cu F.Mask F.Paste) - (options (clearance outline) (anchor circle)) - (primitives - (gr_poly (pts - (xy -1 0) (xy -1.2 0.5) (xy 0 0) (xy -1.2 -0.5)) (width 0)) - )) - (pad 5 smd custom (at 0.525 0.303109 -240) (size 0.2 0.2) (layers F.Cu F.Mask F.Paste) - (options (clearance outline) (anchor circle)) - (primitives - (gr_poly (pts - (xy -1 0) (xy -1.2 0.5) (xy 0 0) (xy -1.2 -0.5)) (width 0)) - )) -)""" - - -class RotationTests(unittest.TestCase): - - def testTextRotation(self): - kicad_mod = Footprint("test_rotate") - - center = Vector2D(0, 0) - at = center+Vector2D(2, 0) - - for t in range(0, 360, 45): - kicad_mod.append( - Text(type=Text.TYPE_USER, text="-1", at=at).rotate(t, origin=center)) - - file_handler = KicadFileHandler(kicad_mod) - # file_handler.writeFile('test.kicad_mod') - self.assertEqual(file_handler.serialize(timestamp=0), RESULT_rotText) - - def testLineRotation(self): - kicad_mod = Footprint("test_rotate") - - center = Vector2D(4, 0) - start = center + Vector2D(2, 0) - end = start + Vector2D(1, 1) - - for t in range(0, 360, 15): - kicad_mod.append( - Line(start=start, end=end).rotate(t, origin=center)) - - file_handler = KicadFileHandler(kicad_mod) - # file_handler.writeFile('test.kicad_mod') - self.assertEqual(file_handler.serialize(timestamp=0), RESULT_rotLine) - - def testArcRotation(self): - kicad_mod = Footprint("test_rotate") - - rot_center = Vector2D(4, 0) - mid = rot_center + Vector2D(2, 0) - center = rot_center + Vector2D(2, 1) - angle = 90 - - for t in range(0, 360, 15): - kicad_mod.append( - Arc(center=center, midpoint=mid, angle=angle) - .rotate(angle/3, origin=center) - .rotate(t, origin=rot_center)) - - file_handler = KicadFileHandler(kicad_mod) - # file_handler.writeFile('test.kicad_mod') - self.assertEqual(file_handler.serialize(timestamp=0), RESULT_rotArc) - - def testCircleRotation(self): - kicad_mod = Footprint("test_rotate") - - rot_center = Vector2D(4, -2) - center = rot_center + Vector2D(2, 1) - radius = 1 - - for t in range(0, 360, 15): - kicad_mod.append( - Circle(center=center, radius=radius).rotate(t, origin=rot_center)) - - file_handler = KicadFileHandler(kicad_mod) - # file_handler.writeFile('test.kicad_mod') - self.assertEqual(file_handler.serialize(timestamp=0), RESULT_rotCircle) - - def testPolygonRotation(self): - kicad_mod = Footprint("test_rotate") - - rot_center = Vector2D(2.1, -1.3) - - nodes = [(-1, 0), (-1.2, 0.5), (0, 0), (-1.2, -0.5)] - - for t in range(0, 360, 60): - kicad_mod.append( - Polygon(nodes=nodes).rotate(t, origin=rot_center)) - - file_handler = KicadFileHandler(kicad_mod) - # file_handler.writeFile('test.kicad_mod') - self.assertEqual(file_handler.serialize(timestamp=0), RESULT_rotPoly) - - def testPadRotation(self): - kicad_mod = Footprint("test_rotate") - - rot_center = Vector2D(0.35, 0) - nodes = [(-1, 0), (-1.2, 0.5), (0, 0), (-1.2, -0.5)] - prim = Polygon(nodes=nodes) - i = 1 - for t in range(0, 300, 60): - kicad_mod.append( - Pad( - number=i, type=Pad.TYPE_SMT, shape=Pad.SHAPE_CUSTOM, - at=[0, 0], size=[0.2, 0.2], layers=Pad.LAYERS_SMT, - primitives=[prim] - ).rotate(t, origin=rot_center)) - i += 1 - - file_handler = KicadFileHandler(kicad_mod) - file_handler.writeFile('test.kicad_mod') - self.assertEqual(file_handler.serialize(timestamp=0), RESULT_rotPad) diff --git a/KicadModTree/util/geometric_util.py b/KicadModTree/util/geometric_util.py deleted file mode 100644 index 9b2526491..000000000 --- a/KicadModTree/util/geometric_util.py +++ /dev/null @@ -1,600 +0,0 @@ -# KicadModTree is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# KicadModTree is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with kicad-footprint-generator. If not, see < http://www.gnu.org/licenses/ >. -# -# (C) 2016-2018 by Thomas Pointhuber, - -import math -from KicadModTree.Vector import * -import copy - - -class geometricLine(): - r""" Handle the geometric side of lines - - :params: - * *start* (``Vector2D``) -- - start point of the line - * *end* (``Vector2D``) -- - end point of the line - """ - - def __init__(self, **kwargs): - if 'geometry' in kwargs: - geometry = kwargs['geometry'] - self.start_pos = Vector2D(geometry.start_pos) - self.end_pos = Vector2D(geometry.end_pos) - else: - self.start_pos = Vector2D(kwargs['start']) - self.end_pos = Vector2D(kwargs['end']) - - def copy(self): - return geometricLine(geometry=self) - - def rotate(self, angle, origin=(0, 0), use_degrees=True): - r""" Rotate around given origin - - :params: - * *angle* (``float``) - rotation angle - * *origin* (``Vector2D``) - origin point for the rotation. default: (0, 0) - * *use_degrees* (``boolean``) - rotation angle is given in degrees. default:True - """ - - self.start_pos.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - self.end_pos.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - return self - - def translate(self, distance_vector): - r""" Translate - - :params: - * *distance_vector* (``Vector2D``) - 2D vector defining by how much and in what direction to translate. - """ - - self.start_pos += distance_vector - self.end_pos += distance_vector - return self - - def isPointOnSelf(self, point, tolerance=1e-7): - r""" is the given point on this line - - :params: - * *point* (``Vector2D``) - The point to be checked - * *tolerance* (``float``) - tolerance used to determine if the point is on the element - default: 1e-7 - """ - - ll, la = (self.end_pos - self.start_pos).to_polar() - pl, pa = (point - self.start_pos).to_polar() - return abs(la - pa) < tolerance and pl <= ll - - def sortPointsRelativeToStart(self, points): - r""" sort given points releative to start point - - :params: - * *points* (``[Vector2D]``) - itterable of points - """ - - if len(points) < 2: - return points - - if len(points) > 2: - raise NotImplementedError("Sorting for more than 2 points not supported") - - if self.start_pos.distance_to(points[0]) < self.start_pos.distance_to(points[1]): - return points - else: - return [points[1], points[0]] - - def cut(self, *other): - r""" cut line with given other element - - :params: - * *other* (``Line``, ``Circle``, ``Arc``) - cut the element on any intersection with the given geometric element - """ - - ip = BaseNodeIntersection.intersectTwoNodes(self, *other) - cp = [] - for p in ip: - if self.isPointOnSelf(p): - cp.append(p) - - sp = self.sortPointsRelativeToStart(cp) - sp.insert(0, self.start_pos) - sp.append(self.end_pos) - - r = [] - for i in range(len(sp)-1): - r.append(geometricLine(start=sp[i], end=sp[i+1])) - - return r - - def to_homogeneous(self): - r""" Get homogeneous representation of the line - """ - p1 = self.start_pos.to_homogeneous() - p2 = self.end_pos.to_homogeneous() - return p1.cross_product(p2) - - def __iter__(self): - yield self.start_pos - yield self.end_pos - - def __len__(self): - return 2 - - def __getitem__(self, key): - if key == 0 or key == 'start': - return self.start_pos - if key == 1 or key == 'end': - return self.end_pos - - raise IndexError('Index {} is out of range'.format(key)) - - def __setitem__(self, key, item): - if key == 0 or key == 'start': - self.start_pos = item - elif key == 1 or key == 'end': - self.end_pos = item - else: - raise IndexError('Index {} is out of range'.format(key)) - - -class geometricCircle(): - r"""Handle the geometric side of circles - - :params: - * *center* (``Vector2D``) -- - center of the circle - * *radius* (``float``) -- - radius of the circle - """ - - def __init__(self, center, radius): - self.center_pos = Vector2D(center) - self.radius = float(radius) - - def rotate(self, angle, origin=(0, 0), use_degrees=True): - r""" Rotate around given origin - - :params: - * *angle* (``float``) - rotation angle - * *origin* (``Vector2D``) - origin point for the rotation. default: (0, 0) - * *use_degrees* (``boolean``) - rotation angle is given in degrees. default:True - """ - - self.center_pos.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - return self - - def translate(self, distance_vector): - r""" Translate - - :params: - * *distance_vector* (``Vector2D``) - 2D vector defining by how much and in what direction to translate. - """ - - self.center_pos += distance_vector - return self - - def isPointOnSelf(self, point, tolerance=1e-7): - r""" is the given point on this circle - - :params: - * *point* (``Vector2D``) - The point to be checked - * *tolerance* (``float``) - tolerance used to determine if the point is on the element - default: 1e-7 - """ - - rad_p, ang_p = Vector2D(point).to_polar(origin=self.center_pos) - return abs(self.radius - rad_p) < tolerance - - def sortPointsRelativeToStart(self, points): - r""" sort given points releative to start point - - :params: - * *points* (``[Vector2D]``) - itterable of points - """ - - pass - - def cut(self, *other): - r""" cut line with given other element - - :params: - * *other* (``Line``, ``Circle``, ``Arc``) - cut the element on any intersection with the given geometric element - """ - raise NotImplemented("cut for circles not yet implemented") - # re use arc implementation with angle set to 360 deg - # and start point set to 0 deg (polar) - - def __iter__(self): - yield self.center_pos - - def __len__(self): - return 1 - - def __getitem__(self, key): - if key == 0 or key == 'center': - return self.center_pos - - raise IndexError('Index {} is out of range'.format(key)) - - def __setitem__(self, key, item): - if key == 0 or key == 'center': - self.center_pos = item - else: - raise IndexError('Index {} is out of range'.format(key)) - - -class geometricArc(): - r""" Handle the geometric side of arcs - - :params: - * *center* (``Vector2D``) -- - center of arc - * *start* (``Vector2D``) -- - start point of arc - * *midpoint* (``Vector2D``) -- - alternative to start point - point is on arc and defines point of equal distance to both arc ends - arcs of this form are given as midpoint, center plus angle - * *end* (``Vector2D``) -- - alternative to angle - arcs of this form are given as start, end and center - * *angle* (``float``) -- - angle of arc - """ - - def __init__(self, **kwargs): - if 'geometry' in kwargs: - geometry = kwargs['geometry'] - self.center_pos = Vector2D(geometry.center_pos) - self.start_pos = Vector2D(geometry.start_pos) - self.angle = float(geometry.angle) - elif 'center' in kwargs: - if 'angle' in kwargs: - self._initFromCenterAndAngle(**kwargs) - elif 'end' in kwargs: - self._initFromCenterAndEnd(**kwargs) - else: - raise KeyError('Arcs defined with center point must define either an angle or endpoint') - else: - raise NotImplementedError('3 point arcs are not implemented, center is always required.') - - @staticmethod - def normalizeAngle(angle): - a = angle % (2*360) - if a > 360: - a -= 2*360 - return a - - def _initAngle(self, angle): - self.angle = geometricArc.normalizeAngle(angle) - - def _initFromCenterAndAngle(self, **kwargs): - self.center_pos = Vector2D(kwargs['center']) - self._initAngle(kwargs['angle']) - - if 'start' in kwargs: - self.start_pos = Vector2D(kwargs['start']) - elif 'midpoint' in kwargs: - mp_r, mp_a = Vector2D(kwargs['midpoint']).to_polar( - origin=self.center_pos, use_degrees=True) - - self.start_pos = Vector2D.from_polar( - radius=mp_r, angle=mp_a-self.angle/2, - origin=self.center_pos, use_degrees=True) - else: - raise KeyError('Arcs defined with center and angle must either define the start or midpoint.') - - def _initFromCenterAndEnd(self, **kwargs): - self.center_pos = Vector2D(kwargs['center']) - if 'start' in kwargs: - self.start_pos = Vector2D(kwargs['start']) - sp_r, sp_a = self.start_pos.to_polar( - origin=self.center_pos, use_degrees=True) - ep_r, ep_a = Vector2D(kwargs['end']).to_polar( - origin=self.center_pos, use_degrees=True) - - if abs(sp_r - ep_r) > 1e-7: - warnings.warn( - """Start and end point are not an same arc. - Extended line from center to end point used to determine angle.""" - ) - self._initAngle(ep_a - sp_a) - - if kwargs.get('long_way', False): - if abs(self.angle) < 180: - self.angle = -math.copysign((360-abs(self.angle)), self.angle) - if self.angle == -180: - self.angle = 180 - else: - if abs(self.angle) > 180: - self.angle = -math.copysign((abs(self.angle) - 360), self.angle) - if self.angle == 180: - self.angle = -180 - else: - raise KeyError('Arcs defined with center and endpoint must define the start point.') - - def rotate(self, angle, origin=(0, 0), use_degrees=True): - r""" Rotate around given origin - - :params: - * *angle* (``float``) - rotation angle - * *origin* (``Vector2D``) - origin point for the rotation. default: (0, 0) - * *use_degrees* (``boolean``) - rotation angle is given in degrees. default:True - """ - - self.center_pos.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - self.start_pos.rotate(angle=angle, origin=origin, use_degrees=use_degrees) - return self - - def translate(self, distance_vector): - r""" Translate - - :params: - * *distance_vector* (``Vector2D``) - 2D vector defining by how much and in what direction to translate. - """ - - self.center_pos += distance_vector - self.start_pos += distance_vector - return self - - def getRadius(self): - r, a = (self.start_pos - self.center_pos).to_polar() - return r - - def getStartPoint(self): - return Vector2D(self.start_pos) - - def getMidPoint(self): - return Vector2D(self.start_pos).rotate(self.angle/2, origin=self.center_pos) - - def getEndPoint(self): - return Vector2D(self.start_pos).rotate(self.angle, origin=self.center_pos) - - def setRadius(self, radius): - rad_s, ang_s = self.start_pos.to_polar(origin=self.center_pos) - self.start_pos = Vector2D.from_polar(radius=radius, angle=ang_s, origin=self.center_pos) - return self - - def _calulateEndPos(self): - radius, angle = self.start_pos.to_polar( - origin=self.center_pos, use_degrees=True) - - return Vector2D.from_polar( - radius=radius, angle=angle+self.angle, - origin=self.center_pos, use_degrees=True) - - def _toLocalCoordinates(self, point): - rad_s, ang_s = self.start_pos.to_polar(origin=self.center_pos) - rad_p, ang_p = Vector2D(point).to_polar(origin=self.center_pos) - - ang_p_s = (ang_p - ang_s) % 360 - if self.angle < 0: - ang_p_s -= 360 - return (rad_p, ang_p_s) - - def _compareAngles(self, a1, a2, tolerance=1e-7): - r""" compare which of the two angles given in the local coordinate system - - :params: - * *a1* (``float``) - angle 1 - * *a2* (``float``) - angle 2 - * *tolerance* (``float``) - tolerance used to determine if the point is on the element - default: 1e-7 - - :return: - * -1: angle 1 is closer to start - * 0: both are of equal distance - * 1: angle 2 is closer to start - """ - - if abs(a1-a2) < tolerance: - return 0 - - if self.angle < 0: - if a1 < a2: - return 1 - else: - if a1 > a2: - return 1 - return -1 - - def isPointOnSelf(self, point, tolerance=1e-7): - r""" is the given point on this arc - - :params: - * *point* (``Vector2D``) - The point to be checked - * *tolerance* (``float``) - tolerance used to determine if the point is on the element - default: 1e-7 - """ - - rad_p, ang_p_s = self._toLocalCoordinates(point) - rad_s, ang_s = self.start_pos.to_polar(origin=self.center_pos) - - # rotate to local coordinate system (start point is at 0 degree) - ang_e_s = self.angle - - return self._compareAngles(ang_p_s, ang_e_s) == -1 and abs(rad_s - rad_p) < tolerance - - def sortPointsRelativeToStart(self, points): - r""" sort given points releative to start point - - :params: - * *points* (``[Vector2D]``) - itterable of points - """ - - if len(points) > 2: - raise NotImplementedError("Sorting for more than 2 points not supported") - - ps = [] - for p in points: - ps.append(self._toLocalCoordinates(p)) - - if len(points) < 2: - return ps - - if self._compareAngles(ps[0][1], ps[1][1]) == 1: - return [ps[1], ps[0]] - else: - return ps - - def cut(self, *other): - r""" cut line with given other element - - :params: - * *other* (``Line``, ``Circle``, ``Arc``) - cut the element on any intersection with the given geometric element - """ - - ip = BaseNodeIntersection.intersectTwoNodes(self, *other) - cp = [] - for p in ip: - if self.isPointOnSelf(p): - cp.append(p) - - sp = self.sortPointsRelativeToStart(cp) - sp.insert(0, (self.getRadius(), 0)) - sp.append(self._toLocalCoordinates(self._calulateEndPos())) - - r = [] - for i in range(len(sp)-1): - r.append(geometricArc( - center=self.center_pos, - start=Vector2D(self.start_pos).rotate(sp[i][1], origin=self.center_pos), - angle=sp[i+1][1]-sp[i][1] - )) - - return r - - def __iter__(self): - yield self.center_pos - yield self.start_pos - - def __len__(self): - return 2 - - def __getitem__(self, key): - if key == 0 or key == 'center': - return self.center_pos - if key == 1 or key == 'start': - return self.start_pos - - raise IndexError('Index {} is out of range'.format(key)) - - def __setitem__(self, key, item): - if key == 0 or key == 'center': - self.center_pos = item - if key == 1 or key == 'start': - return self.start_pos - else: - raise IndexError('Index {} is out of range'.format(key)) - - -class BaseNodeIntersection(): - @staticmethod - def intersectTwoNodes(*nodes): - import KicadModTree.nodes.base.Line - if len(nodes) < 2 or len(nodes) > 3: - raise KeyError("intersectTwoNodes expects two node objects or a node and two vectors") - - circles = [] - lines = [] - vectors = [] - - for n in nodes: - if hasattr(n, 'getRadius') and hasattr(n, 'center_pos'): - circles.append(n) - elif hasattr(n, 'end_pos') and hasattr(n, 'start_pos'): - lines.append(n) - else: - vectors.append(n) - - if len(vectors) == 2: - lines.append(Line(start=vectors[0], end=vectors[1])) - - if len(lines) == 2: - return BaseNodeIntersection.intersectTwoLines(*lines) - if len(circles) == 2: - raise NotImplementedError('intersection between circles is not supported') - if len(lines) == 1 and len(circles) == 1: - return BaseNodeIntersection.intersectLineWithCircle(lines[0], circles[0]) - - raise NotImplementedError('unsupported combination of parameter types') - - @staticmethod - def intersectTwoLines(line1, line2): - # we use homogeneous coordinates here. - l1 = line1.to_homogeneous() - l2 = line2.to_homogeneous() - - ip = l1.cross_product(l2) - if ip.z == 0: - return [] - - return [Vector2D.from_homogeneous(ip)] - - @staticmethod - def intersectLineWithCircle(line, circle): - # from http://mathworld.wolfram.com/Circle-LineIntersection.html - # Equations are for circle center on (0, 0) so we translate everything - # to the origin (well the line anyways as we do only need the radius of the circle) - lt = line.copy().translate(-circle.center_pos) - - d = lt.end_pos - lt.start_pos - dr = math.hypot(d.x, d.y) - D = lt.start_pos.x*lt.end_pos.y - lt.end_pos.x*lt.start_pos.y - - discriminant = circle.getRadius()**2 * dr**2 - D**2 - intersection = [] - if discriminant < 0: - return intersection - - def calcPoint(x): - return Vector2D({ - 'x': (D*d.y + x*math.copysign(1, d.y)*d.x*math.sqrt(discriminant))/dr**2, - 'y': (-D*d.x + x*abs(d.y)*math.sqrt(discriminant))/dr**2 - }) + circle.center_pos - - intersection.append(calcPoint(1)) - if discriminant == 0: - return intersection - - intersection.append(calcPoint(-1)) - return intersection diff --git a/KicadModTree/util/kicad_util.py b/KicadModTree/util/kicad_util.py index efb29185a..651a0d590 100644 --- a/KicadModTree/util/kicad_util.py +++ b/KicadModTree/util/kicad_util.py @@ -21,10 +21,7 @@ def formatFloat(val): ''' return well formated float ''' - result = ('%f' % val).rstrip('0').rstrip('.') - if result == '-0': - result = '0' - return result + return ('%f' % val).rstrip('0').rstrip('.') def lispString(string): diff --git a/scripts/Connector/Connector_JST/conn_jst_VH_tht_top-shrouded.py b/scripts/Connector/Connector_JST/conn_jst_VH_tht_top-shrouded.py index 571acd4ed..ff82b172c 100644 --- a/scripts/Connector/Connector_JST/conn_jst_VH_tht_top-shrouded.py +++ b/scripts/Connector/Connector_JST/conn_jst_VH_tht_top-shrouded.py @@ -40,7 +40,7 @@ min_annular_ring = 0.15 drill = 1.7 # 1.65 +0.1/-0.0 -> 1.7+/-0.05 mh_drill = 1.45 -mh_at = [-1.5, -3.4] +mh_at = [-1.5, -3.4] #contratiction (y position) in datasheet! pin_range = range(2, 11) #number of pins in each row diff --git a/scripts/Connector/Connector_JST/conn_jst_vh_tht_top.py b/scripts/Connector/Connector_JST/conn_jst_vh_tht_top.py index 3abc18fec..f8c0ac1b7 100644 --- a/scripts/Connector/Connector_JST/conn_jst_vh_tht_top.py +++ b/scripts/Connector/Connector_JST/conn_jst_vh_tht_top.py @@ -43,32 +43,21 @@ #FP name strings -part_base = "B{n:d}P{n_total:s}-{suffix:s}" +part_base = "B{n:d}P-{suffix:s}" def generate_one_footprint(pins, series_params, configuration): #calculate dimensions A = (pins - 1) * pitch B = A + 3.9 - - post_omitted = True if len(series_params) == 4 else False - pins_used = pins - len(series_params[3]) if post_omitted else pins - - # if removed pins are a fixed pattern (every 2 pins, every 3 pins, etc.), - # then we can determine an effective pitch - # if all pins are loaded or removed pins are disorderly use the default pitch - pitch_effective = pitch - if post_omitted: - if ((pins - 1) % (pins_used - 1)) == 0: - pitch_effective = ((pins - 1) / (pins_used - 1)) * pitch #generate name - mpn = part_base.format(n = pins_used, n_total = str(pins) if post_omitted else '', suffix=series_params[1]) + mpn = part_base.format(n=pins, suffix=series_params[1]) orientation_str = configuration['orientation_options'][orientation] footprint_name = configuration['fp_name_format_string'].format(man=manufacturer, series=series, - mpn=mpn, num_rows=number_of_rows, pins_per_row=pins_used, mounting_pad = "", - pitch=pitch_effective, orientation=orientation_str) + mpn=mpn, num_rows=number_of_rows, pins_per_row=pins, mounting_pad = "", + pitch=pitch, orientation=orientation_str) kicad_mod = Footprint(footprint_name) kicad_mod.setDescription("JST {:s} series connector, {:s} ({:s}), generated with kicad-footprint-generator".format(series_params[2], mpn, datasheet)) @@ -159,35 +148,12 @@ def generate_one_footprint(pins, series_params, configuration): optional_pad_params['tht_pad1_shape'] = Pad.SHAPE_RECT else: optional_pad_params['tht_pad1_shape'] = Pad.SHAPE_ROUNDRECT - optional_pad_params['radius_ratio'] = 0.25 - optional_pad_params['maximum_radius'] = 0.25 - - exclude_pin_list = series_params[3] if post_omitted else [] - if post_omitted: - if pins > 3 and len(series_params[3]) == 1: - for pin in range(1, pins + 1): - if pin != series_params[3][0]: - #shape = optional_pad_params['tht_pad1_shape'] if pin == 1 else shape - kicad_mod.append(Pad( - number=pin, at=[(pin - 1) * pitch_effective, 0], - type=Pad.TYPE_THT, - shape=optional_pad_params['tht_pad1_shape'] if pin == 1 else shape, - size=pad_size, drill=drill, layers=Pad.LAYERS_THT, - **optional_pad_params)) - else: - for pin in range(1, pins_used + 1): - kicad_mod.append(Pad( - number=pin, at=[(pin - 1) * pitch_effective, 0], - type=Pad.TYPE_THT, - shape=optional_pad_params['tht_pad1_shape'] if pin == 1 else shape, - size=pad_size, drill=drill, layers=Pad.LAYERS_THT, - **optional_pad_params)) - else: - kicad_mod.append(PadArray( - pincount=pins, x_spacing=pitch, - type=Pad.TYPE_THT, shape=shape, - size=pad_size, drill=drill, layers=Pad.LAYERS_THT, - **optional_pad_params)) + + kicad_mod.append(PadArray( + pincount=pins, x_spacing=pitch, + type=Pad.TYPE_THT, shape=shape, + size=pad_size, drill=drill, layers=Pad.LAYERS_THT, + **optional_pad_params)) ######################### Text Fields ############################### addTextFields(kicad_mod=kicad_mod, configuration=configuration, body_edges=body_edge, @@ -230,15 +196,6 @@ def generate_one_footprint(pins, series_params, configuration): configuration['kicad4_compatible'] = args.kicad4_compatible - #tuple argument meaning: [start,end] list for range of pin counts, MPN suffix, material, optional list of missing pins - #the first two tuples generate the fully-stuffed parts while the last tuple makes a 3-pin part with pin 2 missing - #here are examples from page 4 of the datasheet (this can generate non-contiguous pin numbers so be careful!): - #1) B6P7-VH: ([7,8], series, series, [6]) - #2) B6P7-VH-L: ([7,8], series + "-L", series, [2]) - #3) 1. B4P7-VH: ([7,8], series, series, [2,4,6]) - #3) 2. B3P7-VH: ([7,8], series, series, [2,3,5,6]) - #3) 3. B3P9-VH: ([9,10], series, series, [2,3,4,6,7,8]) - #for series_params in [([7,8], series, series, [6]), ([7,8], series + "-L", series, [2]), ([7,8], series, series, [2,4,6]), ([7,8], series, series, [2,3,5,6]), ([9,10], series, series, [2,3,4,6,7,8])]: - for series_params in [([2,11], series, series), ([2,12], series + "-B", series + " PBT"), ([3,4], series, series, [2])]: - for pincount in range(series_params[0][0], series_params[0][1]): + for series_params in [(11, "VH", "VH", "vh"), (12, "VH-B", "VH PBT", "vh pbt")]: + for pincount in range(2, series_params[0]): generate_one_footprint(pincount, series_params, configuration) diff --git a/scripts/Connector/Connector_Molex/conn_molex_SPOX_tht_side.py b/scripts/Connector/Connector_Molex/conn_molex_SPOX_tht_side.py deleted file mode 100644 index cfa1297a9..000000000 --- a/scripts/Connector/Connector_Molex/conn_molex_SPOX_tht_side.py +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/env python3 - -''' -kicad-footprint-generator is free software: you can redistribute it and/or -modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -kicad-footprint-generator is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with kicad-footprint-generator. If not, see < http://www.gnu.org/licenses/ >. -''' - -import sys -import os -#sys.path.append(os.path.join(sys.path[0],"..","..","kicad_mod")) # load kicad_mod path - -# export PYTHONPATH="${PYTHONPATH}" -sys.path.append(os.path.join(sys.path[0], "..", "..", "..")) # load parent path of KicadModTree -from math import sqrt -import argparse -import yaml -from helpers import * -from KicadModTree import * - -sys.path.append(os.path.join(sys.path[0], "..", "..", "tools")) # load parent path of tools -from footprint_text_fields import addTextFields - -series = "SPOX" -series_long = 'SPOX Connector System' -manufacturer = 'Molex' -orientation = 'H' -number_of_rows = 1 -datasheet = 'https://www.molex.com/pdm_docs/sd/022057045_sd.pdf' - -#pins_per_row per row -pins_per_row_range = range(2, 16) - -#Molex part number -#n = number of circuits per row -part_code = "5268-{n:02}A" - -pitch = 2.5 -drill = 0.85 - -pad_to_pad_clearance = 0.8 -max_annular_ring = 0.5 -min_annular_ring = 0.15 - -pad_size = [pitch - pad_to_pad_clearance, drill + 2 * max_annular_ring] -if pad_size[0] - drill < 2 * min_annular_ring: - pad_size[0] = drill + 2 * min_annular_ring -if pad_size[0] - drill > 2 * max_annular_ring: - pad_size[0] = drill + 2 * max_annular_ring - -pad_shape = Pad.SHAPE_OVAL -if pad_size[1] == pad_size[0]: - pad_shape=Pad.SHAPE_CIRCLE - -def generate_one_footprint(pins_per_row, configuration): - mpn = part_code.format(n = pins_per_row * number_of_rows) - - # handle arguments - orientation_str = configuration['orientation_options'][orientation] - footprint_name = configuration['fp_name_format_string'].format(man = manufacturer, - series = series, - mpn = mpn, num_rows = number_of_rows, pins_per_row = pins_per_row, mounting_pad = "", - pitch = pitch, orientation = orientation_str) - - kicad_mod = Footprint(footprint_name) - kicad_mod.setDescription("Molex {:s}, {:s}, {:d} Pins per row ({:s}), generated with kicad-footprint-generator".format(series_long, mpn, pins_per_row, datasheet)) - kicad_mod.setTags(configuration['keyword_fp_string'].format(series = series, - orientation = orientation_str, man = manufacturer, - entry = configuration['entry_direction'][orientation])) - - A = (pins_per_row - 1) * pitch - C = A + 2 * 2.45 - - #connector width - W = 7.9 - chamfer_pin_n = {'x': 1, 'y': 1} - - off = configuration['silk_fab_offset'] - pad_silk_off = configuration['silk_pad_clearance'] + configuration['silk_line_width'] / 2 - - body_edge = {} - body_edge['left'] = (A - C) / 2 - body_edge['right'] = body_edge['left'] + C - body_edge['top'] = -(7.9 - 6.6) - body_edge['bottom'] = body_edge['top'] + W - - bounding_box = body_edge.copy() - - # generate the pads - optional_pad_params = {} - if configuration['kicad4_compatible']: - optional_pad_params['tht_pad1_shape'] = Pad.SHAPE_RECT - else: - optional_pad_params['tht_pad1_shape'] = Pad.SHAPE_ROUNDRECT - - kicad_mod.append(PadArray(start = [0, 0], pincount = pins_per_row, x_spacing = pitch, - type = Pad.TYPE_THT, shape = pad_shape, size = pad_size, drill = drill, - layers = Pad.LAYERS_THT, - **optional_pad_params)) - - def generateOutline(off = 0, grid = 0): - poly = [ - {'x': body_edge['left'] - off, 'y': body_edge['top'] - off}, - {'x': body_edge['left'] - off, 'y': body_edge['bottom'] + off}, - {'x': body_edge['right']+off, 'y':body_edge['bottom'] +off}, - {'x': body_edge['right'] + off, 'y': body_edge['top'] - off}, - {'x': body_edge['left'] - off, 'y': body_edge['top'] - off}, - ] - if grid == 0: - return poly - else: - return [{'x': roundToBase(p['x'], grid), 'y': roundToBase(p['y'], grid)} for p in poly] - - # outline on Fab - kicad_mod.append(PolygoneLine(polygone = generateOutline(), - layer = 'F.Fab', width = configuration['fab_line_width'])) - - # outline on SilkScreen - kicad_mod.append(PolygoneLine(polygone = generateOutline(off = off), - layer = 'F.SilkS', width = configuration['silk_line_width'])) - - #pin-1 mark - sl = 2 - o = off + 0.3 - pin = [ - {'y': body_edge['top'] + sl, 'x': body_edge['left'] - o}, - {'y': body_edge['top'] - o, 'x': body_edge['left'] - o}, - {'y': body_edge['top'] - o, 'x': body_edge['left'] + sl} - ] - kicad_mod.append(PolygoneLine(polygone = pin, - layer = 'F.SilkS', width = configuration['silk_line_width'])) - - sl = 1 - pin = [ - {'y': sl / 2, 'x': body_edge['left']}, - {'y': 0, 'x': body_edge['left'] + sl / sqrt(2)}, - {'y': -sl / 2, 'x': body_edge['left']} - ] - kicad_mod.append(PolygoneLine(polygone = pin, - width = configuration['fab_line_width'], layer = 'F.Fab')) - - ########################### CrtYd ################################# - poly_crtyd = generateOutline(configuration['courtyard_offset']['connector'], configuration['courtyard_grid']) - cy1 = poly_crtyd[0]['y'] - cy2 = poly_crtyd[1]['y'] - kicad_mod.append(PolygoneLine( - polygone = poly_crtyd, - layer = 'F.CrtYd', width = configuration['courtyard_line_width'])) - - ######################### Text Fields ############################### - addTextFields(kicad_mod = kicad_mod, configuration = configuration, body_edges = body_edge, - courtyard = {'top': cy1, 'bottom': cy2}, - fp_name = footprint_name, text_y_inside_position = 'bottom') - - ##################### Output and 3d model ############################ - model3d_path_prefix = configuration.get('3d_model_prefix', '${KISYS3DMOD}/') - - lib_name = configuration['lib_name_format_string'].format(series = series, man = manufacturer) - model_name = '{model3d_path_prefix:s}{lib_name:s}.3dshapes/{fp_name:s}.wrl'.format( - model3d_path_prefix = model3d_path_prefix, lib_name = lib_name, fp_name = footprint_name) - kicad_mod.append(Model(filename = model_name)) - - output_dir = '{lib_name:s}.pretty/'.format(lib_name = lib_name) - if not os.path.isdir(output_dir): #returns false if path does not yet exist!! (Does not check path validity) - os.makedirs(output_dir) - filename = '{outdir:s}{fp_name:s}.kicad_mod'.format(outdir = output_dir, fp_name = footprint_name) - - file_handler = KicadFileHandler(kicad_mod) - file_handler.writeFile(filename) - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description='use confing .yaml files to create footprints.') - parser.add_argument('--global_config', type=str, nargs='?', help='the config file defining how the footprint will look like. (KLC)', default='../../tools/global_config_files/config_KLCv3.0.yaml') - parser.add_argument('--series_config', type=str, nargs='?', help='the config file defining series parameters.', default='../conn_config_KLCv3.yaml') - parser.add_argument('--kicad4_compatible', action='store_true', help='Create footprints kicad 4 compatible') - args = parser.parse_args() - - with open(args.global_config, 'r') as config_stream: - try: - configuration = yaml.safe_load(config_stream) - except yaml.YAMLError as exc: - print(exc) - - with open(args.series_config, 'r') as config_stream: - try: - configuration.update(yaml.safe_load(config_stream)) - except yaml.YAMLError as exc: - print(exc) - - configuration['kicad4_compatible'] = args.kicad4_compatible - - for pins_per_row in pins_per_row_range: - generate_one_footprint(pins_per_row, configuration) diff --git a/scripts/Connector/Connector_SMD_single_row_plus_mounting_pad/conn_hirose.yaml b/scripts/Connector/Connector_SMD_single_row_plus_mounting_pad/conn_hirose.yaml index 1ccb0e8a2..b3f99e118 100644 --- a/scripts/Connector/Connector_SMD_single_row_plus_mounting_pad/conn_hirose.yaml +++ b/scripts/Connector/Connector_SMD_single_row_plus_mounting_pad/conn_hirose.yaml @@ -2,29 +2,6 @@ group_definitions: manufacturer: 'Hirose' device_definition: - DF3EA: - series: '' - mpn_format_string: 'DF3EA-{pincount:02d}P-2H' - orientation: 'H' - datasheet: 'https://www.hirose.com/product/document?clcode=CL0543-0332-0-51&productname=DF3EA-5P-2H(51)&series=DF3&documenttype=2DDrawing&lang=en&documentid=0001163317' - pinrange: ['list', [2,3,4,5,6,7,8,9,10,11,12,13,14,15]] - text_inside_pos: 'center' - pitch: 2 - pad1_position: 'top-left' - mounting_pad_size: [2.3, 3.3] - # x position mounting inner mounting pad edge relative to nearest pad center - center_pad_to_mounting_pad_edge: 3.37 #(D-B)/2 - # y dimensions for pad given relative to mounting pad edge - rel_pad_y_outside_edge: 8.8 - rel_pad_y_inside_edge: 5.7 - pad_size_x: 1.2 - # y position for body edge relative to mounting pad edge (positive -> body extends outside bounding box) - rel_body_edge_y: 0.45 - body_size_y: 5.9 - # body_fin_protrusion: 1.6 - # body_fin_width: 0.8 - # x body edge relative to nearest pin - rel_body_edge_x: 3.25 # DF13C: # series: 'DF13C' # mpn_format_string: 'CL535-04{pincount:02d}-{param_1:s}-51' diff --git a/scripts/Mounting_Hardware/wuerth_smt_spacer.py b/scripts/Mounting_Hardware/wuerth_smt_spacer.py deleted file mode 100644 index 249b5c9a2..000000000 --- a/scripts/Mounting_Hardware/wuerth_smt_spacer.py +++ /dev/null @@ -1,141 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import os -#sys.path.append(os.path.join(sys.path[0],"..","..","kicad_mod")) # load kicad_mod path - -# export PYTHONPATH="${PYTHONPATH}" -sys.path.append(os.path.join(sys.path[0], "..", "..")) # load parent path of KicadModTree -import argparse -import yaml -from KicadModTree import * - -sys.path.append(os.path.join(sys.path[0], "..", "tools")) # load parent path of tools -from footprint_text_fields import addTextFields - -def roundToBase(value, base): - return round(value/base) * base - -def generate_footprint(params, mpn, configuration): - fp_params = params['footprint'] - mech_params = params['mechanical'] - part_params = params['parts'][mpn] - - if 'id' in mech_params: - size = str(mech_params['id']) - elif 'ext_thread' in mech_params: - size = str(mech_params['ext_thread']['od']) - - if 'M' not in size: - size = "{}mm".format(size) - - td = "" - size_prefix = "" - hole_type = "inside through hole" - if 'thread_depth' in part_params: - hole_type = "inside blind hole" - td = "_ThreadDepth{}mm".format(part_params['thread_depth']) - elif 'ext_thread' in mech_params: - hole_type = "external" - size_prefix = 'External' - - h = part_params['h'] if 'h' in part_params else part_params['h1'] - - suffix = '' - if 'suffix' in params: - suffix = '_{}'.format(params['suffix']) - - fp_name = "Mounting_Wuerth_{series}-{size_prefix}{size}_H{h}mm{td}{suffix}_{mpn}".format( - size=size, h=h, mpn=mpn, td=td, size_prefix=size_prefix, - series=params['series_prefix'], suffix=suffix) - - kicad_mod = Footprint(fp_name) - kicad_mod.setAttribute('smd') - - kicad_mod.setDescription("Mounting Hardware, {hole_type} {size}, height {h}, Wuerth electronics {mpn} ({ds:s}), generated with kicad-footprint-generator".format(size=size, h=h, mpn=mpn, ds=part_params['datasheet'], hole_type=hole_type)) - - kicad_mod.setTags('Mounting {} {}'.format(size, mpn)) - - paste_count = fp_params['ring']['paste'].get('paste_count', 4) - - kicad_mod.append( - RingPad( - number='1', at=(0, 0), - size=fp_params['ring']['od'], inner_diameter=fp_params['ring']['id'], - num_anchor=4, num_paste_zones=paste_count, - paste_round_radius_radio=0.25, - paste_max_round_radius=0.1, - paste_to_paste_clearance=fp_params['ring']['paste']['clearance'], - paste_inner_diameter=fp_params['ring']['paste']['id'], - paste_outer_diameter=fp_params['ring']['paste']['od'] - )) - if 'npth' in fp_params: - kicad_mod.append( - Pad(at=[0, 0], number="", - type=Pad.TYPE_NPTH, shape=Pad.SHAPE_CIRCLE, size=fp_params['npth'], - drill=fp_params['npth'], layers=Pad.LAYERS_NPTH)) - - kicad_mod.append( - Circle( - center=[0, 0], radius=mech_params['od']/2, - layer='F.Fab', width=configuration['fab_line_width'] - )) - - ########################### CrtYd ################################# - rc = max(mech_params['od'], fp_params['ring']['od'])/2+configuration['courtyard_offset']['default'] - rc = roundToBase(rc, configuration['courtyard_grid']) - - - kicad_mod.append( - Circle( - center=[0, 0], radius=rc, - layer='F.CrtYd', width=configuration['courtyard_line_width'] - )) - - ########################### SilkS ################################# - - - - ######################### Text Fields ############################### - rb = mech_params['od']/2 - body_edge={'left':-rb, 'right':rb, 'top':-rb, 'bottom':rb} - addTextFields(kicad_mod=kicad_mod, configuration=configuration, body_edges=body_edge, - courtyard={'top':-rc, 'bottom':rc}, fp_name=fp_name, text_y_inside_position='center') - - ##################### Output and 3d model ############################ - model3d_path_prefix = configuration.get('3d_model_prefix','${KISYS3DMOD}/') - - lib_name = "Mounting_Wuerth" - model_name = '{model3d_path_prefix:s}{lib_name:s}.3dshapes/{fp_name:s}.wrl'.format( - model3d_path_prefix=model3d_path_prefix, lib_name=lib_name, fp_name=fp_name) - kicad_mod.append(Model(filename=model_name)) - - output_dir = '{lib_name:s}.pretty/'.format(lib_name=lib_name) - if not os.path.isdir(output_dir): #returns false if path does not yet exist!! (Does not check path validity) - os.makedirs(output_dir) - filename = '{outdir:s}{fp_name:s}.kicad_mod'.format(outdir=output_dir, fp_name=fp_name) - - file_handler = KicadFileHandler(kicad_mod) - file_handler.writeFile(filename) - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description='use confing .yaml files to create footprints.') - parser.add_argument('--global_config', type=str, nargs='?', help='the config file defining how the footprint will look like. (KLC)', default='../tools/global_config_files/config_KLCv3.0.yaml') - parser.add_argument('--params', type=str, nargs='?', help='the part definition file', default='./wuerth_smt_spacer.yaml') - args = parser.parse_args() - - with open(args.global_config, 'r') as config_stream: - try: - configuration = yaml.safe_load(config_stream) - except yaml.YAMLError as exc: - print(exc) - - with open(args.params, 'r') as params_stream: - try: - params = yaml.safe_load(params_stream) - except yaml.YAMLError as exc: - print(exc) - - for series in params: - for mpn in params[series]['parts']: - generate_footprint(params[series], mpn, configuration) diff --git a/scripts/Mounting_Hardware/wuerth_smt_spacer.yaml b/scripts/Mounting_Hardware/wuerth_smt_spacer.yaml deleted file mode 100644 index 188550079..000000000 --- a/scripts/Mounting_Hardware/wuerth_smt_spacer.yaml +++ /dev/null @@ -1,789 +0,0 @@ -2.25mm: - series_prefix: WA-SMST - footprint: - ring: - id: 3 - od: 5.3 - paste: - clearance: 0.6 - id: 3.1 - od: 5.12 - npth: 3 - mechanical: - id: 2.25 - od: 4.35 - od1: 2.8 - h1: 1.4 - parts: - 9774010943: - datasheet: https://katalog.we-online.de/em/datasheet/9774010943.pdf - h: 1 - 9774015943: - datasheet: https://katalog.we-online.de/em/datasheet/9774015943.pdf - h: 1.5 - 9774020943: - datasheet: https://katalog.we-online.de/em/datasheet/9774020943.pdf - h: 2 - 9774025943: - datasheet: https://katalog.we-online.de/em/datasheet/9774025943.pdf - h: 2.5 - 9774030943: - datasheet: https://katalog.we-online.de/em/datasheet/9774030943.pdf - h: 3 - 9774035943: - datasheet: https://katalog.we-online.de/em/datasheet/9774035943.pdf - h: 3.5 - 9774040943: - datasheet: https://katalog.we-online.de/em/datasheet/9774040943.pdf - h: 4 - 9774045943: - datasheet: https://katalog.we-online.de/em/datasheet/9774045943.pdf - h: 4.5 - 9774050943: - datasheet: https://katalog.we-online.de/em/datasheet/9774050943.pdf - h: 5 - 9774060943: - datasheet: https://katalog.we-online.de/em/datasheet/9774060943.pdf - h: 6 - 9774070943: - datasheet: https://katalog.we-online.de/em/datasheet/9774070943.pdf - h: 7 - 9774080943: - datasheet: https://katalog.we-online.de/em/datasheet/9774080943.pdf - h: 8 - -2.7mm: - series_prefix: WA-SMST - footprint: - ring: - id: 3.7 - od: 6 - paste: - clearance: 0.65 - id: 3.8 - od: 5.84 - npth: 3.7 - mechanical: - id: 2.7 - od: 5.1 - od1: 3.5 - h1: 1.4 - parts: - 9774010951: - datasheet: https://katalog.we-online.de/em/datasheet/9774010951.pdf - h: 1 - 9774015951: - datasheet: https://katalog.we-online.de/em/datasheet/9774015951.pdf - h: 1.5 - 9774020951: - datasheet: https://katalog.we-online.de/em/datasheet/9774020951.pdf - h: 2 - 9774025951: - datasheet: https://katalog.we-online.de/em/datasheet/9774025951.pdf - h: 2.5 - 9774030951: - datasheet: https://katalog.we-online.de/em/datasheet/9774030951.pdf - h: 3 - 9774040951: - datasheet: https://katalog.we-online.de/em/datasheet/9774040951.pdf - h: 4 - 9774050951: - datasheet: https://katalog.we-online.de/em/datasheet/9774050951.pdf - h: 5 - 9774055951: - datasheet: https://katalog.we-online.de/em/datasheet/9774055951.pdf - h: 5.5 - 9774060951: - datasheet: https://katalog.we-online.de/em/datasheet/9774060951.pdf - h: 6 - 9774065951: - datasheet: https://katalog.we-online.de/em/datasheet/9774065951.pdf - h: 6.5 - 9774070951: - datasheet: https://katalog.we-online.de/em/datasheet/9774070951.pdf - h: 7 - 9774080951: - datasheet: https://katalog.we-online.de/em/datasheet/9774080951.pdf - h: 8 - 9774090951: - datasheet: https://katalog.we-online.de/em/datasheet/9774090951.pdf - h: 9 - 9774100951: - datasheet: https://katalog.we-online.de/em/datasheet/9774100951.pdf - h: 10 - -3.3mm: - series_prefix: WA-SMST - footprint: - ring: - id: 4.4 - od: 7.4 - paste: # measured from eagle footprint (not dimensioned in datasheet) - clearance: 0.5 - id: 4.72 - od: 6.92 - npth: 4.4 - mechanical: - id: 3.3 - od: 6 - od1: 4.2 - h1: 1.4 - parts: - 9774010960: - datasheet: https://katalog.we-online.de/em/datasheet/9774010960.pdf, - h: 1 - 9774015960: - datasheet: https://katalog.we-online.de/em/datasheet/9774015960.pdf, - h: 1.5 - 9774020960: - datasheet: https://katalog.we-online.de/em/datasheet/9774020960.pdf, - h: 2 - 9774025960: - datasheet: https://katalog.we-online.de/em/datasheet/9774025960.pdf, - h: 2.5 - 9774030960: - datasheet: https://katalog.we-online.de/em/datasheet/9774030960.pdf, - h: 3 - 9774040960: - datasheet: https://katalog.we-online.de/em/datasheet/9774040960.pdf, - h: 4 - 9774050960: - datasheet: https://katalog.we-online.de/em/datasheet/9774050960.pdf, - h: 5 - 9774060960: - datasheet: https://katalog.we-online.de/em/datasheet/9774060960.pdf, - h: 6 - 9774070960: - datasheet: https://katalog.we-online.de/em/datasheet/9774070960.pdf, - h: 7 - 9774080960: - datasheet: https://katalog.we-online.de/em/datasheet/9774080960.pdf, - h: 8 - 9774090960: - datasheet: https://katalog.we-online.de/em/datasheet/9774090960.pdf, - h: 9 - 9774100960: - datasheet: https://katalog.we-online.de/em/datasheet/9774100960.pdf, - h: 10 - 9774110960: - datasheet: https://katalog.we-online.de/em/datasheet/9774110960.pdf, - h: 11 - 9774120960: - datasheet: https://katalog.we-online.de/em/datasheet/9774120960.pdf, - h: 12 - 9774130960: - datasheet: https://katalog.we-online.de/em/datasheet/9774130960.pdf, - h: 13 - 9774140960: - datasheet: https://katalog.we-online.de/em/datasheet/9774140960.pdf, - h: 14 - 9774150960: - datasheet: https://katalog.we-online.de/em/datasheet/9774150960.pdf, - h: 15 - -4.5mm: - series_prefix: WA-SMST - footprint: - ring: - id: 5.4 - od: 9.4 - paste: - clearance: 0.8 - id: 5.48 - od: 9.27 - npth: 5.4 - mechanical: - id: 4.5 - od: 8.2 - od1: 5.2 - h1: 1.4 - parts: - 9774010982: - datasheet: https://katalog.we-online.de/em/datasheet/9774010982.pdf - h: 1 - 9774020982: - datasheet: https://katalog.we-online.de/em/datasheet/9774020982.pdf - h: 2 - 9774030982: - datasheet: https://katalog.we-online.de/em/datasheet/9774030982.pdf - h: 3 - 9774040982: - datasheet: https://katalog.we-online.de/em/datasheet/9774040982.pdf - h: 4 - 9774050982: - datasheet: https://katalog.we-online.de/em/datasheet/9774050982.pdf - h: 5 - 9774060982: - datasheet: https://katalog.we-online.de/em/datasheet/9774060982.pdf - h: 6 - 9774070982: - datasheet: https://katalog.we-online.de/em/datasheet/9774070982.pdf - h: 7 - 9774080982: - datasheet: https://katalog.we-online.de/em/datasheet/9774080982.pdf - h: 8 - 9774090982: - datasheet: https://katalog.we-online.de/em/datasheet/9774090982.pdf - h: 9 - 9774100982: - datasheet: https://katalog.we-online.de/em/datasheet/9774100982.pdf - h: 10 - -M1.6: - series_prefix: WA-SMSI - footprint: - ring: - id: 2.1 - od: 4 - paste: - clearance: 0.4 - id: 2.2 - od: 3.8 - npth: 2.1 - mechanical: - id: M1.6 - od: 3.3 - od1: 1.9 - h1: 0.7 - parts: - 9774010633: - datasheet: https://katalog.we-online.com/em/datasheet/9774010633.pdf - h: 1 - 9774015633: - datasheet: https://katalog.we-online.com/em/datasheet/9774015633.pdf - h: 1.5 - 9774020633: - datasheet: https://katalog.we-online.com/em/datasheet/9774020633.pdf - h: 2 - 9774025633: - datasheet: https://katalog.we-online.com/em/datasheet/9774025633.pdf - h: 2.5 - 9774030633: - datasheet: https://katalog.we-online.com/em/datasheet/9774030633.pdf - h: 3 - 97730356334: - datasheet: https://katalog.we-online.com/em/datasheet/97730356334.pdf - h: 3.5 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730406334: - datasheet: https://katalog.we-online.com/em/datasheet/97730406334.pdf - h: 4 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730456334: - datasheet: https://katalog.we-online.com/em/datasheet/97730456334.pdf - h: 4.5 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730506334: - datasheet: https://katalog.we-online.com/em/datasheet/97730506334.pdf - h: 5 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730606334: - datasheet: https://katalog.we-online.com/em/datasheet/97730606334.pdf - h: 6 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - -M1.6_s: - series_prefix: WA-SMSI - footprint: - ring: - id: 1 - od: 4 - paste: - paste_count: 2 - clearance: 1.1 - id: 1.2 - od: 3.8 - npth: 1 - mechanical: - id: M1.6 - od: 3.3 - od1: 0.8 - h1: 0.5 - parts: - 97730256332: - datasheet: https://katalog.we-online.com/em/datasheet/97730256332.pdf - h: 2.5 - thread_depth: 1.5 - drill_depth: 1.63 # from 3d model - 97730306332: - datasheet: https://katalog.we-online.com/em/datasheet/97730306332.pdf - h: 3 - thread_depth: 1.8 - drill_depth: 1.93 # from 3d model - 97730356332: - datasheet: https://katalog.we-online.com/em/datasheet/97730356332.pdf - h: 3.5 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730406332: - datasheet: https://katalog.we-online.com/em/datasheet/97730406332.pdf - h: 4 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730456332: - datasheet: https://katalog.we-online.com/em/datasheet/97730456332.pdf - h: 4.5 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730506332: - datasheet: https://katalog.we-online.com/em/datasheet/97730506332.pdf - h: 5 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730606332: - datasheet: https://katalog.we-online.com/em/datasheet/97730606332.pdf - h: 6 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - -M1.6_smt: - series_prefix: WA-SMSI - suffix: NoNPTH - footprint: - ring: - id: 0 - od: 4 - paste: - clearance: 0.3 - id: 0.6 # 2*clearance to ensure proper handling (would need to implement a segment instead of an arc to really handle this. Too much work for now.) - od: 3.8 - mechanical: - id: M1.6 - od: 3.3 - parts: - 97730256330: - datasheet: https://katalog.we-online.com/em/datasheet/97730256330R.pdf - h: 2.5 - thread_depth: 1.5 - drill_depth: 1.63 # from 3d model - 97730306330: - datasheet: https://katalog.we-online.com/em/datasheet/97730306330.pdf - h: 3 - thread_depth: 1.8 - drill_depth: 1.93 # from 3d model - 97730356330: - datasheet: https://katalog.we-online.com/em/datasheet/97730356330.pdf - h: 3.5 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730406330: - datasheet: https://katalog.we-online.com/em/datasheet/97730406330.pdf - h: 4 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730456330: - datasheet: https://katalog.we-online.com/em/datasheet/97730456330.pdf - h: 4.5 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730506330: - datasheet: https://katalog.we-online.com/em/datasheet/97730506330.pdf - h: 5 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - 97730606330: - datasheet: https://katalog.we-online.com/em/datasheet/97730606330.pdf - h: 6 - thread_depth: 2 - drill_depth: 3.13 # from 3d model - -M2: - series_prefix: WA-SMSI - footprint: - ring: - id: 3 - od: 5.3 - paste: # from 2.25mm ID version (Has same mechanical dimensions) - clearance: 0.6 - id: 3.1 - od: 5.12 - npth: 3 - mechanical: - id: M2 - od: 4.35 - od1: 2.8 - h1: 1.4 - parts: - 9774010243: - datasheet: https://katalog.we-online.de/em/datasheet/9774010243.pdf - h: 1 - 9774015243: - datasheet: https://katalog.we-online.de/em/datasheet/9774015243.pdf - h: 1.5 - 9774020243: - datasheet: https://katalog.we-online.de/em/datasheet/9774020243.pdf - h: 2 - 9774025243: - datasheet: https://katalog.we-online.de/em/datasheet/9774025243.pdf - h: 2.5 - 9774030243: - datasheet: https://katalog.we-online.de/em/datasheet/9774030243.pdf - h: 3 - 9774035243: - datasheet: https://katalog.we-online.de/em/datasheet/9774035243.pdf - h: 3.5 - 9774040243: - datasheet: https://katalog.we-online.de/em/datasheet/9774040243.pdf - h: 4 - 9774045243: - datasheet: https://katalog.we-online.de/em/datasheet/9774045243.pdf - h: 4.5 - 9774050243: - datasheet: https://katalog.we-online.de/em/datasheet/9774050243.pdf - h: 5 - 9774060243: - datasheet: https://katalog.we-online.de/em/datasheet/9774060243.pdf - h: 6 - 9774070243: - datasheet: https://katalog.we-online.de/em/datasheet/9774070243.pdf - h: 7 - 9774080243: - datasheet: https://katalog.we-online.de/em/datasheet/9774080243.pdf - h: 8 - -M3: - series_prefix: WA-SMSI - footprint: - ring: - id: 4.4 - od: 7.4 - paste: # measured from eagle footprint (not dimensioned in datasheet) - clearance: 0.5 - id: 4.72 - od: 6.92 - npth: 4.4 - mechanical: - id: M3 - od: 6 - od1: 4.2 - h1: 1.4 - parts: - 9774010360: - datasheet: https://katalog.we-online.de/em/datasheet/9774010360.pdf - h: 1 - 9774015360: - datasheet: https://katalog.we-online.de/em/datasheet/9774015360.pdf - h: 1.5 - 9774020360: - datasheet: https://katalog.we-online.de/em/datasheet/9774020360.pdf - h: 2 - 9774025360: - datasheet: https://katalog.we-online.de/em/datasheet/9774025360.pdf - h: 2.5 - 9774030360: - datasheet: https://katalog.we-online.de/em/datasheet/9774030360R.pdf - h: 3 - 9774040360: - datasheet: https://katalog.we-online.de/em/datasheet/9774040360.pdf - h: 4 - 9774050360: - datasheet: https://katalog.we-online.de/em/datasheet/9774050360.pdf - h: 5 - 9774060360: - datasheet: https://katalog.we-online.de/em/datasheet/9774060360.pdf - h: 6 - 9774070360: - datasheet: https://katalog.we-online.de/em/datasheet/9774070360.pdf - h: 7 - 9774080360: - datasheet: https://katalog.we-online.de/em/datasheet/9774080360.pdf - h: 8 - 9774090360: - datasheet: https://katalog.we-online.de/em/datasheet/9774090360.pdf - h: 9 - 9774100360: - datasheet: https://katalog.we-online.de/em/datasheet/9774100360.pdf - h: 10 - 9774110360: - datasheet: https://katalog.we-online.de/em/datasheet/9774110360.pdf - h: 11 - 9774120360: - datasheet: https://katalog.we-online.de/em/datasheet/9774120360.pdf - h: 12 - 9774130360: - datasheet: https://katalog.we-online.de/em/datasheet/9774130360.pdf - h: 13 - 9774140360: - datasheet: https://katalog.we-online.de/em/datasheet/9774140360.pdf - h: 14 - 9774150360: - datasheet: https://katalog.we-online.de/em/datasheet/9774150360.pdf - h: 15 - -M4: - series_prefix: WA-SMSI - footprint: - ring: - id: 5.4 - od: 9.4 - paste: - clearance: 0.8 - id: 5.48 - od: 9.27 - npth: 5.4 - mechanical: - id: 4.5 - od: 8.2 - od1: 5.2 - h1: 1.4 - parts: - 9774010482: - datasheet: https://katalog.we-online.de/em/datasheet/9774010482.pdf - h: 1 - 9774020482: - datasheet: https://katalog.we-online.de/em/datasheet/9774020482.pdf - h: 2 - 9774030482: - datasheet: https://katalog.we-online.de/em/datasheet/9774030482.pdf - h: 3 - 9774040482: - datasheet: https://katalog.we-online.de/em/datasheet/9774040482.pdf - h: 4 - 9774050482: - datasheet: https://katalog.we-online.de/em/datasheet/9774050482.pdf - h: 5 - 9774060482: - datasheet: https://katalog.we-online.de/em/datasheet/9774060482.pdf - h: 6 - 9774070482: - datasheet: https://katalog.we-online.de/em/datasheet/9774070482.pdf - h: 7 - 9774080482: - datasheet: https://katalog.we-online.de/em/datasheet/9774080482.pdf - h: 8 - 9774090482: - datasheet: https://katalog.we-online.de/em/datasheet/9774090482.pdf - h: 9 - 9774100482: - datasheet: https://katalog.we-online.de/em/datasheet/9774100482.pdf - h: 10 - -3.2R: - series_prefix: WA-SMSR - suffix: ReverseMount - footprint: - ring: - id: 4.5 - od: 7.4 - paste: - clearance: 0.8 - id: 4.58 - od: 7.27 - npth: 4.4 - mechanical: - id: 3.2 - od: 6 - od1: 4.2 - h: 1 - parts: - 9775026960: - datasheet: https://katalog.we-online.com/em/datasheet/9775026960R.pdf - h1: 2.6 - 9775031960: - datasheet: https://katalog.we-online.com/em/datasheet/9775031960.pdf - h1: 3.1 - 9775036960: - datasheet: https://katalog.we-online.com/em/datasheet/9775036960.pdf - h1: 3.6 - 9775041960: - datasheet: https://katalog.we-online.com/em/datasheet/9775041960.pdf - h1: 4.1 - 9775046960: - datasheet: https://katalog.we-online.com/em/datasheet/9775046960.pdf - h1: 4.6 - 9775051960: - datasheet: https://katalog.we-online.com/em/datasheet/9775051960.pdf - h1: 5.1 - 9775056960: - datasheet: https://katalog.we-online.com/em/datasheet/9775056960.pdf - h1: 5.6 - 9775066960: - datasheet: https://katalog.we-online.com/em/datasheet/9775066960.pdf - h1: 6.6 - 9775076960: - datasheet: https://katalog.we-online.com/em/datasheet/9775076960.pdf - h1: 7.6 - 9775086960: - datasheet: https://katalog.we-online.com/em/datasheet/9775086960.pdf - h1: 8.6 - 9775096960: - datasheet: https://katalog.we-online.com/em/datasheet/9775096960.pdf - h1: 9.6 - 9775106960: - datasheet: https://katalog.we-online.com/em/datasheet/9775106960.pdf - h1: 10.6 - 9775116960: - datasheet: https://katalog.we-online.com/em/datasheet/9775116960.pdf - h1: 11.6 - -M3R: - series_prefix: WA-SMSR - suffix: ReverseMount - footprint: - ring: - id: 4.5 - od: 7.4 - paste: - clearance: 0.8 - id: 4.58 - od: 7.27 - npth: 4.4 - mechanical: - id: M3 - od: 6 - od1: 4.2 - h: 1 - parts: - 9775026360: - datasheet: https://katalog.we-online.com/em/datasheet/9775026360.pdf - h1: 2.6 - 9775031360: - datasheet: https://katalog.we-online.com/em/datasheet/9775031360.pdf - h1: 3.1 - 9775036360: - datasheet: https://katalog.we-online.com/em/datasheet/9775036360.pdf - h1: 3.6 - 9775041360: - datasheet: https://katalog.we-online.com/em/datasheet/9775041360.pdf - h1: 4.1 - 9775046360: - datasheet: https://katalog.we-online.com/em/datasheet/9775046360.pdf - h1: 4.6 - 9775051360: - datasheet: https://katalog.we-online.com/em/datasheet/9775051360.pdf - h1: 5.1 - 9775056360: - datasheet: https://katalog.we-online.com/em/datasheet/9775056360.pdf - h1: 5.6 - 9775066360: - datasheet: https://katalog.we-online.com/em/datasheet/9775066360.pdf - h1: 6.6 - 9775076360: - datasheet: https://katalog.we-online.com/em/datasheet/9775076360.pdf - h1: 7.6 - 9775086360: - datasheet: https://katalog.we-online.com/em/datasheet/9775086360.pdf - h1: 8.6 - 9775096360: - datasheet: https://katalog.we-online.com/em/datasheet/9775096360.pdf - h1: 9.6 - 9775106360: - datasheet: https://katalog.we-online.com/em/datasheet/9775106360.pdf - h1: 10.6 - 9775116360: - datasheet: https://katalog.we-online.com/em/datasheet/9775116360.pdf - h1: 11.6 - -snap: - series_prefix: WA-SMSSR - suffix: SnapRivet - footprint: - ring: - id: 4.4 - od: 7.4 - paste: - clearance: 0.8 - id: 4.48 - od: 7.27 - npth: 4.4 - mechanical: - id: 3.3 - id1: 2.15 - t1: 0.5 - od: 6 - od1: 4.2 - h1: 1.4 - parts: - 9776100960: - datasheet: https://katalog.we-online.com/em/datasheet/9776100960R.pdf - h: 10 - 9776020960: - datasheet: https://katalog.we-online.com/em/datasheet/9776020960.pdf - h: 2 - 9776025960: - datasheet: https://katalog.we-online.com/em/datasheet/9776025960.pdf - h: 2.5 - 9776030960: - datasheet: https://katalog.we-online.com/em/datasheet/9776030960.pdf - h: 3 - 9776040960: - datasheet: https://katalog.we-online.com/em/datasheet/9776040960.pdf - h: 4 - 9776050960: - datasheet: https://katalog.we-online.com/em/datasheet/9776050960.pdf - h: 5 - 9776060960: - datasheet: https://katalog.we-online.com/em/datasheet/9776060960.pdf - h: 6 - 9776070960: - datasheet: https://katalog.we-online.com/em/datasheet/9776070960.pdf - h: 7 - 9776080960: - datasheet: https://katalog.we-online.com/em/datasheet/9776080960.pdf - h: 8 - 9776090960: - datasheet: https://katalog.we-online.com/em/datasheet/9776090960.pdf - h: 9 - -external_m3: - series_prefix: WA-SMSE - footprint: - ring: - id: 1 - od: 7.4 - paste: - paste_count: 2 - clearance: 1.06 - id: 1.2 - od: 7.2 - npth: 1 - mechanical: - ext_thread: - od: M3 - L: 6 - undercut: - od: 2.2 - L: [0.5, 1.25] - r: 0.2 - od: 6 - od1: 0.8 - h1: 0.5 - parts: - 9771050360: - datasheet: https://katalog.we-online.com/em/datasheet/9771050360.pdf - h: 5 - 9771060360: - datasheet: https://katalog.we-online.com/em/datasheet/9771060360.pdf - h: 6 - 9771070360: - datasheet: https://katalog.we-online.com/em/datasheet/9771070360.pdf - h: 7 - 9771080360: - datasheet: https://katalog.we-online.com/em/datasheet/9771080360.pdf - h: 8 - 9771090360: - datasheet: https://katalog.we-online.com/em/datasheet/9771090360.pdf - h: 9 - 9771100360: - datasheet: https://katalog.we-online.com/em/datasheet/9771100360.pdf - h: 10 - 9771110360: - datasheet: https://katalog.we-online.com/em/datasheet/9771110360.pdf - h: 11 - 9771120360: - datasheet: https://katalog.we-online.com/em/datasheet/9771120360.pdf - h: 12 - 9771130360: - datasheet: https://katalog.we-online.com/em/datasheet/9771130360.pdf - h: 13 - 9771140360: - datasheet: https://katalog.we-online.com/em/datasheet/9771140360.pdf - h: 14 - 9771150360: - datasheet: https://katalog.we-online.com/em/datasheet/9771150360.pdf - h: 15 diff --git a/scripts/Mounting_Hardware/mounting_hole.py b/scripts/Mounting_Holes/mounting_hole.py similarity index 100% rename from scripts/Mounting_Hardware/mounting_hole.py rename to scripts/Mounting_Holes/mounting_hole.py diff --git a/scripts/Packages/Package_Gullwing__QFP_SOIC_SO/Readme.md b/scripts/Packages/Package_Gullwing__QFP_SOIC_SO/Readme.md deleted file mode 100644 index 716ffceb0..000000000 --- a/scripts/Packages/Package_Gullwing__QFP_SOIC_SO/Readme.md +++ /dev/null @@ -1,156 +0,0 @@ -# IPC gullwing generator - -This generator uses IPC-7351B equations and fillet definitions to derive a footprint for gullwing style packages from the dimensions of the package. (The suggested footprint is only used to determine the size of the exposed pad.) Fillet size definitions can be changed by pointing to a personalized IPC parameter file. The script generates footprints in zero orientation version A (pin 1 at top left corner). -Pads are generated using rounded rectangle pads as suggested in preliminary releases of IPC-7351C. - -Examples of supported packages include: QFP, SOIC, SO. - -## Running the script - -The script requires python 3.4 or newer. Run it with: -`python3 ipc_gullwing_generator.py size_definitions/eqfp.yaml` (replace `eqfp.yaml` with the size definition file that contains your part.) - -### Optional script parameters - -* --global_config: the config file defining how the footprint will look like. (KLC) (default=`../../tools/global_config_files/config_KLCv3.0.yaml`) -* --series_config: the config file defining series parameters (footprint naming). (default=`../package_config_KLCv3.yaml`) - -* --density: IPC density level (L,N,M) (default=`N`) -* --ipc_doc: IPC definition document (default=`../ipc_definitions.yaml`) - -* --force_rectangle_pads: Force the generation of rectangle pads instead of rounded rectangle -* --kicad4_compatible: Create footprints compatible with version 4 (avoids round-rect and custom pads). - -## Size definition format - -Every file contains a header with parameters applied to all parts. These define the common footprint name prefix and the output library. - -``` yaml -FileHeader: - library_Suffix: 'QFP' #resulting library name Package_QFP - device_type: 'EQFP' #footprint names will be of style ...EQFP-pincount_... -``` - ---- - -Every further entry in the script is assumed to be a package size definition. The top level parameter will give the internal parameter set name. This one must be unique in this file and should be representative of the footprint as it will be used in error messages. (It also makes later maintenance easier if it is easy to determine which footprint was generated by which parameter set.) - -``` yaml -internal_package_name: - # parameter list (See below) -``` - -### Documentation and naming parameters -- Size source to be added to footprint documentation field (`size_source`) {url} -- Footprint name generation control - - Manufacturer name. Will be added as a prefix if given. (`manufacturer`) {string} - - Part number. Will be added as a prefix if given. (`part_number`) {string} - - Suffix: A custom suffix (added after pin pitch in default naming format). Can include parameters `pad_x` and `pad_y`. - - Custom naming (`custom_name_format`) {python format string} - - The full default format string is `{man:s}_{mpn:s}_{pkg:s}-{pincount:d}-1EP_{size_x:g}x{size_y:g}mm_P{pitch:g}mm{suffix:s}_EP{ep_size_x:g}x{ep_size_y:g}mm_Mask{mask_size_x:g}x{mask_size_y:g}mm{suffix2:s}{vias:s}` (The same parameters can be used in your custom format. Exposed pad parameters are not available for components without exposed pad.) - -_Note: Contributions intended for the official library shall not include the manufacturer or part number unless the footprint is specific to that manufacturer or part. Similarly avoid custom naming for official library contributions unless required to achieve the requested name (Example TI-specific naming)._ - -### Package dimensions -![dimension example](./documentation/dimension_system.svg) -- Body size (`body_size_x`, `body_size_y`, `overall_height`) {dimension} -- Lead dimensions: - - Overall size representing lead tip to lead tip dimension (`overall_size_x`, `overall_size_y`) {dimension} - - Lead width (`lead_width`) {dimension} - - Lead length distance between the lead bend and lead tip (`lead_len`) {dimension} -- Lead pitch, currently equal for all sides (`pitch`) {float} - -### Pad count -- Pad count (`num_pins_x`, `num_pins_y`) {int} - - `num_pins_x`=0 is used for generating SOIC like packages. - - `num_pins_y`=0 is used to generate SOIC like package footprints but with inverted pin numbering (Mirrored numbering scheme. Some manufactures use this style in their datasheets. Make sure you are not looking at the bottom view before using this. Not supported for QFP and similar.) -- Exclude pads by pad number (`exclude_pin_list`) {[`pad number`]} - -### Exposed pad handling: -![exposed pad example](../documentation/ep_handling.svg) -- Size of package exposed pad or slug (`EP_size_x`, `EP_size_y`) {dimension} -- Size of the footprint pad [optional] (`EP_size_x_overwrite`, `EP_size_y_overwrite`) {float} - - Pad size is equal to nominal package pad size if not given. - - Use this to create a soldermask-defined pad. -- Optional the size of the mask cutout (`EP_mask_x`, `EP_mask_y`) {float} - - Use to create soldermask-defined pads (in combination with `EP_size_x_overwrite`) -- Paste is split into a regular grid with (`EP_num_paste_pads`) {[int (x), int (y)]} - - The optional paste coverage multiplier determines how much of the exposed copper area is covered by paste. (`EP_paste_coverage`) {float (0..1), default=0.65} - -### Thermal vias -A package with exposed pad can generate a version with thermal vias. This will be generated in addition to the normal version. - -![exposed pad example](../documentation/thermal_vias.svg) - -``` yaml - thermal_vias: - # thermal via version parameters -``` -- Number of vias generated in the regular grid (`count`) {[int (x), int (y)]} -- Final hole size (`drill`) {float} -- Optional grid (`grid`) {[float (x), float (y)]} - - Auto generated if not given (outermost pad will touch pad edge). -- Paste coverage overwrite [optional] (`EP_paste_coverage`) {float (0..1)} - - Thermal via version might need higher paste coverage compared to non-via version to compensate solder lost due to wicking. -- Paste generator can be set up to avoid placing paste on top of vias (`paste_avoid_via`) {bool} - - Clearance between via hole and paste (`paste_via_clearance`) {float} - - Can lead to math exceptions. Possible fixes: - - Reduce paste coverage (make sure you still have enough paste) - - Play with the via grid and number of paste pads (having an outer ring of paste pads often helps. This is only possible if there is space on the outside) - - If no fix is satisfactory then select avoid vias as false and increase paste coverage to combat solder loss. -- Number paste pads - - Quantity of paste pads (`EP_num_paste_pads`) {[int (x), int (y)]} - - Alternative available if `paste_avoid_via` is true - - Number of paste pads between 4 vias (`paste_between_vias`) {[int (x), int (y)]} - - Number of additional paste pad rings outside the outermost vias [optional] (`paste_rings_outside`) {[int (x), int (y)]} - - -## Dimension parameter format -Dimensions in datasheets are either given with minimum and maximum value (optionally including nominal) or with the nominal value plus a tolerance. Some values of the datasheet are given as reference value without tolerance. (Tolerances in this measurement are already included in other dimensions.) The script reflects this by offering the same options. - -Always include the nominal dimension if the tolerance is asymmetrical as the resulting footprint will differ if it is not included. - -_Note: Contributions that are intended for the official KiCad library must use the same dimensioning format as the datasheet. (If min, nom and max are given then all 3 must be entered into the YAML file even if the tolerance is symmetrical. Similarly use nominal plus tolerance format if the datasheet is dimensioned this way.)_ - -### String-based - -The parameter can be given as a string in one of the following formats (white space characters are ignored). - -```yaml -parameter_name: 1.2 # nominal only (reference dimension marked as such in datasheet) -parameter_name: 1.1 .. 1.2 .. 1.3 # min .. nominal .. max -parameter_name: 1.1 .. 1.3 # min .. max -parameter_name: 1.2 +/-0.1 # nominal plus symmetrical tolerance -parameter_name: 1.2 +0.1 -0.05 # nominal plus asymmetrical tolerance -``` - -### Dict-based - -```yaml -parameter_name: # nominal only - nominal: 1.2 - tolerance: 0 # optional to make it clear that this is the case -parameter_name: # minimum maximum and nominal - minimum: 1.1 - nominal: 1.2 - maximum: 1.3 -parameter_name: # minimum maximum - minimum: 1.1 - maximum: 1.3 -parameter_name: # nominal with symmetrical tolerance - nominal: 1.2 - tolerance: 0.1 -parameter_name: # nominal with asymmetrical tolerance - nominal: 1.2 - tolerance: [-0.05, 0.1] # order does not matter, the sign is important. -``` - -### Deprecated format - -Support for this format will be dropped in the future. This format only supports min, nom, max dimensioning. - -```yaml -parameter_name_min: 1.1 -parameter_name: 1.2 -parameter_name_max: 1.3 -``` diff --git a/scripts/Packages/Package_Gullwing__QFP_SOIC_SO/documentation/dimension_system.svg b/scripts/Packages/Package_Gullwing__QFP_SOIC_SO/documentation/dimension_system.svg deleted file mode 100644 index 0028466e5..000000000 --- a/scripts/Packages/Package_Gullwing__QFP_SOIC_SO/documentation/dimension_system.svg +++ /dev/null @@ -1,1026 +0,0 @@ - - - -image/svg+xml1 - - - - - - - - - -lead_len - - - -overall_size_x - - -body_size_x - - -EP_size_x - - -lead_width - - -pitch - - -overall_size_y - - -body_size_y - - -EP_size_y - - -overall_height - - -overall_size_x - - -body_size_x - - -body_size_y - - - \ No newline at end of file diff --git a/scripts/Packages/Package_Gullwing__QFP_SOIC_SO/ipc_gullwing_generator.py b/scripts/Packages/Package_Gullwing__QFP_SOIC_SO/ipc_gullwing_generator.py index feaff0def..05f958521 100755 --- a/scripts/Packages/Package_Gullwing__QFP_SOIC_SO/ipc_gullwing_generator.py +++ b/scripts/Packages/Package_Gullwing__QFP_SOIC_SO/ipc_gullwing_generator.py @@ -567,15 +567,15 @@ def __createFootprintVariant(self, device_params, header, dimensions, with_therm file_handler.writeFile(filename) if __name__ == "__main__": - parser = argparse.ArgumentParser(description='use confing .yaml files to create footprints. See readme.md for details about the parameter file format.') + parser = argparse.ArgumentParser(description='use confing .yaml files to create footprints.') parser.add_argument('files', metavar='file', type=str, nargs='+', help='list of files holding information about what devices should be created.') parser.add_argument('--global_config', type=str, nargs='?', help='the config file defining how the footprint will look like. (KLC)', default='../../tools/global_config_files/config_KLCv3.0.yaml') parser.add_argument('--series_config', type=str, nargs='?', help='the config file defining series parameters.', default='../package_config_KLCv3.yaml') - parser.add_argument('--density', type=str, nargs='?', help='IPC density level (L,N,M)', default='N') + parser.add_argument('--density', type=str, nargs='?', help='Density level (L,N,M)', default='N') parser.add_argument('--ipc_doc', type=str, nargs='?', help='IPC definition document', default='../ipc_definitions.yaml') parser.add_argument('--force_rectangle_pads', action='store_true', help='Force the generation of rectangle pads instead of rounded rectangle') - parser.add_argument('--kicad4_compatible', action='store_true', help='Create footprints compatible with version 4 (avoids round-rect and custom pads).') + parser.add_argument('--kicad4_compatible', action='store_true', help='Create footprints kicad 4 compatible') args = parser.parse_args() if args.density == 'L': diff --git a/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/ipc_noLead_generator.py b/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/ipc_noLead_generator.py index 4d74ce403..3ad4ac173 100755 --- a/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/ipc_noLead_generator.py +++ b/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/ipc_noLead_generator.py @@ -525,7 +525,7 @@ def __createFootprintVariant(self, device_params, device_dimensions, with_therma help='list of files holding information about what devices should be created.') parser.add_argument('--global_config', type=str, nargs='?', help='the config file defining how the footprint will look like. (KLC)', default='../../tools/global_config_files/config_KLCv3.0.yaml') parser.add_argument('--series_config', type=str, nargs='?', help='the config file defining series parameters.', default='../package_config_KLCv3.yaml') - parser.add_argument('--density', type=str, nargs='?', help='IPC density level (L,N,M)', default='N') + parser.add_argument('--density', type=str, nargs='?', help='Density level (L,N,M)', default='N') parser.add_argument('--ipc_doc', type=str, nargs='?', help='IPC definition document', default='../ipc_definitions.yaml') parser.add_argument('--force_rectangle_pads', action='store_true', help='Force the generation of rectangle pads instead of rounded rectangle') parser.add_argument('--kicad4_compatible', action='store_true', help='Create footprints kicad 4 compatible') diff --git a/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/size_definitions/qfn/qfn-64_9x9.yaml b/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/size_definitions/qfn/qfn-64_9x9.yaml index 6db43b375..e0d738180 100644 --- a/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/size_definitions/qfn/qfn-64_9x9.yaml +++ b/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/size_definitions/qfn/qfn-64_9x9.yaml @@ -1,45 +1,3 @@ -QFN-64-1EP_9x9mm_P0.5mm_EP3.8x3.8xmm: - device_type: 'QFN' - #manufacturer: 'man' - #part_number: 'mpn' - size_source: 'https://datasheet.lcsc.com/szlcsc/Realtek-Semicon-RTL8211EG-VB-CG_C69264.pdf#page=77' - ipc_class: 'qfn' # 'qfn_pull_back' - #ipc_density: 'least' #overwrite global value for this device. - # custom_name_format: - body_size_x: 9.0 - body_size_y: 9.0 - lead_width: 0.18 .. 0.25 .. 0.30 - lead_len: 0.30 .. 0.40 .. 0.50 - - EP_size_x: 3.55 .. 3.80 .. 4.05 - EP_size_y: 3.55 .. 3.80 .. 4.05 - - # EP_paste_coverage: 0.65 - EP_num_paste_pads: [3, 3] - #heel_reduction: 0.1 #for relatively large EP pads (increase clearance) - - thermal_vias: - count: [3, 3] - drill: 0.2 - # min_annular_ring: 0.15 - paste_via_clearance: 0.1 - # EP_num_paste_pads: [2, 2] - #paste_between_vias: 1 - #paste_rings_outside: 1 - # EP_paste_coverage: 0.65 - #grid: [1, 1] - # bottom_pad_size: - # paste_avoid_via: False - - pitch: 0.5 - num_pins_x: 16 - num_pins_y: 16 - #chamfer_edge_pins: 0.25 - #pin_count_grid: - #pad_length_addition: 0.5 - #suffix: '_Pad{pad_x:.2f}x{pad_y:.2f}mm_HandSolder' - #include_suffix_in_3dpath: 'False' - QFN-64-1EP_9x9mm_P0.5mm_EP4.7x4.7mm: device_type: 'QFN' #manufacturer: 'man' diff --git a/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/size_definitions/qfn/qfn-6x.yaml b/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/size_definitions/qfn/qfn-6x.yaml index b61eae804..db80ba8fd 100644 --- a/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/size_definitions/qfn/qfn-6x.yaml +++ b/scripts/Packages/Package_NoLead__DFN_QFN_LGA_SON/size_definitions/qfn/qfn-6x.yaml @@ -60,62 +60,6 @@ QFN-64-1EP_8x8mm_P0.4mm_EP6.5x6.5mm: #suffix: '_Pad{pad_x:.2f}x{pad_y:.2f}mm_HandSolder' #include_suffix_in_3dpath: 'False' -QFN-64-1EP_9x9mm_P0.5mm_EP4.35x4.35mm: - device_type: 'QFN' - #manufacturer: 'man' - #part_number: 'mpn' - size_source: 'https://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT2232H.pdf#page=57' - ipc_class: 'qfn' # 'qfn_pull_back' - body_size_x: - nominal: 9 - body_size_y: - nominal: 9 - overall_height: - minimum: 0.8 - nominal: 0.85 - maximum: 0.9 - - lead_width: - minimum: 0.18 - nominal: 0.25 - maximum: 0.30 - lead_len: - minimum: 0.35 - nominal: 0.4 - maximum: 0.45 - - EP_size_x: - minimum: 4.3 - nominal: 4.35 - maximum: 4.4 - EP_size_y: - minimum: 4.3 - nominal: 4.35 - maximum: 4.4 - # EP_paste_coverage: 0.65 - EP_num_paste_pads: [3, 3] - - thermal_vias: - count: [4, 4] - drill: 0.2 - # min_annular_ring: 0.15 - paste_via_clearance: 0.1 - #paste_between_vias: 1 - #paste_rings_outside: 1 - EP_paste_coverage: 0.6 - #grid: [1, 1] - # bottom_pad_size: - # paste_avoid_via: False - - pitch: 0.5 - num_pins_x: 16 - num_pins_y: 16 - #chamfer_edge_pins: 0.25 - #pin_count_grid: - #pad_length_addition: 0.5 - #suffix: '_Pad{pad_x:.2f}x{pad_y:.2f}mm_HandSolder' - #include_suffix_in_3dpath: 'False' - QFN-64-1EP_9x9mm_P0.5mm_EP5.45x5.45mm: device_type: 'QFN' #manufacturer: 'man' diff --git a/scripts/Packages/documentation/ep_handling.svg b/scripts/Packages/documentation/ep_handling.svg deleted file mode 100644 index 71069264f..000000000 --- a/scripts/Packages/documentation/ep_handling.svg +++ /dev/null @@ -1,516 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - EP_mask_x - - - - EP_size_x_overwrite - - EP_size_x - - - - - - - EP_mask_y - - - - EP_size_y_overwrite - - EP_size_y - - - - Paste layout determined byEP_num_paste_pads and EP_paste_coverage - - - - - - - - - Without specifying a smallermask cutout the paste layoutwould cover the full pad. - - diff --git a/scripts/Packages/documentation/thermal_vias.svg b/scripts/Packages/documentation/thermal_vias.svg deleted file mode 100644 index cbf5b01aa..000000000 --- a/scripts/Packages/documentation/thermal_vias.svg +++ /dev/null @@ -1,1482 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - grid: [xg, yg] - - - - - - - - - - - yg - xg - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - avoid_vias: true - count: [3, 3] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - manual via gridpaste_between_vias:1paste_rings_outside: 1avoid_vias: true - soldermask defined padmanual via gridpaste_between_vias:1paste_rings_outside: 1avoid_vias: true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - soldermask defined padmanual via grid - - - - - - - - - - - Copper - Mask - Paste - Via - - diff --git a/scripts/PadGenerator/RingPad.py b/scripts/PadGenerator/RingPad.py deleted file mode 100644 index 8dd3a3749..000000000 --- a/scripts/PadGenerator/RingPad.py +++ /dev/null @@ -1,38 +0,0 @@ -import sys -import os -sys.path.append(os.path.join(sys.path[0],"..","..")) - -import argparse -from KicadModTree import * - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description='Commandline tool for generating ring pads.') - parser.add_argument('-n', '--name', metavar='fp_name', type=str, - help='Name of the generated footprint. default: output', default='output') - parser.add_argument('--at', type=float, nargs=2, help='position of the pad, default: at origin', default=[0,0], metavar=('x', 'y')) - parser.add_argument('-v', '--verbose', action='count', help='set debug level') - parser.add_argument('-i', '--inner_diameter', type=float, help='inside diameter', required=True) - parser.add_argument('-o', '--outer_diameter', type=float, help='outside diameter', required=True) - parser.add_argument('-p', '--number', type=str, help='the pin number, default: 1', default='1') - parser.add_argument('--anchor_count', type=int, help='number of anchor (trace connection points), default: 4', default=4) - parser.add_argument('--paste_count', type=int, help='number of paste areas, default: 4', default=4) - parser.add_argument('--paste_round_radius_radio', type=float, help='round radius ratio for the paste pads', default=0.25) - parser.add_argument('--paste_clearance', type=float, help='clearance between paste areas', nargs='?') - parser.add_argument('--mask_margin', type=float, help='soldermask margin, default:0', default=0) - parser.add_argument('--paste_margin', type=float, help='solderpaste margin, default:0 (means controlled by footprint or board setup)', default=0) - args = parser.parse_args() - -kicad_mod = Footprint(args.name) - -kicad_mod.append( - RingPad( - number=args.number, at=args.at, - size=args.outer_diameter, inner_diameter=args.inner_diameter, - num_anchor=args.anchor_count, num_paste_zones=args.paste_count, - solder_paste_margin=args.paste_margin, solder_mask_margin=args.mask_margin, - paste_round_radius_radio=args.paste_round_radius_radio, - paste_to_paste_clearance=args.paste_clearance)) - - -file_handler = KicadFileHandler(kicad_mod) -file_handler.writeFile(args.name + '.kicad_mod') diff --git a/scripts/SMD_chip_package_rlc-etc/SMD_chip_package_rlc-etc.py b/scripts/SMD_chip_package_rlc-etc/SMD_package_rlc-etc.py old mode 100755 new mode 100644 similarity index 91% rename from scripts/SMD_chip_package_rlc-etc/SMD_chip_package_rlc-etc.py rename to scripts/SMD_chip_package_rlc-etc/SMD_package_rlc-etc.py index d26a9330a..5b395a594 --- a/scripts/SMD_chip_package_rlc-etc/SMD_chip_package_rlc-etc.py +++ b/scripts/SMD_chip_package_rlc-etc/SMD_package_rlc-etc.py @@ -29,7 +29,7 @@ def merge_dicts(*dict_args): result.update(dictionary) return result -class TwoTerminalSMDchip(): +class TwoTerminalSMD(): def __init__(self, command_file, configuration): self.configuration = configuration with open(command_file, 'r') as command_stream: @@ -49,7 +49,7 @@ def calcPadDetails(self, device_dimensions, ipc_data, ipc_round_base, footprint_ # Gmin = Smax − 2JH − √(CS^2 + F^2 + P^2) # Xmax = Wmin + 2JS + √(CW^2 + F^2 + P^2) - # Some manufacturers do not list the terminal spacing (S) in their datasheet but list the terminal lenght (T) + # Some manufacturers do not list the terminal spacing (S) in their datasheet but list the terminal length (T) # Then one can calculate # Stol(RMS) = √(Ltol^2 + 2*^2) # Smin = Lmin - 2*Tmax @@ -95,7 +95,7 @@ def deviceDimensions(device_size_data): elif 'terminal_length_max' in device_size_data and 'terminal_length_min' in device_size_data or 'terminal_length' in device_size_data: dimensions['terminal_length'] = TolerancedSize.fromYaml(device_size_data, base_name='terminal_length') else: - raise KeyError("Either terminator spacing or terminal lenght must be included in the size definition.") + raise KeyError("Either terminator spacing or terminal length must be included in the size definition.") if 'terminal_width_min' in device_size_data and 'terminal_width_max' in device_size_data or 'terminal_width' in device_size_data: dimensions['terminal_width'] = TolerancedSize.fromYaml(device_size_data, base_name='terminal_width') @@ -117,6 +117,7 @@ def generateFootprints(self): print(exc) for size_name in package_size_defintions: + print(group_name + ': ' + size_name) device_size_data = package_size_defintions[size_name] try: self.generateFootprint(device_size_data, @@ -130,10 +131,11 @@ def generateFootprint(self, device_size_data, footprint_group_data): fab_line_width = self.configuration.get('fab_line_width', 0.1) silk_line_width = self.configuration.get('silk_line_width', 0.12) - device_dimensions = TwoTerminalSMDchip.deviceDimensions(device_size_data) + device_dimensions = TwoTerminalSMD.deviceDimensions(device_size_data) ipc_reference = footprint_group_data['ipc_reference'] - ipc_density = footprint_group_data['ipc_density'] + ipc_density = self.configuration.get('ipc_density')[0] + density_suffix = self.configuration.get('ipc_density')[1] ipc_data_set = self.ipc_defintions[ipc_reference][ipc_density] ipc_round_base = self.ipc_defintions[ipc_reference]['round_base'] @@ -147,6 +149,13 @@ def generateFootprint(self, device_size_data, footprint_group_data): model3d_path_prefix = self.configuration.get('3d_model_prefix','${KISYS3DMOD}') suffix_3d = suffix if footprint_group_data.get('include_suffix_in_3dpath', 'True') == 'True' else "" + + if density_suffix != '' and 'handsolder' not in footprint_group_data['keywords']: + density_description = ', IPC-7351 {density:s} land protrusion'.format(density=ipc_density) + suffix = suffix + density_suffix + suffix_3d = suffix_3d + density_suffix + else: + density_description = '' code_metric = device_size_data.get('code_metric') code_letter = device_size_data.get('code_letter') @@ -176,6 +185,7 @@ def generateFootprint(self, device_size_data, footprint_group_data): # init kicad footprint kicad_mod.setDescription(footprint_group_data['description'].format(code_imperial=code_imperial, code_metric=code_metric, code_letter=code_letter, + density=density_description, size_info=device_size_data.get('size_info'))) kicad_mod.setTags(footprint_group_data['keywords']) kicad_mod.setAttribute('smd') @@ -334,10 +344,25 @@ def generateFootprint(self, device_size_data, footprint_group_data): help='list of files holding information about what devices should be created.') parser.add_argument('--global_config', type=str, nargs='?', help='the config file defining how the footprint will look like. (KLC)', default='../tools/global_config_files/config_KLCv3.0.yaml') parser.add_argument('--series_config', type=str, nargs='?', help='the config file defining series parameters.', default='config_KLCv3.0.yaml') - parser.add_argument('--ipc_definition', type=str, nargs='?', help='the ipc definition file', default='ipc7351B_smd_two_terminal_chip.yaml') + parser.add_argument('--ipc_definition', type=str, nargs='?', help='the ipc definition file', default='ipc7351B_smd_two_terminal.yaml') + parser.add_argument('--ipc_density', type=str, nargs='?', help='IPC density level (L,N,M)') parser.add_argument('--force_rectangle_pads', action='store_true', help='Force the generation of rectangle pads instead of rounded rectangle (KiCad 4.x compatibility.)') args = parser.parse_args() + # if the user requests an IPC density, put that and footprint suffix in a list + # nominal density with no suffix if no argument is provided + if args.ipc_density is None: + ipc_density = ['nominal', ''] + elif args.ipc_density.upper() == 'L': + ipc_density = ['least', '_L'] + elif args.ipc_density.upper() == 'N': + ipc_density = ['nominal', '_N'] + elif args.ipc_density.upper() == 'M': + ipc_density = ['most', '_M'] + else: + raise ValueError("If IPC density is specified, it must be 'L', 'N', or 'M.'") + sys.exit() + with open(args.global_config, 'r') as config_stream: try: configuration = yaml.safe_load(config_stream) @@ -351,10 +376,11 @@ def generateFootprint(self, device_size_data, footprint_group_data): print(exc) args = parser.parse_args() configuration['ipc_definition'] = args.ipc_definition + configuration['ipc_density'] = ipc_density if args.force_rectangle_pads: configuration['round_rect_max_radius'] = None configuration['round_rect_radius_ratio'] = 0 for filepath in args.files: - two_terminal_smd =TwoTerminalSMDchip(filepath, configuration) + two_terminal_smd = TwoTerminalSMD(filepath, configuration) two_terminal_smd.generateFootprints() diff --git a/scripts/SMD_chip_package_rlc-etc/SMD_chip_devices.yaml b/scripts/SMD_chip_package_rlc-etc/SMD_packages.yaml similarity index 58% rename from scripts/SMD_chip_package_rlc-etc/SMD_chip_devices.yaml rename to scripts/SMD_chip_package_rlc-etc/SMD_packages.yaml index f0356eaa0..8b6238a3e 100644 --- a/scripts/SMD_chip_package_rlc-etc/SMD_chip_devices.yaml +++ b/scripts/SMD_chip_package_rlc-etc/SMD_packages.yaml @@ -1,33 +1,30 @@ resistor: fp_lib_name: 'Resistor_SMD' - size_definitions: ['size_default_chip_devices.yaml', 'size_wide_body_chip_resistor.yaml', 'size_resistor.yaml'] + size_definitions: ['size_resistor_chip.yaml', 'size_resistor_chip_wide_body.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'R' - description: 'Resistor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Resistor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'resistor' - ipc_density: 'nominal' pad_length_addition: 0 suffix: "" resistor_smaller_0603: fp_lib_name: 'Resistor_SMD' - size_definitions: ['size_default_chip_devices_smaller_0603.yaml'] + size_definitions: ['size_resistor_chip_smaller_0603.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'R' - description: 'Resistor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Resistor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'resistor' - ipc_density: 'nominal' pad_length_addition: 0 suffix: "" resistor_smaller_0402: fp_lib_name: 'Resistor_SMD' - size_definitions: ['size_default_chip_devices_smaller_0402.yaml'] + size_definitions: ['size_default_chip_smaller_0402.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'R' - description: 'Resistor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Resistor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'resistor' - ipc_density: 'nominal' pad_length_addition: 0 suffix: "" paste_pad: @@ -37,12 +34,11 @@ resistor_smaller_0402: resistor_handsolder: #ToDo: only generate > 0402 fp_lib_name: 'Resistor_SMD' - size_definitions: ['size_default_chip_devices.yaml', 'size_wide_body_chip_resistor.yaml', 'size_resistor.yaml'] + size_definitions: ['size_resistor_chip.yaml', 'size_resistor_chip_wide_body.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'R' - description: 'Resistor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. {size_info:s}, generated with kicad-footprint-generator' + description: 'Resistor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, with elongated pad for handsoldering. {size_info:s}, generated with kicad-footprint-generator' keywords: 'resistor handsolder' - ipc_density: 'nominal' pad_length_addition: 0.35 suffix: "_Pad{pad_x:.2f}x{pad_y:.2f}mm_HandSolder" include_suffix_in_3dpath: 'False' @@ -50,34 +46,31 @@ resistor_handsolder: capacitor: fp_lib_name: 'Capacitor_SMD' - size_definitions: ['size_default_chip_devices.yaml', 'size_capacitor_chip_devices.yaml'] + size_definitions: ['size_capacitor_chip.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'C' - description: 'Capacitor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Capacitor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'capacitor' - ipc_density: 'nominal' pad_length_addition: 0 suffix: "" capacitor_smaller_0603: fp_lib_name: 'Capacitor_SMD' - size_definitions: ['size_default_chip_devices_smaller_0603.yaml'] + size_definitions: ['size_capacitor_chip_smaller_0603.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'C' - description: 'Capacitor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Capacitor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'capacitor' - ipc_density: 'nominal' pad_length_addition: 0 suffix: "" capacitor_smaller_0402: fp_lib_name: 'Capacitor_SMD' - size_definitions: ['size_default_chip_devices_smaller_0402.yaml'] + size_definitions: ['size_default_chip_smaller_0402.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'C' - description: 'Capacitor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Capacitor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'capacitor' - ipc_density: 'nominal' pad_length_addition: 0 suffix: "" paste_pad: @@ -87,36 +80,33 @@ capacitor_smaller_0402: capacitor_handsolder: #ToDo: only generate > 0402 fp_lib_name: 'Capacitor_SMD' - size_definitions: ['size_default_chip_devices.yaml', 'size_capacitor_chip_devices.yaml'] + size_definitions: ['size_capacitor_chip.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'C' - description: 'Capacitor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. {size_info:s}, generated with kicad-footprint-generator' + description: 'Capacitor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, with elongated pad for handsoldering. {size_info:s}, generated with kicad-footprint-generator' keywords: 'capacitor handsolder' - ipc_density: 'nominal' pad_length_addition: 0.35 suffix: "_Pad{pad_x:.2f}x{pad_y:.2f}mm_HandSolder" include_suffix_in_3dpath: 'False' capacitor_tantal: fp_lib_name: 'Capacitor_Tantalum_SMD' - size_definitions: ['size_tantal.yaml'] + size_definitions: ['size_capacitor_tantal.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'CP' - description: 'Tantalum Capacitor SMD {code_letter:s} ({code_metric:s} Metric), IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Tantalum Capacitor SMD {code_letter:s} ({code_metric:s} Metric){density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'capacitor tantalum' - ipc_density: 'nominal' pad_length_addition: 0 suffix: "" polarization_mark: 'True' capacitor_tantal_handsolder: fp_lib_name: 'Capacitor_Tantalum_SMD' - size_definitions: ['size_tantal.yaml'] + size_definitions: ['size_capacitor_tantal.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'CP' - description: 'Tantalum Capacitor SMD {code_letter:s} ({code_metric:s} Metric), IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Tantalum Capacitor SMD {code_letter:s} ({code_metric:s} Metric){density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'capacitor tantalum' - ipc_density: 'nominal' pad_length_addition: 0.35 suffix: "_Pad{pad_x:.2f}x{pad_y:.2f}mm_HandSolder" include_suffix_in_3dpath: 'False' @@ -125,34 +115,31 @@ capacitor_tantal_handsolder: inductor: fp_lib_name: 'Inductor_SMD' - size_definitions: ['size_default_chip_devices.yaml', 'size_inductor.yaml'] + size_definitions: ['size_default_chip.yaml', 'size_inductor.yaml'] # inductor size definitions overwrite generic ones ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'L' - description: 'Inductor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Inductor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'inductor' - ipc_density: 'nominal' pad_length_addition: 0 suffix: "" inductor_smaller_0603: fp_lib_name: 'Inductor_SMD' - size_definitions: ['size_default_chip_devices_smaller_0603.yaml'] + size_definitions: ['size_default_chip_smaller_0603.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'L' - description: 'Inductor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Inductor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'inductor' - ipc_density: 'nominal' pad_length_addition: 0 suffix: "" inductor_smaller_0402: fp_lib_name: 'Inductor_SMD' - size_definitions: ['size_default_chip_devices_smaller_0402.yaml'] + size_definitions: ['size_default_chip_smaller_0402.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'L' - description: 'Inductor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Inductor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'inductor' - ipc_density: 'nominal' pad_length_addition: 0 suffix: "" paste_pad: @@ -162,12 +149,11 @@ inductor_smaller_0402: inductor_handsolder: #ToDo: only generate > 0402 fp_lib_name: 'Inductor_SMD' - size_definitions: ['size_default_chip_devices.yaml'] + size_definitions: ['size_default_chip.yaml', 'size_inductor.yaml'] # inductor size definitions overwrite generic ones ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'L' - description: 'Capacitor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. {size_info:s}, generated with kicad-footprint-generator' + description: 'Inductor SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, with elongated pad for handsoldering. {size_info:s}, generated with kicad-footprint-generator' keywords: 'inductor handsolder' - ipc_density: 'nominal' pad_length_addition: 0.35 suffix: "_Pad{pad_x:.2f}x{pad_y:.2f}mm_HandSolder" include_suffix_in_3dpath: 'False' @@ -175,36 +161,33 @@ inductor_handsolder: diode: fp_lib_name: 'Diode_SMD' - size_definitions: ['size_default_chip_devices.yaml', 'size_diode.yaml'] + size_definitions: ['size_default_chip.yaml', 'size_diode.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'D' - description: 'Diode SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Diode SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'diode' - ipc_density: 'nominal' pad_length_addition: 0 polarization_mark: 'True' suffix: "" diode_smaller_0603: fp_lib_name: 'Diode_SMD' - size_definitions: ['size_default_chip_devices_smaller_0603.yaml'] + size_definitions: ['size_default_chip_smaller_0603.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'D' - description: 'Diode SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Diode SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'diode' - ipc_density: 'nominal' pad_length_addition: 0 polarization_mark: 'True' suffix: "" diode_smaller_0402: fp_lib_name: 'Diode_SMD' - size_definitions: ['size_default_chip_devices_smaller_0402.yaml'] + size_definitions: ['size_default_chip_smaller_0402.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'D' - description: 'Diode SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Diode SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'diode' - ipc_density: 'nominal' pad_length_addition: 0 polarization_mark: 'True' suffix: "" @@ -214,12 +197,11 @@ diode_smaller_0402: diode_handsolder: fp_lib_name: 'Diode_SMD' - size_definitions: ['size_default_chip_devices.yaml', 'size_diode.yaml'] + size_definitions: ['size_default_chip.yaml', 'size_diode.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'D' - description: 'Diode SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Diode SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'diode handsolder' - ipc_density: 'nominal' pad_length_addition: 0.35 polarization_mark: 'True' suffix: "_Pad{pad_x:.2f}x{pad_y:.2f}mm_HandSolder" @@ -227,12 +209,11 @@ diode_handsolder: diode_castellated: fp_lib_name: 'Diode_SMD' - size_definitions: ['size_default_chip_devices.yaml', 'size_diode.yaml'] + size_definitions: ['size_default_chip.yaml', 'size_diode.yaml'] ipc_reference: "ipc_spec_castellated" prefix: 'D' - description: 'Diode SMD {code_imperial:s} ({code_metric:s} Metric), castellated end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'Diode SMD {code_imperial:s} ({code_metric:s} Metric), castellated end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'diode castellated' - ipc_density: 'nominal' pad_length_addition: 0 polarization_mark: 'True' suffix: "_Castellated" @@ -240,24 +221,22 @@ diode_castellated: led: fp_lib_name: 'LED_SMD' - size_definitions: ['size_default_chip_devices.yaml'] + size_definitions: ['size_default_chip.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'LED' - description: 'LED SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' - keywords: 'diode' - ipc_density: 'nominal' + description: 'LED SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' + keywords: 'LED' pad_length_addition: 0 polarization_mark: 'True' suffix: "" led_smaller_0603: fp_lib_name: 'LED_SMD' - size_definitions: ['size_default_chip_devices_smaller_0603.yaml'] + size_definitions: ['size_default_chip_smaller_0603.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'LED' - description: 'LED SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'LED SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'LED' - ipc_density: 'nominal' pad_length_addition: 0 polarization_mark: 'True' suffix: "" @@ -265,13 +244,12 @@ led_smaller_0603: led_smaller_0402: fp_lib_name: 'LED_SMD' - size_definitions: ['size_default_chip_devices_smaller_0402.yaml'] + size_definitions: ['size_default_chip_smaller_0402.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'LED' - description: 'LED SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'LED SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'LED' ipc_density: 'nominal' - pad_length_addition: 0 polarization_mark: 'True' suffix: "" paste_pad: @@ -280,12 +258,11 @@ led_smaller_0402: led_handsolder: fp_lib_name: 'LED_SMD' - size_definitions: ['size_default_chip_devices.yaml'] + size_definitions: ['size_default_chip.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'LED' - description: 'LED SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'LED SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'LED handsolder' - ipc_density: 'nominal' pad_length_addition: 0.35 polarization_mark: 'True' suffix: "_Pad{pad_x:.2f}x{pad_y:.2f}mm_HandSolder" @@ -293,12 +270,11 @@ led_handsolder: led_castellated: fp_lib_name: 'LED_SMD' - size_definitions: ['size_default_chip_devices.yaml'] + size_definitions: ['size_default_chip.yaml'] ipc_reference: "ipc_spec_castellated" prefix: 'LED' - description: 'LED SMD {code_imperial:s} ({code_metric:s} Metric), castellated end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' + description: 'LED SMD {code_imperial:s} ({code_metric:s} Metric), castellated end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' keywords: 'LED castellated' - ipc_density: 'nominal' pad_length_addition: 0 polarization_mark: 'True' suffix: "_Castellated" @@ -306,34 +282,31 @@ led_castellated: ############################################################################### fuse: fp_lib_name: 'Fuse' - size_definitions: ['size_default_chip_devices.yaml', 'size_fuse.yaml'] + size_definitions: ['size_default_chip.yaml', 'size_fuse.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'Fuse' - description: 'Fuse SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' - keywords: 'resistor' - ipc_density: 'nominal' + description: 'Fuse SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' + keywords: 'fuse' pad_length_addition: 0 suffix: "" fuse_smaller_0603: fp_lib_name: 'Fuse' - size_definitions: ['size_default_chip_devices_smaller_0603.yaml'] + size_definitions: ['size_default_chip_smaller_0603.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'Fuse' - description: 'Fuse SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' - keywords: 'resistor' - ipc_density: 'nominal' + description: 'Fuse SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' + keywords: 'fuse' pad_length_addition: 0 suffix: "" fuse_smaller_0402: fp_lib_name: 'Fuse' - size_definitions: ['size_default_chip_devices_smaller_0402.yaml'] + size_definitions: ['size_default_chip_smaller_0402.yaml'] ipc_reference: "ipc_spec_smaller_0603" prefix: 'Fuse' - description: 'Fuse SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal, {size_info:s}, generated with kicad-footprint-generator' - keywords: 'resistor' - ipc_density: 'nominal' + description: 'Fuse SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, {size_info:s}, generated with kicad-footprint-generator' + keywords: 'fuse' pad_length_addition: 0 suffix: "" paste_pad: @@ -342,12 +315,11 @@ fuse_smaller_0402: fuse_handsolder: fp_lib_name: 'Fuse' - size_definitions: ['size_default_chip_devices.yaml', 'size_fuse.yaml'] + size_definitions: ['size_default_chip.yaml', 'size_fuse.yaml'] ipc_reference: "ipc_spec_larger_or_equal_0603" prefix: 'Fuse' - description: 'Fuse SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. {size_info:s}, generated with kicad-footprint-generator' - keywords: 'resistor handsolder' - ipc_density: 'nominal' + description: 'Fuse SMD {code_imperial:s} ({code_metric:s} Metric), square (rectangular) end terminal{density:s}, with elongated pad for handsoldering. {size_info:s}, generated with kicad-footprint-generator' + keywords: 'fuse handsolder' pad_length_addition: 0.35 suffix: "_Pad{pad_x:.2f}x{pad_y:.2f}mm_HandSolder" include_suffix_in_3dpath: 'False' diff --git a/scripts/SMD_chip_package_rlc-etc/ipc7351B_smd_two_terminal_chip.yaml b/scripts/SMD_chip_package_rlc-etc/ipc7351B_smd_two_terminal.yaml similarity index 100% rename from scripts/SMD_chip_package_rlc-etc/ipc7351B_smd_two_terminal_chip.yaml rename to scripts/SMD_chip_package_rlc-etc/ipc7351B_smd_two_terminal.yaml diff --git a/scripts/SMD_chip_package_rlc-etc/ipc_smd_two_terminal_chip.yaml b/scripts/SMD_chip_package_rlc-etc/ipc7351_smd_two_terminal.yaml similarity index 100% rename from scripts/SMD_chip_package_rlc-etc/ipc_smd_two_terminal_chip.yaml rename to scripts/SMD_chip_package_rlc-etc/ipc7351_smd_two_terminal.yaml diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_chip.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_chip.yaml new file mode 100644 index 000000000..352a0cd6d --- /dev/null +++ b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_chip.yaml @@ -0,0 +1,143 @@ +C_0504: + code_imperial: "0504" + code_metric: "1310" + body_length: + minimum: 1.02 + maximum: 1.32 + body_width: + minimum: 0.77 + maximum: 1.27 + terminal_length: + minimum: 0.13 + maximum: 0.38 + size_info: '(Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +C_0603: + code_imperial: "0603" + code_metric: "1608" + body_length: + minimum: 1.45 + maximum: 1.75 + body_width: + minimum: 0.65 + maximum: 0.95 + terminal_length: + minimum: 0.2 + maximum: 0.5 + size_info: '(Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +C_0805: + code_imperial: "0805" + code_metric: "2012" + body_length: + minimum: 1.8 + maximum: 2.2 + body_width: + minimum: 1.05 + maximum: 1.45 + terminal_length: + minimum: 0.25 + maximum: 0.55 # only deviation from IPC is reducing this from 0.75mm + size_info: '(Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf, https://docs.google.com/spreadsheets/d/1BsfQQcO9C6DZCsRaXUlFlo91Tg2WpOkGARC1WS5S8t0/edit?usp=sharing)' + +C_1206: + code_imperial: "1206" + code_metric: "3216" + body_length: + minimum: 3 + maximum: 3.4 + body_width: + minimum: 1.4 + maximum: 1.8 + terminal_length: + minimum: 0.25 + maximum: 0.75 + size_info: '(Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +C_1210: + code_imperial: "1210" + code_metric: "3225" + body_length: + minimum: 3 + maximum: 3.4 + body_width: + minimum: 2.3 + maximum: 2.7 + terminal_length: + minimum: 0.25 + maximum: 0.75 + size_info: '(Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +C_1812: + code_imperial: "1812" + code_metric: "4532" + body_length: + minimum: 4.2 + maximum: 4.8 + body_width: + minimum: 3 + maximum: 3.4 + terminal_length: + minimum: 0.25 + maximum: 0.95 + size_info: '(Body size source: https://www.nikhef.nl/pub/departments/mt/projects/detectorR_D/dtddice/ERJ2G.pdf)' + +C_1825: + code_imperial: "1825" + code_metric: "4564" + body_length: + minimum: 4.2 + maximum: 4.8 + body_width: + minimum: 6 + maximum: 6.8 + terminal_length: + minimum: 0.25 + maximum: 0.95 + ipc_reference: "ipc_spec_larger_or_equal_0603" + size_info: '(Body size from: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +C_2220: + code_imperial: "2220" + code_metric: "5650" + body_length: + nominal: 5.7 + tolerance: 0.5 + body_width: + nominal: 5.0 + tolerance: 0.4 + terminal_length: + nominal: 0.85 + tolerance: 0.35 + ipc_reference: "ipc_spec_larger_or_equal_0603" + size_info: '(Body size from: http://datasheets.avx.com/AVX-HV_MLCC.pdf)' + +C_2225: + code_imperial: "2225" + code_metric: "5664" + body_length: + nominal: 5.72 + tolerance: 0.25 + body_width: + nominal: 6.35 + tolerance: 0.25 + terminal_length: + nominal: 0.85 + tolerance: 0.35 + ipc_reference: "ipc_spec_larger_or_equal_0603" + size_info: '(Body size from: http://datasheets.avx.com/AVX-HV_MLCC.pdf)' + +C_3640: + code_imperial: "3640" + code_metric: "9110" + body_length: + nominal: 9.14 + tolerance: 0.25 + body_width: + nominal: 10.2 + tolerance: 0.25 + terminal_length: + minimum: 0.76 + maximum: 1.52 + ipc_reference: "ipc_spec_larger_or_equal_0603" + size_info: '(Body size from: http://datasheets.avx.com/AVX-HV_MLCC.pdf)' diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_chip_devices.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_chip_devices.yaml deleted file mode 100644 index b3d35f6ae..000000000 --- a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_chip_devices.yaml +++ /dev/null @@ -1,60 +0,0 @@ - -SMD_1825: - code_imperial: "1825" - code_metric: "4564" - body_length: - nominal: 4.6 - tolerance: 0.5 - body_width: - nominal: 6.3 - tolerance: 0.4 - terminal_length: - nominal: 0.75 - tolerance: 0.35 - ipc_reference: "ipc_spec_larger_or_equal_0603" - size_info: '(Body size from: http://datasheets.avx.com/AVX-HV_MLCC.pdf)' - -SMD_2220: - code_imperial: "2220" - code_metric: "5650" - body_length: - nominal: 5.7 - tolerance: 0.5 - body_width: - nominal: 5.0 - tolerance: 0.4 - terminal_length: - nominal: 0.85 - tolerance: 0.35 - ipc_reference: "ipc_spec_larger_or_equal_0603" - size_info: '(Body size from: http://datasheets.avx.com/AVX-HV_MLCC.pdf)' - -SMD_2225: - code_imperial: "2225" - code_metric: "5664" - body_length: - nominal: 5.72 - tolerance: 0.25 - body_width: - nominal: 6.35 - tolerance: 0.25 - terminal_length: - nominal: 0.85 - tolerance: 0.35 - ipc_reference: "ipc_spec_larger_or_equal_0603" - size_info: '(Body size from: http://datasheets.avx.com/AVX-HV_MLCC.pdf)' - -SMD_3640: - code_imperial: "3640" - code_metric: "9110" - body_length: - nominal: 9.14 - tolerance: 0.25 - body_width: - nominal: 10.2 - tolerance: 0.25 - terminal_length: - minimum: 0.76 - maximum: 1.52 - ipc_reference: "ipc_spec_larger_or_equal_0603" - size_info: '(Body size from: http://datasheets.avx.com/AVX-HV_MLCC.pdf)' diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_chip_smaller_0603.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_chip_smaller_0603.yaml new file mode 100644 index 000000000..fd2f5bd56 --- /dev/null +++ b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_chip_smaller_0603.yaml @@ -0,0 +1,12 @@ +C_0402: + code_imperial: "0402" + code_metric: "1005" + body_length: + minimum: 0.9 + maximum: 1.1 + body_width: + minimum: 0.4 + maximum: 0.6 + terminator_spacing_min: 0.3 + terminator_spacing_max: 0.65 + size_info: '(Body size source: IPC-SM-782 page 76, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_tantal.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_tantal.yaml similarity index 79% rename from scripts/SMD_chip_package_rlc-etc/size_definitions/size_tantal.yaml rename to scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_tantal.yaml index 14a737ae2..b04bda0c6 100644 --- a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_tantal.yaml +++ b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_capacitor_tantal.yaml @@ -1,4 +1,4 @@ -SMD_1608-08: +C_1608-08: code_metric: '1608-08' # size | 1,6 x 0,8 x 0,8 mm #code_letter: 'Kemet-—' @@ -14,7 +14,7 @@ SMD_1608-08: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: https://www.vishay.com/docs/48064/_t58_vmn_pt0471_1601.pdf)' -SMD_1608-10: +C_1608-10: code_metric: '1608-10' # size | 1,6 x 0,85 x 1,05 mm #code_letter: 'Kemet-—' @@ -30,7 +30,7 @@ SMD_1608-10: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: https://www.vishay.com/docs/48064/_t58_vmn_pt0471_1601.pdf)' -SMD_2012-12: +C_2012-12: code_metric: '2012-12' # size | 2,05 x 1,35 x 1,2 mm code_letter: 'Kemet-R' @@ -52,7 +52,7 @@ SMD_2012-12: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: https://www.vishay.com/docs/40182/tmch.pdf)' -SMD_2012-15: +C_2012-15: code_metric: '2012-15' # size | 2,05 x 1,35 x 1,5 mm #code_letter: 'Kemet-—' @@ -74,7 +74,7 @@ SMD_2012-15: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: https://www.vishay.com/docs/40182/tmch.pdf)' -SMD_3216-10: +C_3216-10: code_metric: '3216-10' # size | 3,2 x 1,6 x 1,0 mm code_letter: 'Kemet-I' @@ -96,7 +96,7 @@ SMD_3216-10: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_3216-12: +C_3216-12: code_metric: '3216-12' # size | 3,2 x 1,6 x 1,2 mm code_letter: 'Kemet-S' @@ -118,7 +118,7 @@ SMD_3216-12: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_3216-18: +C_3216-18: code_metric: '3216-18' # size | 3,2 x 1,6 x 1,8 mm code_letter: 'Kemet-A' @@ -140,7 +140,7 @@ SMD_3216-18: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_3528-12: +C_3528-12: code_metric: '3528-12' # size | 3,5 x 2,8 x 1,2 mm code_letter: 'Kemet-T' @@ -162,7 +162,7 @@ SMD_3528-12: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_3528-15: +C_3528-15: code_metric: '3528-15' # size | 3,5 x 2,8 x 1,5 mm #code_letter: 'Kemet-—' @@ -184,7 +184,7 @@ SMD_3528-15: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_3528-21: +C_3528-21: code_metric: '3528-21' # size | 3,5 x 2,8 x 2,1 mm code_letter: 'Kemet-B' @@ -206,7 +206,7 @@ SMD_3528-21: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_6032-15: +C_6032-15: code_metric: '6032-15' # size | 6,0 x 3,2 x 1,5 mm code_letter: 'Kemet-U' @@ -228,7 +228,7 @@ SMD_6032-15: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_6032-20: +C_6032-20: code_metric: '6032-20' # size | 6,0 x 3,2 x 2,0 mm #code_letter: 'Kemet-—' @@ -250,7 +250,7 @@ SMD_6032-20: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_6032-28: +C_6032-28: code_metric: '6032-28' # size | 6,0 x 3,2 x 2,8 mm code_letter: 'Kemet-C' @@ -272,121 +272,7 @@ SMD_6032-28: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_7132-20: - code_metric: '7132-20' - # size | 7,1 x 3,2 x 2,0 mm - code_letter: 'AVX-U' - body_length: - nominal: 7.1 - tolerance: 0.3 - body_width: - nominal: 3.2 - tolerance: 0.3 - terminal_length: - nominal: 1.3 - tolerance: 0.3 - terminator_spacing: - nominal: 3.6 - tolerance: 0.6 - ipc_reference: "ipc_spec_tantalumn" - size_info: '(Body size from: http://datasheets.avx.com/F72-F75.pdf)' - -SMD_7132-28: - code_metric: '7132-28' - # size | 7,1 x 3,2 x 2,8 mm - code_letter: 'AVX-C' - body_length: - nominal: 7.1 - tolerance: 0.3 - body_width: - nominal: 3.2 - tolerance: 0.3 - terminal_length: - nominal: 1.3 - tolerance: 0.3 - terminator_spacing: - nominal: 3.6 - tolerance: 0.6 - ipc_reference: "ipc_spec_tantalumn" - size_info: '(Body size from: http://datasheets.avx.com/F72-F75.pdf)' - -SMD_7260-15: - code_metric: '7260-15' - # size | 7,2 x 6,0 x 1,5 mm - code_letter: 'AVX-R' - body_length: - nominal: 7.2 - tolerance: 0.3 - body_width: - nominal: 6.0 - tolerance: 0.3 - terminator_spacing: - nominal: 3.8 - tolerance: 0.6 - terminal_length: - nominal: 1.3 - tolerance: 0.4 - ipc_reference: "ipc_spec_tantalumn" - size_info: '(Body size from: http://datasheets.avx.com/F72-F75.pdf)' - -SMD_7260-20: - code_metric: '7260-20' - # size | 7,2 x 6,0 x 2,0 mm - code_letter: 'AVX-M' - body_length: - nominal: 7.2 - tolerance: 0.3 - body_width: - nominal: 6.0 - tolerance: 0.3 - terminator_spacing: - nominal: 3.8 - tolerance: 0.6 - terminal_length: - nominal: 1.3 - tolerance: 0.4 - ipc_reference: "ipc_spec_tantalumn" - size_info: '(Body size from: http://datasheets.avx.com/F72-F75.pdf)' - -SMD_7260-28: - code_metric: '7260-28' - # size | 7,2 x 6,0 x 2,8 mm - code_letter: 'AVX-M' - body_length: - nominal: 7.2 - tolerance: 0.3 - body_width: - nominal: 6.0 - tolerance: 0.3 - terminator_spacing: - nominal: 3.8 - tolerance: 0.6 - terminal_length: - nominal: 1.3 - tolerance: 0.4 - ipc_reference: "ipc_spec_tantalumn" - size_info: '(Body size from: http://datasheets.avx.com/F72-F75.pdf)' - -SMD_7260-38: - code_metric: '7260-38' - # size | 7,2 x 6,0 x 3,8 mm - code_letter: 'AVX-R' - body_length: - nominal: 7.2 - tolerance: 0.3 - body_width: - nominal: 6.0 - tolerance: 0.3 - terminator_spacing: - nominal: 3.8 - tolerance: 0.6 - terminal_length: - nominal: 1.3 - tolerance: 0.4 - ipc_reference: "ipc_spec_tantalumn" - size_info: '(Body size from: http://datasheets.avx.com/F72-F75.pdf)' - -SMD_7343-15: +C_7343-15: code_metric: '7343-15' # size | 7,3 x 4,3 x 1,5 mm code_letter: 'Kemet-W' @@ -407,7 +293,7 @@ SMD_7343-15: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_7343-20: +C_7343-20: code_metric: '7343-20' # size | 7,3 x 4,3 x 2,0 mm code_letter: 'Kemet-V' @@ -429,7 +315,7 @@ SMD_7343-20: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_7343-30: +C_7343-30: code_metric: '7343-30' # size | 7,3 x 4,3 x 3,0 mm #code_letter: 'Kemet-—' @@ -451,7 +337,7 @@ SMD_7343-30: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_7343-31: +C_7343-31: code_metric: '7343-31' # size | 7,3 x 4,3 x 3,1 mm code_letter: 'Kemet-D' @@ -473,7 +359,7 @@ SMD_7343-31: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_7343-40: +C_7343-40: code_metric: '7343-40' # size | 7,3 x 4,3 x 4,0 mm code_letter: 'Kemet-Y' @@ -495,7 +381,7 @@ SMD_7343-40: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_7343-43: +C_7343-43: code_metric: '7343-43' # size | 7,3 x 4,3 x 4,3 mm code_letter: 'Kemet-X' @@ -517,7 +403,7 @@ SMD_7343-43: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_7360-38: +C_7360-38: code_metric: '7360-38' # size | 7,3 x 6,0 x 3,8 mm code_letter: 'Kemet-E' @@ -539,7 +425,7 @@ SMD_7360-38: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://www.kemet.com/Lists/ProductCatalog/Attachments/253/KEM_TC101_STD.pdf)' -SMD_7361-38: +C_7361-38: code_metric: '7361-38' # size | 7,3 x 6,1 x 3,8 mm #code_letter: 'Kemet-—' @@ -561,7 +447,7 @@ SMD_7361-38: ipc_reference: "ipc_spec_tantalumn" size_info: '(Body size from: http://datasheets.avx.com/NOS.pdf)' -SMD_7361-438: +C_7361-438: code_metric: '7361-438' # size | 7,3 x 6,1 x 4,3 mm #code_letter: 'Kemet-—' diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip_devices.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip.yaml similarity index 85% rename from scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip_devices.yaml rename to scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip.yaml index 154814731..00accb63d 100644 --- a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip_devices.yaml +++ b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip.yaml @@ -1,3 +1,5 @@ +#ToDo: update dimensions without capacitor, fuse, inductor, and resistor sizes +# where those part types have a unique size definition file SMD_0603: code_imperial: "0603" code_metric: "1608" @@ -60,19 +62,20 @@ SMD_1210: terminator_spacing_max: 2.32 size_info: '(Body size source: http://www.tortai-tech.com/upload/download/2011102023233369053.pdf)' -SMD_1806: - code_imperial: "1806" - code_metric: "4516" - body_length: - nominal: 4.5 - tolerance: 0.2 - body_width: - nominal: 1.6 - tolerance: 0.2 - terminal_length: - nominal: 0.7 - tolerance: 0.3 - size_info: '(Body size source: https://www.modelithics.com/models/Vendor/MuRata/BLM41P.pdf)' +#Could not find any diode, fuse, or LED in this body size +# SMD_1806: + # code_imperial: "1806" + # code_metric: "4516" + # body_length: + # nominal: 4.5 + # tolerance: 0.2 + # body_width: + # nominal: 1.6 + # tolerance: 0.2 + # terminal_length: + # nominal: 0.7 + # tolerance: 0.3 + # size_info: '(Body size source: https://www.modelithics.com/models/Vendor/MuRata/BLM41P.pdf)' SMD_1812: code_imperial: "1812" diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip_devices_smaller_0402.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip_smaller_0402.yaml similarity index 100% rename from scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip_devices_smaller_0402.yaml rename to scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip_smaller_0402.yaml diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip_devices_smaller_0603.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip_smaller_0603.yaml similarity index 100% rename from scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip_devices_smaller_0603.yaml rename to scripts/SMD_chip_package_rlc-etc/size_definitions/size_default_chip_smaller_0603.yaml diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_inductor.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_inductor.yaml index a8f48aed4..752834e5c 100644 --- a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_inductor.yaml +++ b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_inductor.yaml @@ -1,4 +1,18 @@ -SMD_1008: +L_0805: + code_imperial: "0805" + code_metric: "2012" + body_length: + minimum: 1.7 + maximum: 2.3 + body_width: + minimum: 0.6 + maximum: 1.2 + terminal_length: + minimum: 0.1 + maximum: 0.3 + size_info: '(Body size source: IPC-SM-782 page 80, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +L_1008: code_imperial: "1008" code_metric: "2520" body_length: @@ -13,3 +27,30 @@ SMD_1008: ipc_reference: "ipc_spec_larger_or_equal_0603" size_info: '(Body size source: https://ecsxtal.com/store/pdf/ECS-MPI2520-SMD-POWER-INDUCTOR.pdf)' +L_1206: + code_imperial: "1206" + code_metric: "3216" + body_length: + minimum: 2.9 + maximum: 3.5 + body_width: + minimum: 1.3 + maximum: 1.9 + terminal_length: + minimum: 0.2 + maximum: 0.5 + size_info: '(Body size source: IPC-SM-782 page 80, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +L_1806: + code_imperial: "1806" + code_metric: "4516" + body_length: + minimum: 4.2 + maximum: 4.8 + body_width: + minimum: 0.6 + maximum: 1.2 + terminal_length: + minimum: 0.3 + maximum: 0.8 + size_info: '(Body size source: IPC-SM-782 page 80, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor.yaml deleted file mode 100644 index 74c2a1da6..000000000 --- a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor.yaml +++ /dev/null @@ -1,14 +0,0 @@ -SMD_4020: - code_imperial: "4020" - code_metric: "10251" - body_length: - nominal: 10.2 - tolerance: [0.05, 0.2] - body_width: - nominal: 5.1 - tolerance: [0.05, 0.2] - terminal_length: - nominal: 0.9 - tolerance: 0.2 - ipc_reference: "ipc_spec_larger_or_equal_0603" - size_info: '(Body size source: http://datasheet.octopart.com/HVC0603T5004FET-Ohmite-datasheet-26699797.pdf)' diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor_chip.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor_chip.yaml new file mode 100644 index 000000000..d76dfc7a3 --- /dev/null +++ b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor_chip.yaml @@ -0,0 +1,112 @@ +R_0603: + code_imperial: "0603" + code_metric: "1608" + body_length: + minimum: 1.5 + maximum: 1.7 + body_width: + minimum: 0.7 + maximum: 0.95 + terminal_length: + minimum: 0.15 + maximum: 0.4 + size_info: '(Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +R_0805: + code_imperial: "0805" + code_metric: "2012" + body_length: + minimum: 1.85 + maximum: 2.15 + body_width: + minimum: 1.1 + maximum: 1.4 + terminal_length: + minimum: 0.15 + maximum: 0.65 + size_info: '(Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +R_1206: + code_imperial: "1206" + code_metric: "3216" + body_length: + minimum: 3.05 + maximum: 3.35 + body_width: + minimum: 1.45 + maximum: 1.75 + terminal_length: + minimum: 0.25 + maximum: 0.75 + size_info: '(Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +R_1210: + code_imperial: "1210" + code_metric: "3225" + body_length: + minimum: 3.05 + maximum: 3.35 + body_width: + minimum: 2.34 + maximum: 2.64 + terminal_length: + minimum: 0.25 + maximum: 0.75 + size_info: '(Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +R_2010: + code_imperial: "2010" + code_metric: "5025" + body_length: + minimum: 4.85 + maximum: 5.15 + body_width: + minimum: 2.35 + maximum: 2.65 + terminal_length: + minimum: 0.35 + maximum: 0.85 + size_info: '(Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +SMD_1812: + code_imperial: "1812" + code_metric: "4532" + body_length: + nominal: 4.5 + tolerance: 0.2 + body_width: + nominal: 3.2 + tolerance: 0.2 + terminal_length: + nominal: 0.5 + tolerance: 0.2 + size_info: '(Body size source: https://www.nikhef.nl/pub/departments/mt/projects/detectorR_D/dtddice/ERJ2G.pdf)' + +R_2512: + code_imperial: "2512" + code_metric: "6332" + body_length: + minimum: 6.15 + maximum: 6.45 + body_width: + minimum: 3.05 + maximum: 3.35 + terminal_length: + minimum: 0.35 + maximum: 0.85 + size_info: '(Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' + +R_4020: + code_imperial: "4020" + code_metric: "10251" + body_length: + nominal: 10.2 + tolerance: [0.05, 0.2] + body_width: + nominal: 5.1 + tolerance: [0.05, 0.2] + terminal_length: + nominal: 0.9 + tolerance: 0.2 + ipc_reference: "ipc_spec_larger_or_equal_0603" + size_info: '(Body size source: http://datasheet.octopart.com/HVC0603T5004FET-Ohmite-datasheet-26699797.pdf)' diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor_chip_smaller_0603.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor_chip_smaller_0603.yaml new file mode 100644 index 000000000..9ee75c4c5 --- /dev/null +++ b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor_chip_smaller_0603.yaml @@ -0,0 +1,12 @@ +R_0402: + code_imperial: "0402" + code_metric: "1005" + body_length: + minimum: 1.0 + maximum: 1.1 + body_width: + minimum: 0.48 + maximum: 0.6 + terminator_spacing_min: 0.4 + terminator_spacing_max: 0.7 + size_info: '(Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf)' diff --git a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_wide_body_chip_resistor.yaml b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor_chip_wide_body.yaml similarity index 97% rename from scripts/SMD_chip_package_rlc-etc/size_definitions/size_wide_body_chip_resistor.yaml rename to scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor_chip_wide_body.yaml index 25cdfe0ab..a9d642060 100644 --- a/scripts/SMD_chip_package_rlc-etc/size_definitions/size_wide_body_chip_resistor.yaml +++ b/scripts/SMD_chip_package_rlc-etc/size_definitions/size_resistor_chip_wide_body.yaml @@ -1,4 +1,4 @@ -SMD_0612: +R_0612: code_imperial: "0612" code_metric: "1632" body_length: @@ -13,7 +13,7 @@ SMD_0612: ipc_reference: "ipc_spec_larger_or_equal_0603" size_info: '(Body size source: https://www.vishay.com/docs/20019/rcwe.pdf)' -SMD_0815: +R_0815: code_imperial: "0815" code_metric: "2038" body_length: @@ -28,7 +28,7 @@ SMD_0815: ipc_reference: "ipc_spec_larger_or_equal_0603" size_info: '(Body size source: http://www.yageo.com/documents/recent/PYu-PRPFPH_521_RoHS_L_0.pdf)' -SMD_1020: +R_1020: code_imperial: "1020" code_metric: "2550" body_length: @@ -43,7 +43,7 @@ SMD_1020: ipc_reference: "ipc_spec_larger_or_equal_0603" size_info: '(Body size source: https://www.vishay.com/docs/20019/rcwe.pdf)' -SMD_1218: +R_1218: code_imperial: "1218" code_metric: "3246" body_length: