Order of Selected Items Presented To Extension Scripts
Warning: This question might be specefic to Inkscape extension scripts written in Python.
I've come up with ideas for several little extensions scripts I'd like to write for Inkscape. Most deal with allowing the type of "precision" drawing that would make Inkscape more suitable for precision drawing. I keep running into an obstacle when I think about the design of these scripts, and I thought I might get some help here.
An example may be the easiest way to ask my question.
I want to write a script that makes one line segment parallel or perpendicular to another line segment. The problem is that I want to make the line segment selected last by the user parallel to the line segment that is selected first, not the other way around.
I'm looking for a way to do this without having the user run two scripts. The first to select the line that will not be modified, and the second to select the line that will be modified and that then performs the operation.
Does Inkscape "deliver" the selected items to an extension script in the order they were selected? Or is the order random? If the order isn't random, which items (or nodes) would come first? Those selected last by the user, or those selected first?
I hope my question makes sense. I might be pushing the envelope of what is possible with Inkscape's current extensions script system.
Thanks,
Scott Huey
On 10/11/07, Redefined Horizons <redefined.horizons@...400...> wrote:
I want to write a script that makes one line segment parallel or perpendicular to another line segment.
If these segments are indeed segments, i.e. parts of some paths, then you can't do this with scripting yet because scripts only get object selection, not node selection.
Also, I think it can be done easy enough without scripting: snap the nodes of the second segment to the first using "snap nodes to path", so they become parallel, then move the second one away to where you want it to be. Or just duplicate the first one and move away the copy.
Bulia wrote: "Also, I think it can be done easy enough without scripting: snap the nodes of the second segment to the first using "snap nodes to path", so they become parallel, then move the second one away to where you want it to be. Or just duplicate the first one and move away the copy."
I guess I never thought about creating a parallel line that way. I guess I need to stop thinking like a CAD user and start thinking like an Inkscape user. :]
Still, the same basic concept would apply to some other things that I had in mind.
Does Inkscape present selected items to an extension script in the order of selection? If so, in which order?
Thanks for the quick response.
Scott Huey
On 10/11/07, bulia byak <buliabyak@...400...> wrote:
On 10/11/07, Redefined Horizons <redefined.horizons@...400...> wrote:
I want to write a script that makes one line segment parallel or perpendicular to another line segment.
If these segments are indeed segments, i.e. parts of some paths, then you can't do this with scripting yet because scripts only get object selection, not node selection.
Also, I think it can be done easy enough without scripting: snap the nodes of the second segment to the first using "snap nodes to path", so they become parallel, then move the second one away to where you want it to be. Or just duplicate the first one and move away the copy.
-- bulia byak Inkscape. Draw Freely. http://www.inkscape.org
On Thu, 2007-10-11 at 13:48 -0700, Redefined Horizons wrote:
Does Inkscape present selected items to an extension script in the order of selection? If so, in which order?
It should. I'm not sure if inkex.py may reorder them. But they should appear along the command line in order of selection. As Bulia noted, these would be objects, we don't have a way to specify the nodes selected inside a path.
--Ted
participants (3)
-
bulia byak
-
Redefined Horizons
-
Ted Gould