no message
This commit is contained in:
parent
1c464b313d
commit
3de1e0559b
@ -4,29 +4,32 @@ import inkex
|
|||||||
from inkex.paths import Path
|
from inkex.paths import Path
|
||||||
from inkex import Circle
|
from inkex import Circle
|
||||||
|
|
||||||
# Draws red points at the path's beginning and blue point at the path's end
|
|
||||||
|
|
||||||
class StartEndPoints(inkex.Effect):
|
class StartEndPoints(inkex.Effect):
|
||||||
|
|
||||||
|
def drawCircle(self, group, color, point):
|
||||||
|
style = inkex.Style({'stroke': 'none', 'fill': color})
|
||||||
|
startCircle = group.add(Circle(cx=str(point[0]), cy=str(point[1]), r=str(self.svg.unittouu(str(self.options.dotsize/2) + "px"))))
|
||||||
|
startCircle.style = style
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
inkex.Effect.__init__(self)
|
inkex.Effect.__init__(self)
|
||||||
self.arg_parser.add_argument("--dotsize", type=int, default=10, help="Dot size (px) for self-intersecting points")
|
self.arg_parser.add_argument("--dotsize", type=int, default=10, help="Dot size (px) for self-intersecting points")
|
||||||
|
|
||||||
def effect(self):
|
def effect(self):
|
||||||
dot_group = node.getparent().add(inkex.Group())
|
dot_group = self.svg.add(inkex.Group())
|
||||||
|
|
||||||
for node in self.svg.selection.values():
|
|
||||||
|
|
||||||
|
for node in self.svg.selection.filter(inkex.PathElement):
|
||||||
points = list(node.path.end_points)
|
points = list(node.path.end_points)
|
||||||
start = points[0]
|
start = points[0]
|
||||||
end = points[len(points) - 1]
|
end = points[len(points) - 1]
|
||||||
|
|
||||||
style = inkex.Style({'stroke': 'none', 'fill': '#FF0000'})
|
if start[0] == end[0] and start[1] == end[1]:
|
||||||
startCircle = dot_group.add(Circle(cx=str(start[0]), cy=str(start[1]), r=str(self.svg.unittouu(str(self.options.dotsize/2) + "px"))))
|
self.drawCircle(dot_group, '#00FF00', start)
|
||||||
startCircle.style = style
|
self.drawCircle(dot_group, '#FFFF00', points[1]) #draw one point which gives direction of the path
|
||||||
|
else: #open contour with start and end point
|
||||||
|
self.drawCircle(dot_group, '#FF0000', start)
|
||||||
|
self.drawCircle(dot_group, '#0000FF', end)
|
||||||
|
|
||||||
|
|
||||||
style = inkex.Style({'stroke': 'none', 'fill': '#0000FF'})
|
|
||||||
endCircle = dot_group.add(Circle(cx=str(end[0]), cy=str(end[1]), r=str(self.svg.unittouu(str(self.options.dotsize/2) + "px"))))
|
|
||||||
endCircle.style = style
|
|
||||||
|
|
||||||
StartEndPoints().run()
|
StartEndPoints().run()
|
@ -4,6 +4,7 @@
|
|||||||
<id>fablabchemnitz.de.migrategroups</id>
|
<id>fablabchemnitz.de.migrategroups</id>
|
||||||
<label>What elements to migrate?</label>
|
<label>What elements to migrate?</label>
|
||||||
<label>Unchecked item types will be deleted!</label>
|
<label>Unchecked item types will be deleted!</label>
|
||||||
|
<param name="svg" type="bool" gui-text="svg">true</param>
|
||||||
<param name="rect" type="bool" gui-text="rect">true</param>
|
<param name="rect" type="bool" gui-text="rect">true</param>
|
||||||
<param name="circle" type="bool" gui-text="circle">true</param>
|
<param name="circle" type="bool" gui-text="circle">true</param>
|
||||||
<param name="ellipse" type="bool" gui-text="ellipse">true</param>
|
<param name="ellipse" type="bool" gui-text="ellipse">true</param>
|
||||||
|
@ -21,6 +21,7 @@ class MigrateGroups(inkex.Effect):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
inkex.Effect.__init__(self)
|
inkex.Effect.__init__(self)
|
||||||
|
self.arg_parser.add_argument("--svg", type=inkex.Boolean, default=True, help="svg")
|
||||||
self.arg_parser.add_argument("--rect", type=inkex.Boolean, default=True, help="rect")
|
self.arg_parser.add_argument("--rect", type=inkex.Boolean, default=True, help="rect")
|
||||||
self.arg_parser.add_argument("--circle", type=inkex.Boolean, default=True, help="circle")
|
self.arg_parser.add_argument("--circle", type=inkex.Boolean, default=True, help="circle")
|
||||||
self.arg_parser.add_argument("--ellipse", type=inkex.Boolean, default=True, help="ellipse")
|
self.arg_parser.add_argument("--ellipse", type=inkex.Boolean, default=True, help="ellipse")
|
||||||
@ -35,6 +36,7 @@ class MigrateGroups(inkex.Effect):
|
|||||||
def effect(self):
|
def effect(self):
|
||||||
|
|
||||||
namespace = []
|
namespace = []
|
||||||
|
namespace.append("{http://www.w3.org/2000/svg}svg") if self.options.svg else ""
|
||||||
namespace.append("{http://www.w3.org/2000/svg}rect") if self.options.rect else ""
|
namespace.append("{http://www.w3.org/2000/svg}rect") if self.options.rect else ""
|
||||||
namespace.append("{http://www.w3.org/2000/svg}circle") if self.options.circle else ""
|
namespace.append("{http://www.w3.org/2000/svg}circle") if self.options.circle else ""
|
||||||
namespace.append("{http://www.w3.org/2000/svg}ellipse") if self.options.ellipse else ""
|
namespace.append("{http://www.w3.org/2000/svg}ellipse") if self.options.ellipse else ""
|
||||||
|
Reference in New Issue
Block a user