Exemplo n.º 1
0
    def value(self):
        # type: () -> float
        """value in mm

        :return: ``float``
        """
        return _pcbnew.ToMM(self._obj.GetValue())
Exemplo n.º 2
0
    def from_wxSize(wxobj):
        """Convert a wxSize to a Point2D

        :param wxobj: point to convert
        :type wxobj: :class:`pcbnew.wxSize`

        :return: :class:`kicad.util.Point2D`
        """
        return Point2D(_pcbnew.ToMM(wxobj))
Exemplo n.º 3
0
    def __iter__(self):
        # TODO: for the moment, we need to parse the polygon from a string, needs to be improved!!
        # Reason: it seems we cannot access the polygons using std::vector using python
        lines = iter(self._obj.Format().split('\n'))

        polygons = list()
        for _ in range(int(lines.next()[len('polyset '):])):
            new_polygon = Polygon()
            for poly in range(int(lines.next()[len('poly '):])):
                xy_coord = []  # TODO: correct type
                for _ in range(int(lines.next())):
                    xy_coord.append([
                        _pcbnew.ToMM(int(v)) for v in lines.next().split(' ')
                    ])
                if poly == 0:
                    new_polygon._outline = xy_coord
                else:
                    new_polygon._holes.append(xy_coord)
            polygons.append(new_polygon)
            lines.next()

        # generate all polygons beforehand to prevent possible race-conditions
        for polygon in polygons:
            yield polygon
Exemplo n.º 4
0
    def thickness(self):
        """Thickness

        :return: ``float``
        """
        return _pcbnew.ToMM(self._obj.GetThickness())
Exemplo n.º 5
0
    def width(self):
        """Width of Track in mm

        :return: ``float``
        """
        return _pcbnew.ToMM(self._obj.GetWidth())
Exemplo n.º 6
0
    def drill(self):
        """Drill size of Via in mm

        :return: ``float``
        """
        return _pcbnew.ToMM(self._obj.GetDrillValue())