![]() |
Home Compute Inkscape Contact | ![]() |
|||||
Draw Control HandlesDraws a separate path which follows the control handles of the selected path. This would probably be more useful with markers if it drew a separate path for each handle.
#!/usr/bin/env python
import inkex
class Handles(inkex.Effect):
def effect(self):
for id, node in self.selected.iteritems():
if node.tagName == 'path':
p = inkex.parsePath(node.attributes.getNamedItem('d').value)
a =[]
pen = None
subPathStart = None
for cmd,params in p:
if cmd == 'C':
a.extend([['M', params[:2]], ['L', pen],
['M', params[2:4]], ['L', params[-2:]]])
if cmd == 'Q':
a.extend([['M', params[:2]], ['L', pen],
['M', params[:2]], ['L', params[-2:]]])
if cmd == 'M':
subPathStart = params
if cmd == 'Z':
pen = subPathStart
else:
pen = params[-2:]
if len(a) > 0:
new = self.document.createElement('svg:path')
s = {'stroke-linejoin': 'miter', 'stroke-width': '1.0px',
'stroke-opacity': '1.0', 'fill-opacity': '1.0',
'stroke': '#000000', 'stroke-linecap': 'butt',
'fill': 'none'}
new.setAttribute('style', inkex.formatStyle(s))
new.setAttribute('d', inkex.formatPath(a))
node.parentNode.appendChild(new)
e = Handles()
e.affect()
Files: |
|||||||
![]() |
![]() |
||||||
| Home Compute Inkscape Contact | |||||||