def _setup(self) -> None: """ setup calculation values """ self.pos_radius = distance(self.center, self.dimlinepos) # type: float self.radius = distance(self.center, self.start) # type: float self.start_vector = (self.start - self.center).normalize() # type: Vector self.end_vector = (self.end - self.center).normalize() # type: Vector self.start_angle = self.start_vector.angle # type: float self.end_angle = self.end_vector.angle # type: float
def _get_dimvalue_text(self, section: int) -> str: """ 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)
def _draw_extension_lines(self, layout: 'GenericLayoutType') -> None: """ 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, )
def _setup(self) -> None: self.target_vector = (self.target - self.center).normalize() # type: Vector self.radius = distance(self.center, self.target) # type: float