def getEdgesAngleSVG( edge1: Part.Edge, edge2: Part.Edge, arc_radius: float, view_plane: WorkingPlane.Plane, font_family: str, font_size: Union[float, str], bent_angle_exclude_list: Tuple[float, ...] = (90, 180), stroke_width: Union[float, str] = 0.2, stroke_color: str = "black", ) -> ElementTree.Element: """Returns svg representation for angle between two edges by drawing an arc of given radius and adding angle text svg. It returns empty svg if edges doesn't intersect when extended infinitely. Parameters ---------- edge1: Part.Edge The first edge to get its angle dimension svg with edge2. edge2: The second edge to get its angle dimension svg with edge1. arc_radius: float The radius of dimension arc. view_plane: WorkingPlane.Plane The view plane acting as svg plane. font_family: str The font-family of angle dimension. font_size: float or str The font-size of angle dimension. bent_angle_exclude_list: tuple of float, optional If angle between two edges is present in bent_angle_exclude_list, then empty svg element will be returned. Default is (90, 180) stroke_width: float or str, optional The stroke-width of arc svg. Default is 0.2 stroke_color: str, optional The stroke color of arc svg. Default is "black". Returns ------- ElementTree.Element The generated edges angle dimension svg. """ intersection = DraftGeomUtils.findIntersection(edge1, edge2, True, True) if not intersection: return ElementTree.Element("g") else: intersection = intersection[0] p1 = max( DraftGeomUtils.getVerts(edge1), key=lambda x: x.distanceToPoint(intersection), ) p2 = max( DraftGeomUtils.getVerts(edge2), key=lambda x: x.distanceToPoint(intersection), ) angle = round( math.degrees( abs(DraftVecUtils.angle(p2.sub(intersection), p1.sub(intersection))))) if angle in bent_angle_exclude_list: return ElementTree.Element("g") arc_p1 = intersection.add(arc_radius * p2.sub(intersection).normalize()) arc_p2 = intersection.add(arc_radius * p1.sub(intersection).normalize()) arc_edge = DraftGeomUtils.arcFrom2Pts(arc_p1, arc_p2, intersection) arc_svg = getRoundEdgeSVG(arc_edge, view_plane, stroke_width, stroke_color) arc_mid_point = DraftGeomUtils.findMidpoint(arc_edge) proj_intersection = getProjectionToSVGPlane(intersection, view_plane) proj_mid_point = getProjectionToSVGPlane(arc_mid_point, view_plane) if round(proj_intersection.x) < round(proj_mid_point.x): text_anchor = "start" elif round(proj_intersection.x) > round(proj_mid_point.x): text_anchor = "end" else: text_anchor = "middle" if round(proj_intersection.y) < round(proj_mid_point.y): text_y = proj_mid_point.y + font_size elif round(proj_intersection.y) > round(proj_mid_point.y): text_y = proj_mid_point.y else: text_y = proj_mid_point.y + font_size / 2 angle_text_svg = getSVGTextElement( "{}°".format(angle), proj_mid_point.x, text_y, font_family, font_size, text_anchor, ) bent_angle_svg = ElementTree.Element("g") bent_angle_svg.extend([arc_svg, angle_text_svg]) return bent_angle_svg