Esempio n. 1
0
 def _setup(self):
     """ setup calculation values """
     self.pos_radius = distance(self.center, self.dimlinepos)
     self.radius = distance(self.center, self.start)
     self.start_vector = (self.start - self.center).normalize()
     self.end_vector = (self.end - self.center).normalize()
     self.start_angle = self.start_vector.angle_rad
     self.end_angle = self.end_vector.angle_rad
Esempio n. 2
0
    def _get_dimvalue_text(self, section):
        """ get the dimension value as text, distance from point1 to point2 """
        override = self.text_override[section]
        if len(override):
            return override
        point1, point2 = self._get_section_points(section)

        dimvalue = distance(point1, point2) * self.prop('scale')
        return self.format_dimtext(dimvalue)
Esempio n. 3
0
    def _draw_extension_lines(self, layout):
        """ build the extension lines entities """
        dimextlinegap = self.prop('dimextlinegap')
        attribs = {
            'color': self.prop('dimlinecolor'),
            'layer': self.prop('layer'),
        }

        for dimline_point, target_point in zip(self.dimline_points,
                                               self.measure_points):
            if distance(dimline_point, target_point) > max(
                    dimextlinegap, DIMENSIONS_MIN_DISTANCE):
                direction_vector = (target_point - dimline_point).normalize()
                target_point = target_point - (direction_vector *
                                               dimextlinegap)
                layout.add_line(
                    start=dimline_point,
                    end=target_point,
                    dxfattribs=attribs,
                )
Esempio n. 4
0
 def _setup(self):
     self.target_vector = (self.target - self.center).normalize()
     self.radius = distance(self.center, self.target)