Jon wrote:
... a) Convert a rectangle to a path. Will rectToPath in pathmodifier do this and, if so, what do I need to provide for self amd node?
The self parameter is nothing to worry about, it has to do with Python's class syntax (you can compare it to explicitly passing the this pointer in C++, if that helps): http://docs.python.org/tutorial/classes.html#class-objects
From what I see in the code the node parameter should get an XML/SVG node.
b) Convert an arc/ellipse to a path. Will ArcToPath in
cubicsuperpath do this and, if so, what do I need to provide for p1 and params?
It can probably do that, but it appears to be used internally when parsing paths, so I'm not quite sure what the parameters are exactly. But you could try figuring it out by looking at CubicSuperPath and perhaps placing a few prints here and there.
- I also need to understand how to apply a transform to a path (i.e.
embed the transformation into the path so the transform is not required) so that effects applied to a heavil transformed path (as can happen when using ellipses / arcs) are applied correctly. Will one of the routines in simpletransform do what I want and, if so, which one and what would I need to supply to it?
applyTransformToPath would be the likely candidate. It needs a matrix (mat, a list of lists, see parseTransform) and a "path" (probably as returned by CubicSuperPath).
I still need to provide the capability via an extension to
convert a line into two lines of a given line width and a set distance apart. This will need to work with curved paths, both open and closed. The way that I would do this manually in Inkscape would be to create a stroke, duplicate it, set the widths of the two strokes such that the lower is the width of the two lines plus the gap and the upper is the width of the gap, convert both strokes to paths using _P_ath - _S_troke to Path and then to use the _P_ath - _D_ifference function to leave two lines of the required width and separation. How could I go about recreating this from within a extension? Is there an easier method to do this, given that the two lines should not be joined at the ends?
Possibly the python bindings for lib2geom can help you here. I'd also look at using inset/outset.
... With regard to these last two, I believe there may be something possible using py2geom, but where do I find details of this? What are its capabilities and are they documented anywhere?
In the python shell, import the python bindings and use help(...) (fill in the module name, a class name, or a function name).