예제 #1
0
 def parse_footprint(self, footprint_json):
     """ Extract the bodies for a footprint. """
     footprint = Footprint()
     for body_json in footprint_json.get('bodies'):
         body = self.parse_footprint_body(body_json)
         footprint.add_body(body)
     for gen_obj_json in footprint_json.get('gen_objs'):
         gen_obj = self.parse_gen_obj(gen_obj_json)
         footprint.add_gen_obj(gen_obj)
     return footprint
예제 #2
0
    def _convert_library(self, struct):
        """ Convert library """
        for image in struct.library.image:
            component = Component(image.image_id)
            self.design.add_component(image.image_id, component)
            fpt = Footprint()
            body = FBody()
            component.add_footprint(fpt)
            fpt.add_body(body)
            for pad in image.pin:
                body.add_pad(Pad(pad.pad_id, self.to_pixels(pad.vertex), self.to_pixels(pad.vertex)))
                for padstack in struct.library.padstack:
                    if padstack.padstack_id == pad.padstack_id:
                        shapes = [shape.shape for shape in padstack.shape]
                        for shape in self._convert_shapes(shapes, self.to_pixels(pad.vertex)):
                            body.add_shape(shape)
                        break

            for outline in image.outline:
                for shape in self._convert_shapes([outline.shape]):
                    body.add_shape(shape)
예제 #3
0
 def parse_footprint(self, footprint_json):
     """ Extract the bodies for a footprint. """
     footprint = Footprint()
     for body_json in footprint_json.get('bodies'):
         body = self.parse_footprint_body(body_json)
         footprint.add_body(body)
     for gen_obj_json in footprint_json.get('gen_objs'):
         gen_obj = self.parse_gen_obj(gen_obj_json)
         footprint.add_gen_obj(gen_obj)
     return footprint