Exemplo n.º 1
0
    def _append_geometry_data(self, data):
        # GRAPHIC_DATA_NAME: TYPE
        if data['GRAPHIC_DATA_NAME'] == 'LINE':
            start = [
                float(data['GRAPHIC_DATA_1']),
                float(data['GRAPHIC_DATA_2'])
            ]
            end = [
                float(data['GRAPHIC_DATA_3']),
                float(data['GRAPHIC_DATA_4'])
            ]

            line = shape.Line(start, end)
            self.geometry.append(line)
        elif data['GRAPHIC_DATA_NAME'] == 'ARC':
            start = [
                float(data['GRAPHIC_DATA_1']),
                float(data['GRAPHIC_DATA_2'])
            ]
            end = [
                float(data['GRAPHIC_DATA_3']),
                float(data['GRAPHIC_DATA_4'])
            ]
            center = [
                float(data['GRAPHIC_DATA_5']),
                float(data['GRAPHIC_DATA_6'])
            ]
            radius = float(data['GRAPHIC_DATA_7'])
            cw = True if data['GRAPHIC_DATA_9'] == 'CLOCKWISE' else False

            arc = shape.Arc(start, end, center, radius, cw)
            self.geometry.append(arc)
        else:
            pass
Exemplo n.º 2
0
    def update_body_center(self, data):
        if not self._center:
            self._center = []

        start = [float(data['GRAPHIC_DATA_1']), float(data['GRAPHIC_DATA_2'])]
        end = [float(data['GRAPHIC_DATA_3']), float(data['GRAPHIC_DATA_4'])]
        self._center.append(shape.Line(start, end))
Exemplo n.º 3
0
    def append_hole_data(self, data):
        """
        Append the data to the last hole
        :param data:
        :return:
        """
        if self.type == 'LINE':
            return

        if data['GRAPHIC_DATA_NAME'] == 'LINE':
            start = [
                float(data['GRAPHIC_DATA_1']),
                float(data['GRAPHIC_DATA_2'])
            ]
            end = [
                float(data['GRAPHIC_DATA_3']),
                float(data['GRAPHIC_DATA_4'])
            ]

            line = shape.Line(start, end)
            # self.hole.append(line)
            self.geometry.append_hole_data(line)
        elif data['GRAPHIC_DATA_NAME'] == 'ARC':
            start = [
                float(data['GRAPHIC_DATA_1']),
                float(data['GRAPHIC_DATA_2'])
            ]
            end = [
                float(data['GRAPHIC_DATA_3']),
                float(data['GRAPHIC_DATA_4'])
            ]
            center = [
                float(data['GRAPHIC_DATA_5']),
                float(data['GRAPHIC_DATA_6'])
            ]
            radius = float(data['GRAPHIC_DATA_7'])
            cw = True if data['GRAPHIC_DATA_9'] == 'CLOCKWISE' else False

            arc = shape.Arc(start, end, center, radius, cw)
            # self.hole.append(arc)
            self.geometry.append_hole_data(arc)
Exemplo n.º 4
0
    def _append_polygon_data(self, data):
        """
        Append data to the copper
        :param dict data:
        :return:
        """
        if data['GRAPHIC_DATA_NAME'] == 'LINE':
            start = [
                float(data['GRAPHIC_DATA_1']),
                float(data['GRAPHIC_DATA_2'])
            ]
            end = [
                float(data['GRAPHIC_DATA_3']),
                float(data['GRAPHIC_DATA_4'])
            ]
            width = float(data['GRAPHIC_DATA_5'])

            line = shape.Line(start, end, width)
            self.geometry.append(line)
        elif data['GRAPHIC_DATA_NAME'] == 'ARC':
            start = [
                float(data['GRAPHIC_DATA_1']),
                float(data['GRAPHIC_DATA_2'])
            ]
            end = [
                float(data['GRAPHIC_DATA_3']),
                float(data['GRAPHIC_DATA_4'])
            ]
            center = [
                float(data['GRAPHIC_DATA_5']),
                float(data['GRAPHIC_DATA_6'])
            ]
            radius = float(data['GRAPHIC_DATA_7'])
            cw = True if data['GRAPHIC_DATA_9'] == 'CLOCKWISE' else False
            width = float(data['GRAPHIC_DATA_8'])

            arc = shape.Arc(start, end, center, radius, cw, width)
            self.geometry.append(arc)
        else:
            pass
Exemplo n.º 5
0
    def append(self, data):
        """
        Append a raw data to the outline
        :param dict data: the dict includes the outline
        :return:
        """
        if data['GRAPHIC_DATA_NAME'] == 'LINE':
            start = [float(data['GRAPHIC_DATA_1']), float(data['GRAPHIC_DATA_2'])]
            end = [float(data['GRAPHIC_DATA_3']), float(data['GRAPHIC_DATA_4'])]

            line = shape.Line(start, end)
            self.geometry.append(line)
        elif data['GRAPHIC_DATA_NAME'] == 'ARC':
            start = [float(data['GRAPHIC_DATA_1']), float(data['GRAPHIC_DATA_2'])]
            end = [float(data['GRAPHIC_DATA_3']), float(data['GRAPHIC_DATA_4'])]
            center = [float(data['GRAPHIC_DATA_5']), float(data['GRAPHIC_DATA_6'])]
            radius = float(data['GRAPHIC_DATA_7'])
            cw = True if data['GRAPHIC_DATA_9'] == 'CLOCKWISE' else False

            arc = shape.Arc(start, end, center, radius, cw)
            self.geometry.append(arc)
        else:
            pass