I've now nearly completed my project to implement the International Orienteering Federation mapping standards in Inkscape - three mapping standards, one of which has two symbol scales - which has resulted in a large number of extension files.
In order to simplify things, I'd like to be able to have, for a given subset of the symbols, four separate INX files each calling the same PY file where a parameter is passed to the PY file, not user selected, indicating which INX file has made the call. Is this possible? Is it possible to specify a variable in an INX file and ascribe a value to it without presenting the user with some form of parameter input?
Also, I'd like to be able to produce a routine to fill an inkscape closed shape with randomly sized (between a lower and upper size) and positioned dots where the user can alter the density of dots and where dots will not overlap / touch / be closer than a specified distance between them. This raises a number of questions:
1) Is it possible to specify a slider-type input tool in an INX file? 2) Is there a Python command or a routine in one of the Python extension supporting files (simplepath, etc.) to detect whether a point lies within the bounds of a closed shape? 3) Is there an available routine to determine the area of a closed shape? 3) Are there any simple ways to detect collision / distance between dots? I'd like to implement something similar to the 'Remove Overlaps' capability available within the 'Align and Distribute' dialog as part of the routine generating the dots, but with a single (polar - sqrt(x^2 * y^2)) variable related to the user-selected dot density determining how close the dots can be placed to each other. I can see this getting complex when the area, and hence the number of dots, gets large. 4) Getting more complex, would it be possible to have a gradient-filled shape and vary the density of dots dependent on the gradient?
----- Jon
On Sat, May 22, 2010 at 9:26 AM, Jon wrote:
In order to simplify things, I'd like to be able to have, for a given subset of the symbols, four separate INX files each calling the same PY file where a parameter is passed to the PY file, not user selected, indicating which INX file has made the call. Is this possible? Is it possible to specify a variable in an INX file and ascribe a value to it without presenting the user with some form of parameter input?
The colour extension do it by having a bunch of wrapper pairs of .inx and .py files that all include the main coloreffect.py then call the appropriate function.
The help extensions do it the way you suggest however. They have a hidden string parameter:
<param name="url" gui-hidden="true" type="string">http://inkscape.org/doc/inkscape-man.html</param>
that gets used by the launch_webbrowser.py extension.
You should be able to do the same thing and pass a string flag to specify what you want to do.
Also, I'd like to be able to produce a routine to fill an inkscape closed shape with randomly sized (between a lower and upper size) and positioned dots where the user can alter the density of dots and where dots will not overlap / touch / be closer than a specified distance between them. This raises a number of questions:
1) Is it possible to specify a slider-type input tool in an INX file?
Not yet.
2) Is there a Python command or a routine in one of the Python extension supporting files (simplepath, etc.) to detect whether a point lies within the bounds of a closed shape?
Don't know.
3) Is there an available routine to determine the area of a closed shape?
Ditto.
3) Are there any simple ways to detect collision / distance between dots? I'd like to implement something similar to the 'Remove Overlaps' capability available within the 'Align and Distribute' dialog as part of the routine generating the dots, but with a single (polar - sqrt(x^2
- y^2)) variable related to the user-selected dot density determining how
close the dots can be placed to each other. I can see this getting complex when the area, and hence the number of dots, gets large. 4) Getting more complex, would it be possible to have a gradient-filled shape and vary the density of dots dependent on the gradient?
All of those are easy to do from the command line but I don't think those functions are exposed to scripts. The scripts usually work on the dom itself... Look at the inkex.py include... I think that is all you have to work with.
The easiest way to fill a shape is by creating a rectangle that matches the bounds of the shape, with a patterned fill and use the shape as a clipping path. This would require predefined patterns, buy they could still be scaled. It would also (possibly) clip any of the pattern fill objects as the edges.
For the kind of interactivity you want, I think a path effect is necessary ( http://wiki.inkscape.org/wiki/index.php/MakingLivePathEffects )
-Rob A>
Thanks for thesuggestion. Now implemented and works well.
Jon
----- Original Message ----- From: "Rob Antonishen" <rob.antonishen@...155...> To: "Inkscape User Community" inkscape-user@lists.sourceforge.net Sent: Saturday, May 22, 2010 7:03 PM Subject: Re: [Inkscape-user] Possibilities with Inkscape extensions
The help extensions do it the way you suggest however. They have a hidden string parameter:
<param name="url" gui-hidden="true" type="string">http://inkscape.org/doc/inkscape-man.html</param>
that gets used by the launch_webbrowser.py extension.
You should be able to do the same thing and pass a string flag to specify what you want to do.
-Rob A>
------------------------------------------------------------------------------
_______________________________________________ Inkscape-user mailing list Inkscape-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-user
Jon-190 wrote:
- Is there an available routine to determine the area of a closed
shape?
you could try : Extensions->Visualize Path->Measure Path
which has been recently modified, see: https://bugs.launchpad.net/inkscape/+bug/269002
From: Jon [mailto:jon@...2711...] Sent: 22 May 2010 15:26 To: Inkscape User Community Subject: [Inkscape-user] Possibilities with Inkscape extensions
1) Is it possible to specify a slider-type input tool in an INX file?
2) Is there a Python command or a routine in one of the Python extension supporting files (simplepath, etc.) to detect whether a point lies within the bounds of a closed shape?
3) Is there an available routine to determine the area of a closed shape?
3) Are there any simple ways to detect collision / distance between dots? I'd like to implement something similar to the 'Remove Overlaps' capability available within the 'Align and Distribute' dialog as part of the routine generating the dots, but with a single (polar - sqrt(x^2 * y^2)) variable related to the user-selected dot density determining how close the dots can be placed to each other. I can see this getting complex when the area, and hence the number of dots, gets large.
4) Getting more complex, would it be possible to have a gradient-filled shape and vary the density of dots dependent on the gradient?
1) Not yet, nobody felt the need to implement it. It is a straightforward job to do it, so if you really need it, it will be a simple task.
2 and 3) You probably should start using "py2geom" (a python variant of the geometry library that Inkscape uses). It is still in development, but we are friendly folks that are happy to help you :)
4) I don't think this is possible with a pattern fill. Probably you would have to place all the dots 'manually'.
Cheers, Johan
From: Jon [mailto:jon@...2711...] Sent: 22 May 2010 15:26 To: Inkscape User Community Subject: [Inkscape-user] Possibilities with Inkscape extensions
1) Is it possible to specify a slider-type input tool in an INX file? 2) Is there a Python command or a routine in one of the Python extension supporting files (simplepath, etc.) to detect whether a point lies within the bounds of a closed shape? 3) Is there an available routine to determine the area of a closed shape? 3) Are there any simple ways to detect collision / distance between dots? I'd like to implement something similar to the 'Remove Overlaps' capability available within the 'Align and Distribute' dialog as part of the routine generating the dots, but with a single (polar - sqrt(x^2 * y^2)) variable related to the user-selected dot density determining how close the dots can be placed to each other. I can see this getting complex when the area, and hence the number of dots, gets large. 4) Getting more complex, would it be possible to have a gradient-filled shape and vary the density of dots dependent on the gradient?
participants (4)
-
unknown@example.com
-
Alvin Penner
-
Jon
-
Rob Antonishen