def set_symbol_attribute(self, instance, openjson_inst):
        """ Fill out an openjson symbol attribute from an eagle instance
        and an openjson instance. """

        # TODO: handle mirror

        cpt = self.design.components.components[openjson_inst.library_id]

        attr = openjson_inst.symbol_attributes[self.cptgate2body_index[cpt, instance.gate]]

        attr.x = self.make_length(instance.x)
        attr.y = self.make_length(instance.y)
        attr.rotation = self.make_angle(instance.rot or '0')

        if instance.smashed == 'yes':
            annotations = self.iter_instance_annotations(instance)
        else:
            annotations = sorted(self.cptgate2ann_map.get((cpt, instance.gate)).items())

        for name, ann in annotations:
            ann = Annotation('', ann.x, ann.y, ann.rotation, ann.visible)
            if name == 'name':
                ann.value = openjson_inst.instance_id
                attr.add_annotation(ann)
            elif name == 'value' and 'value' in openjson_inst.attributes:
                ann.value = openjson_inst.attributes['value']
                attr.add_annotation(ann)

        self.part2gate2symattr[instance.part][instance.gate] = attr
    def set_symbol_attribute(self, instance, openjson_inst):
        """ Fill out an openjson symbol attribute from an eagle instance
        and an openjson instance. """

        cpt = self.design.components.components[openjson_inst.library_id]

        attr = openjson_inst.symbol_attributes[self.cptgate2body_index[
            cpt, instance.gate]]

        attr.x = self.make_length(instance.x)
        attr.y = self.make_length(instance.y)
        attr.flip = is_mirrored(instance.rot)
        attr.rotation = make_angle(instance.rot or '0')

        if instance.smashed == 'yes':
            annotations = self.iter_instance_annotations(instance)
        else:
            annotations = sorted(
                self.cptgate2ann_map.get((cpt, instance.gate)).items())

        for name, ann in annotations:
            ann = Annotation('', ann.x, ann.y, ann.rotation, ann.visible)
            if name == 'name':
                ann.value = openjson_inst.instance_id
                if len(openjson_inst.symbol_attributes) > 1:
                    ann.value += instance.gate or ''
                attr.add_annotation(ann)
            elif name == 'value' and 'value' in openjson_inst.attributes:
                ann.value = openjson_inst.attributes['value']
                attr.add_annotation(ann)

        self.part2gate2symattr[instance.part][instance.gate] = attr