Esempio n. 1
0
    def _wrap_drawsegment(instance):
        obj_shape = instance.GetShape()

        if obj_shape is pcbnew.S_SEGMENT:
            return kicad.new(Segment, instance)

        if obj_shape is pcbnew.S_CIRCLE:
            return kicad.new(Circle, instance)

        if obj_shape is pcbnew.S_ARC:
            return kicad.new(Arc, instance)
Esempio n. 2
0
    def wrap(instance):
        """Wraps a wxPoint object from pcbnew and returns a Point one.

        This function should not be generally used, but it's provided as
        a helper when migrating old API code.

        :param instance: input wxPoint to wrap.
        :type instance: wxPoint
        :return: Point
        """
        wrapped_point = kicad.new(Point, instance)
        wrapped_point._class = Point
        return wrapped_point
Esempio n. 3
0
    def wrap(instance):
        """Wraps a wxPoint object from pcbnew and returns a Point one.

        This function should not be generally used, but it's provided as
        a helper when migrating old API code.

        :param instance: input wxPoint to wrap.
        :type instance: wxPoint
        :return: Point
        """
        wrapped_point = kicad.new(Point, instance)
        wrapped_point._class = Point
        return wrapped_point
Esempio n. 4
0
    def _wrap_drawsegment(instance):
        obj_shape = instance.GetShape()

        if obj_shape is pcbnew.S_SEGMENT:
            return kicad.new(Segment, instance)

        if obj_shape is pcbnew.S_CIRCLE:
            return kicad.new(Circle, instance)

        if obj_shape is pcbnew.S_ARC:
            return kicad.new(Arc, instance)

        if obj_shape is pcbnew.S_POLYGON:
            return kicad.new(Polygon, instance)

        # Time to fail
        layer = instance.GetLayer()
        layer_str = pcbnew.BOARD_GetStandardLayerName(layer)
        unsupported = ['S_CURVE', 'S_RECT', 'S_LAST']
        for unsup in unsupported:
            if obj_shape is getattr(pcbnew, unsup):
                raise TypeError('Unsupported shape type: pcbnew.{} on layer {}.'.format(unsup, layer_str))

        raise TypeError('Unrecognized shape type on layer {}'.format(layer_str))
Esempio n. 5
0
 def wrap(instance):
     """Wraps a C++ api TRACK object, and returns a `Track`."""
     return kicad.new(Zone, instance)
Esempio n. 6
0
 def wrap(instance):
     """Wraps a C++ api PAD object, and returns a `Pad`."""
     return kicad.new(Pad, instance)
Esempio n. 7
0
 def wrap(instance):
     """Takes a wxSize instance and returns a Size class."""
     wrapped_size = kicad.new(Size, instance)
     wrapped_size._class = Size
     return wrapped_size
Esempio n. 8
0
 def wrap(instance):
     if type(instance) is pcbnew.MODULE:
         return kicad.new(Module, instance)
Esempio n. 9
0
 def wrap(instance):
     if type(instance) is pcbnew.TEXTE_MODULE:
         return kicad.new(ModuleLabel, instance)
Esempio n. 10
0
 def wrap(instance):
     """Wraps a C++ api TRACK object, and returns a `Track`."""
     return kicad.new(Track, instance)
Esempio n. 11
0
 def wrap(instance):
     if type(instance) is pcbnew.DRAWSEGMENT:
         return Drawing._wrap_drawsegment(instance)
     elif type(instance) is pcbnew.TEXTE_PCB:
         return kicad.new(TextPCB, instance)
Esempio n. 12
0
 def wrap(instance):
     return kicad.new(Net, instance)
Esempio n. 13
0
 def wrap(instance):
     """Wraps a C++/old api BOARD object, and returns a Board."""
     return kicad.new(Board, instance)
Esempio n. 14
0
 def wrap(instance):
     """Wraps a C++ api PAD object, and returns a `Pad`."""
     return kicad.new(Pad, instance)
Esempio n. 15
0
 def wrap(instance):
     """Wraps a C++/old api BOARD object, and returns a Board."""
     return kicad.new(Board, instance)
Esempio n. 16
0
 def wrap(instance):
     """Wraps a C++/old api LSET object, and returns a LayerSet."""
     return kicad.new(LayerSet, instance)
Esempio n. 17
0
 def wrap(instance):
     """Wraps a C++/old api LSET object, and returns a LayerSet."""
     return kicad.new(LayerSet, instance)
Esempio n. 18
0
 def wrap(instance):
     """Takes a wxSize instance and returns a Size class."""
     wrapped_size = kicad.new(Size, instance)
     wrapped_size._class = Size
     return wrapped_size
Esempio n. 19
0
    def wrap(instance):
        wrapped_bbox = kicad.new(BoundingBox, instance)
        wrapped_bbox._class = BoundingBox

        return wrapped_bbox
Esempio n. 20
0
 def wrap(instance):
     if type(instance) is pcbnew.TEXTE_MODULE:
         return kicad.new(ModuleLabel, instance)
Esempio n. 21
0
 def wrap(instance):
     """Wraps a C++ api VIA object, and returns a `Via`."""
     return kicad.new(Via, instance)
Esempio n. 22
0
 def wrap(instance):
     if type(instance) is pcbnew.MODULE:
         return kicad.new(Module, instance)