def _drawXZentities(self):
     plane = 'XZ'
     options = {"tag": "geometry", "outline": "yellow", "fill": None}
     cut_depth = self.params['cut_depth']
     ref_X = self.params['ref_X']
     delta_X = self.params['delta_X']
     delta_Y = self.params['delta_Y']
     half_side_x = delta_X / 2
     bit_radius = self.params['bit_diameter'] / 2
     stock_height = self.params['stock_height']
     if (delta_X + delta_Y != 0) and (delta_Y * delta_X == 0):
         if not self.entities[plane]:
             self.entities[plane].append(Rectangle(self.view_space))
         if self.reference_point == 'center':
             self.entities[plane][0].setAll(
                 (ref_X - half_side_x - bit_radius,
                  stock_height - cut_depth,
                  ref_X + half_side_x + bit_radius, stock_height),
                 options).draw()
         elif self.reference_point == 'lower-left':
             self.entities[plane][0].setAll(
                 (ref_X - bit_radius, stock_height - cut_depth,
                  ref_X + delta_X + bit_radius, stock_height),
                 options).draw()
         else:
             raise ReferencePointError(self, self.reference_point)
     else:
         raise TypeError(
             'RoundEndedRectangleDrawing does not implement _drawXZentities'
         )
Example #2
0
 def _drawXZentities(self):
     plane = 'XZ'
     options = {"tag": "geometry", "outline": "yellow", "fill": None}
     cut_depth = self.params['cut_depth']
     ref_X = self.params['ref_X']
     side_X = self.params['side_X']
     half_side_x = side_X / 2
     inner_adj, outer_adj = self.getAdjustments()
     stock_height = self.params['stock_height']
     if not self.entities[plane]:
         self.entities[plane].append(Rectangle(
             self.view_space))  # inner edge
         self.entities[plane].append(Rectangle(
             self.view_space))  # outer edge
     if self.reference_point == 'center':
         self.entities[plane][0].setAll(
             (ref_X - half_side_x - inner_adj, stock_height - cut_depth,
              ref_X + half_side_x + inner_adj, stock_height),
             options).draw()
         self.entities[plane][1].setAll(
             (ref_X - half_side_x - outer_adj, stock_height - cut_depth,
              ref_X + half_side_x + outer_adj, stock_height),
             options).draw()
     elif self.reference_point == 'lower-left':
         self.entities[plane][0].setAll(
             (ref_X - inner_adj, stock_height - cut_depth,
              ref_X + side_X + inner_adj, stock_height), options).draw()
         self.entities[plane][1].setAll(
             (ref_X - outer_adj, stock_height - cut_depth,
              ref_X + side_X + outer_adj, stock_height), options).draw()
     else:
         raise ReferencePointError(self, self.reference_point)
    def _drawXYentities(self):
        plane = 'XY'
        options = {"tag": "geometry", "outline": "yellow", "fill": None}
        ref_X = self.params['ref_X']
        ref_Y = self.params['ref_Y']
        stock_X = self.params['stock_length']
        stock_Y = self.params['stock_width']
        shoulder_offset = self.params['shoulder_offset']
        corner_radius = self.params['corner_radius']

        side_X = stock_X - (2 * shoulder_offset)
        side_Y = stock_Y - (2 * shoulder_offset)

        half_side_X = side_X / 2
        half_side_Y = side_Y / 2
        if not self.entities[plane]:
            self.entities[plane].append(RoundedRectangle(self.view_space))
        if self.reference_point == 'center':
            self.entities[plane][0].setAll(
                (ref_X - half_side_X, ref_Y - half_side_Y, ref_X + half_side_X,
                 ref_Y + half_side_Y, corner_radius), options).draw()
        elif self.reference_point == 'lower-left':
            self.entities[plane][0].setAll(
                (ref_X, ref_Y, ref_X + side_X, ref_Y + side_Y, corner_radius),
                options).draw()
        else:
            raise ReferencePointError(self, self.reference_point)
 def _drawXYentities(self):
     plane = 'XY'
     options = {"tag":"geometry", "outline":"yellow", "fill":None}
     ref_X = self.params['ref_X']
     ref_Y = self.params['ref_Y']
     side_X = self.params['side_X']
     side_Y = self.params['side_Y']
     half_side_x = side_X / 2
     half_side_y = side_Y / 2
     corner_radius = self.params['corner_radius']
     inner_adj, outer_adj = self.getAdjustments()
     if not self.entities[plane]:
         self.entities[plane].append(RoundedRectangle(self.view_space)) # inner edge
         self.entities[plane].append(RoundedRectangle(self.view_space)) # outer edge
     if self.reference_point == 'center':
         self.entities[plane][0].setAll(
             (
                 ref_X - half_side_x - inner_adj,
                 ref_Y - half_side_y - inner_adj,
                 ref_X + half_side_x + inner_adj,
                 ref_Y + half_side_y + inner_adj,
                 corner_radius + inner_adj
             ),
             options
         ).draw()
         self.entities[plane][1].setAll(
             (
                 ref_X - half_side_x - outer_adj,
                 ref_Y - half_side_y - outer_adj,
                 ref_X + half_side_x + outer_adj,
                 ref_Y + half_side_y + outer_adj,
                 corner_radius + outer_adj
             ),
             options
         ).draw()
     elif self.reference_point == 'lower-left':
         self.entities[plane][0].setAll(
             (
                 ref_X - inner_adj,
                 ref_Y - inner_adj,
                 ref_X + side_X + inner_adj,
                 ref_Y + side_Y + inner_adj,
                 corner_radius + inner_adj
             ),
             options
         ).draw()
         self.entities[plane][1].setAll(
             (
                 ref_X - outer_adj,
                 ref_Y - outer_adj,
                 ref_X + side_X + outer_adj,
                 ref_Y + side_Y + outer_adj,
                 corner_radius + outer_adj
             ),
             options
         ).draw()
     else:
         raise ReferencePointError(self, self.reference_point)
Example #5
0
 def _drawYZentities(self):
     plane = 'YZ'
     options = {"tag": "geometry", "outline": "yellow", "fill": None}
     cut_depth = self.params['cut_depth']
     ref_Y = self.params['ref_Y']
     side_Y = self.params['side_Y']
     half_side_Y = side_Y / 2
     stock_height = self.params['stock_height']
     if not self.entities[plane]:
         self.entities[plane].append(Rectangle(self.view_space))
     if self.reference_point == 'center':
         self.entities[plane][0].setAll(
             (ref_Y - half_side_Y, stock_height - cut_depth,
              ref_Y + half_side_Y, stock_height), options).draw()
     elif self.reference_point == 'lower-left':
         self.entities[plane][0].setAll((ref_Y, stock_height - cut_depth,
                                         ref_Y + side_Y, stock_height),
                                        options).draw()
     else:
         raise ReferencePointError(self, self.reference_point)
Example #6
0
 def _drawXYentities(self):
     plane = 'XY'
     options = {"tag": "geometry", "outline": "yellow", "fill": None}
     ref_X = self.params['ref_X']
     ref_Y = self.params['ref_Y']
     side_X = self.params['side_X']
     side_Y = self.params['side_Y']
     half_side_X = side_X / 2
     half_side_Y = side_Y / 2
     bit_radius = self.params['bit_diameter'] / 2
     if not self.entities[plane]:
         self.entities[plane].append(RoundedRectangle(self.view_space))
     if self.reference_point == 'center':
         self.entities[plane][0].setAll(
             (ref_X - half_side_X, ref_Y - half_side_Y, ref_X + half_side_X,
              ref_Y + half_side_Y, bit_radius), options).draw()
     elif self.reference_point == 'lower-left':
         self.entities[plane][0].setAll(
             (ref_X, ref_Y, ref_X + side_X, ref_Y + side_Y, bit_radius),
             options).draw()
     else:
         raise ReferencePointError(self, self.reference_point)
 def _drawXZentities(self):
     plane = 'XZ'
     options = {"tag": "geometry", "outline": "yellow", "fill": None}
     cut_depth = self.params['cut_depth']
     ref_X = self.params['ref_X']
     stock_X = self.params['stock_length']
     shoulder_offset = self.params['shoulder_offset']
     side_X = stock_X - (2 * shoulder_offset)
     half_side_X = side_X / 2
     stock_height = self.params['stock_height']
     if not self.entities[plane]:
         self.entities[plane].append(Rectangle(self.view_space))
     if self.reference_point == 'center':
         self.entities[plane][0].setAll(
             (ref_X - half_side_X, stock_height - cut_depth,
              ref_X + half_side_X, stock_height), options).draw()
     elif self.reference_point == 'lower-left':
         self.entities[plane][0].setAll((ref_X, stock_height - cut_depth,
                                         ref_X + side_X, stock_height),
                                        options).draw()
     else:
         raise ReferencePointError(self, self.reference_point)