Beispiel #1
0
    def add_arrows(self) -> Tuple[Vec2, Vec2]:
        """
        Add arrows or ticks to dimension.

        Returns: dimension line connection points

        """
        attribs = {
            'color': self.dim_line_color,
        }
        start = self.dim_line_start
        end = self.dim_line_end
        outside = self.arrows_outside
        arrow1 = not self.suppress_arrow1
        arrow2 = not self.suppress_arrow2
        if self.tick_size > 0.:  # oblique stroke, but double the size
            if arrow1:
                self.add_blockref(
                    ARROWS.oblique,
                    insert=start,
                    rotation=self.dim_line_angle,
                    scale=self.tick_size * 2,
                    dxfattribs=attribs,
                )
            if arrow2:
                self.add_blockref(
                    ARROWS.oblique,
                    insert=end,
                    rotation=self.dim_line_angle,
                    scale=self.tick_size * 2,
                    dxfattribs=attribs,
                )
        else:
            scale = self.arrow_size
            start_angle = self.dim_line_angle + 180.
            end_angle = self.dim_line_angle
            if outside:
                start_angle, end_angle = end_angle, start_angle

            if arrow1:
                self.add_blockref(self.arrow1_name, insert=start, scale=scale, rotation=start_angle,
                                  dxfattribs=attribs)  # reverse
            if arrow2:
                self.add_blockref(self.arrow2_name, insert=end, scale=scale, rotation=end_angle, dxfattribs=attribs)

            if not outside:
                # arrows inside extension lines: adjust connection points for the remaining dimension line
                if arrow1:
                    start = connection_point(self.arrow1_name, start, scale, start_angle)
                if arrow2:
                    end = connection_point(self.arrow2_name, end, scale, end_angle)
            else:
                # add additional extension lines to arrows placed outside of dimension extension lines
                self.add_arrow_extension_lines()
        return start, end
Beispiel #2
0
    def add_arrow(self, location, rotate: bool) -> Vec2:
        """Add arrow or tick to dimension line, returns dimension line connection point."""
        arrows = self.arrows
        attribs = arrows.dxfattribs()

        arrow_name = arrows.arrow1_name
        if arrows.tick_size > 0.0:  # oblique stroke, but double the size
            self.add_blockref(
                ARROWS.oblique,
                insert=location,
                rotation=self.dim_line_angle,
                scale=arrows.tick_size * 2.0,
                dxfattribs=attribs,
            )
        else:
            scale = arrows.arrow_size
            angle = self.dim_line_angle
            if rotate:
                angle += 180.0

            self.add_blockref(
                arrow_name,
                insert=location,
                scale=scale,
                rotation=angle,
                dxfattribs=attribs,
            )
            location = connection_point(arrow_name, location, scale, angle)
        return location
Beispiel #3
0
    def add_arrow(self) -> Vec2:
        """ Add arrow or tick to dimension line, returns dimension line connection point. """
        attribs = {
            'color': self.dim_line_color,
        }
        arrow_name = self.arrow1_name
        location = self.point_on_circle
        outside = self.text_outside
        if self.tick_size > 0.:  # oblique stroke, but double the size
            self.add_blockref(
                ARROWS.oblique,
                insert=location,
                rotation=self.dim_line_angle,
                scale=self.tick_size * 2,
                dxfattribs=attribs,
            )
        else:
            scale = self.arrow_size
            angle = self.dim_line_angle
            if outside:
                angle += 180

            self.add_blockref(arrow_name,
                              insert=location,
                              scale=scale,
                              rotation=angle,
                              dxfattribs=attribs)
            location = connection_point(arrow_name, location, scale, angle)
        return location