Draft: Using square endcaps for lines in SVG output
This commit is contained in:
@@ -119,14 +119,14 @@ def get_arrow(obj,
|
|||||||
point.x, point.y)
|
point.x, point.y)
|
||||||
_transl = 'translate({},{})'.format(point.x, point.y)
|
_transl = 'translate({},{})'.format(point.x, point.y)
|
||||||
_scale = 'scale({size},{size})'.format(size=arrowsize)
|
_scale = 'scale({size},{size})'.format(size=arrowsize)
|
||||||
_style = 'style="stroke-miterlimit:4;stroke-dasharray:none"'
|
_style = 'style="stroke-miterlimit:4;stroke-dasharray:none;stroke-endcap:square"'
|
||||||
|
|
||||||
if obj.ViewObject.ArrowType == "Circle":
|
if obj.ViewObject.ArrowType == "Circle":
|
||||||
svg += '<circle '
|
svg += '<circle '
|
||||||
svg += _cx_cy_r + ' '
|
svg += _cx_cy_r + ' '
|
||||||
svg += 'fill="{}" stroke="{}" '.format("none", color)
|
svg += 'fill="{}" stroke="{}" '.format("none", color)
|
||||||
svg += 'style="stroke-width:{};'.format(linewidth)
|
svg += 'style="stroke-width:{};'.format(linewidth)
|
||||||
svg += 'stroke-miterlimit:4;stroke-dasharray:none" '
|
svg += 'stroke-miterlimit:4;stroke-dasharray:none;stroke-endcap:square" '
|
||||||
svg += 'freecad:skip="1"'
|
svg += 'freecad:skip="1"'
|
||||||
svg += '/>\n'
|
svg += '/>\n'
|
||||||
elif obj.ViewObject.ArrowType == "Dot":
|
elif obj.ViewObject.ArrowType == "Dot":
|
||||||
@@ -327,7 +327,7 @@ def _svg_dimension(obj, plane, scale, linewidth, fontsize,
|
|||||||
svg += stroke + '" '
|
svg += stroke + '" '
|
||||||
svg += 'stroke-width="' + str(linewidth) + ' px" '
|
svg += 'stroke-width="' + str(linewidth) + ' px" '
|
||||||
svg += 'style="stroke-width:' + str(linewidth)
|
svg += 'style="stroke-width:' + str(linewidth)
|
||||||
svg += ';stroke-miterlimit:4;stroke-dasharray:none" '
|
svg += ';stroke-miterlimit:4;stroke-dasharray:none;stroke-endcap:square" '
|
||||||
svg += 'freecad:basepoint1="'+str(p1.x)+' '+str(p1.y)+'" '
|
svg += 'freecad:basepoint1="'+str(p1.x)+' '+str(p1.y)+'" '
|
||||||
svg += 'freecad:basepoint2="'+str(p4.x)+' '+str(p4.y)+'" '
|
svg += 'freecad:basepoint2="'+str(p4.x)+' '+str(p4.y)+'" '
|
||||||
svg += 'freecad:dimpoint="'+str(p2.x)+' '+str(p2.y)+'"'
|
svg += 'freecad:dimpoint="'+str(p2.x)+' '+str(p2.y)+'"'
|
||||||
@@ -490,6 +490,11 @@ def get_svg(obj,
|
|||||||
stroke = utils.get_rgb(obj.ViewObject.LineColor)
|
stroke = utils.get_rgb(obj.ViewObject.LineColor)
|
||||||
elif hasattr(obj.ViewObject, "TextColor"):
|
elif hasattr(obj.ViewObject, "TextColor"):
|
||||||
stroke = utils.get_rgb(obj.ViewObject.TextColor)
|
stroke = utils.get_rgb(obj.ViewObject.TextColor)
|
||||||
|
if hasattr(obj.ViewObject, "TextColor"):
|
||||||
|
tstroke = utils.get_rgb(obj.ViewObject.TextColor)
|
||||||
|
else:
|
||||||
|
tstroke = stroke
|
||||||
|
|
||||||
|
|
||||||
lstyle = "none"
|
lstyle = "none"
|
||||||
if override:
|
if override:
|
||||||
@@ -617,6 +622,7 @@ def get_svg(obj,
|
|||||||
svg_path += 'fill="none" '
|
svg_path += 'fill="none" '
|
||||||
svg_path += 'stroke="{}" '.format(stroke)
|
svg_path += 'stroke="{}" '.format(stroke)
|
||||||
svg_path += 'stroke-width="{}" '.format(linewidth)
|
svg_path += 'stroke-width="{}" '.format(linewidth)
|
||||||
|
svg_path += 'stroke-endcap:square;'
|
||||||
svg_path += 'd="{}"'.format(path_dir_str)
|
svg_path += 'd="{}"'.format(path_dir_str)
|
||||||
svg_path += '/>'
|
svg_path += '/>'
|
||||||
svg += svg_path
|
svg += svg_path
|
||||||
@@ -667,7 +673,7 @@ def get_svg(obj,
|
|||||||
|
|
||||||
j = obj.ViewObject.Justification
|
j = obj.ViewObject.Justification
|
||||||
svg += svgtext.get_text(plane, techdraw,
|
svg += svgtext.get_text(plane, techdraw,
|
||||||
stroke, fontsize, n,
|
tstroke, fontsize, n,
|
||||||
r, p, t,
|
r, p, t,
|
||||||
linespacing, j)
|
linespacing, j)
|
||||||
|
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ def get_circle(plane,
|
|||||||
svg += 'stroke-width:{};'.format(linewidth)
|
svg += 'stroke-width:{};'.format(linewidth)
|
||||||
svg += 'stroke-miterlimit:4;'
|
svg += 'stroke-miterlimit:4;'
|
||||||
svg += 'stroke-dasharray:{};'.format(lstyle)
|
svg += 'stroke-dasharray:{};'.format(lstyle)
|
||||||
|
svg += 'stroke-endcap:square;'
|
||||||
svg += 'fill:{}'.format(fill) + '"'
|
svg += 'fill:{}'.format(fill) + '"'
|
||||||
svg += '/>\n'
|
svg += '/>\n'
|
||||||
return svg
|
return svg
|
||||||
@@ -330,6 +331,7 @@ def get_ellipse(plane,
|
|||||||
svg += 'stroke-width:{};'.format(linewidth)
|
svg += 'stroke-width:{};'.format(linewidth)
|
||||||
svg += 'stroke-miterlimit:4;'
|
svg += 'stroke-miterlimit:4;'
|
||||||
svg += 'stroke-dasharray:{};'.format(lstyle)
|
svg += 'stroke-dasharray:{};'.format(lstyle)
|
||||||
|
svg += 'stroke-endcap:square;'
|
||||||
svg += 'fill:{}'.format(fill) + '"'
|
svg += 'fill:{}'.format(fill) + '"'
|
||||||
svg += '/>\n'
|
svg += '/>\n'
|
||||||
return svg
|
return svg
|
||||||
@@ -440,6 +442,7 @@ def get_path(obj, plane,
|
|||||||
svg += 'stroke-width:{};'.format(linewidth)
|
svg += 'stroke-width:{};'.format(linewidth)
|
||||||
svg += 'stroke-miterlimit:4;'
|
svg += 'stroke-miterlimit:4;'
|
||||||
svg += 'stroke-dasharray:{};'.format(lstyle)
|
svg += 'stroke-dasharray:{};'.format(lstyle)
|
||||||
|
svg += 'stroke-endcap:square;'
|
||||||
svg += 'fill:{};'.format(fill)
|
svg += 'fill:{};'.format(fill)
|
||||||
# fill_opacity must be a number, but if it's `None` it is omitted
|
# fill_opacity must be a number, but if it's `None` it is omitted
|
||||||
if fill_opacity is not None:
|
if fill_opacity is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user