Wayback Machine
Jan FEB Mar
Previous capture 5 Next capture
2010 2011 2012
2 captures
28 Jan 11 - 5 Feb 11
sparklines
Close Help
View Thread
 Print Thread
Geometry Constructions tool in Inkscape
prokoudine
#1 Print Post
Posted on 14-09-2010 14:45
Super Admin


Posts: 61
Joined: 21.06.09

Some time ago Headwar asked here in the forum how to enable Geometry Constructions tools, internally known as LPE Tool. I very nearly forgot about it, sorry about that. So here is the howto and more :)

The idea of the tool was to provide simple CAD drawing features like drawing a circle throw 3 points or drawing a bisector.

Before you go for it, I want to give an extra warning that the tool is highly unfinished. It was a GSoC 2008 project, but wasn't finished in time for the next releases and so got somewhat unmaintained. I don't think it was really touched ever since then, even though Maximilian, who created it, hasn't abandoned hope to return and give the tool all the love it really deserves :)

The simple step-by-step guide is based on the current revision number 9760, trunk (that is, the future 0.49). But I see no reason for this not to work with 0.48.

1. Open src/widgets/toolbox.cpp and go to line 1851. It looks like this:

Download source  Code
//        "    <toolitem action='ToolLPETool' />"




2. Uncomment it by removing double-slash in the beginning of the line

3. Save the file, close it. The tool will be enabled in toolbox now, but since it relies on several live path effects, we have to enable them as well.

EDIT: as su-v points out, you can just uncomment line 9 ("//#define LPE_ENABLE_TEST_EFFECTS") in 'src/live_effects/effect.cpp'), so you can do that and skip steps 4-5.

4. Open src/live_effects/effect.cpp, go to line 87. The #ifdef endif section contains all the live path effects that are disabled by default. presumably there is a way to build them by passing some variable for ,.configure script, but this is where my skills are badly lacking, so I'm giving you the wrong advice to edit the file :)

5. Cut and paste all the lines with effects you want from this section to the part after endif. The lines you need just for the tool are:

Download source  Code
    {ANGLE_BISECTOR,        N_("Angle bisector"),          "angle_bisector"},
    {CIRCLE_WITH_RADIUS,    N_("Circle (by center and radius)"),   "circle_with_radius"},
    {CIRCLE_3PTS,           N_("Circle by 3 points"),      "circle_3pts"},
    {LATTICE,               N_("Lattice Deformation"),     "lattice"},
    {LINE_SEGMENT,          N_("Line Segment"),            "line_segment"},
    {MIRROR_SYMMETRY,       N_("Mirror symmetry"),         "mirror_symmetry"},
    {PARALLEL,              N_("Parallel"),                "parallel"},
    {PATH_LENGTH,           N_("Path length"),             "path_length"},
    {PERP_BISECTOR,         N_("Perpendicular bisector"),  "perp_bisector"},
    {TANGENT_TO_CURVE,      N_("Tangent to curve"),        "tangent_to_curve"},
    {TEXT_LABEL,            N_("Text label"),              "text_label"},




The result should look like this:
Download source  Code

#ifdef LPE_ENABLE_TEST_EFFECTS
    {DOEFFECTSTACK_TEST,    N_("doEffect stack test"),     "doeffectstacktest"},
    // TRANSLATORS: boolean operations
    {BOOLOPS,               N_("Boolops"),                 "boolops"},
    {DYNASTROKE,            N_("Dynamic stroke"),          "dynastroke"},
    {EXTRUDE,               N_("Extrude"),                 "extrude"},
    {LATTICE,               N_("Lattice Deformation"),     "lattice"},
    {POWERSTROKE,           N_("Power stroke"),            "powerstroke"},
    {COPY_ROTATE,           N_("Rotate copies"),           "copy_rotate"},
    {RECURSIVE_SKELETON,    N_("Recursive skeleton"),      "recursive_skeleton"},
#endif
/* 0.46 */
    {BEND_PATH,             N_("Bend"),                     "bend_path"},
    {GEARS,                 N_("Gears"),                   "gears"},
    {PATTERN_ALONG_PATH,    N_("Pattern Along Path"),      "skeletal"},   // for historic reasons, this effect is called skeletal(strokes) in Inkscape:SVG
    {CURVE_STITCH,          N_("Stitch Sub-Paths"),        "curvestitching"},
/* 0.47 */
    {VONKOCH,               N_("VonKoch"),                 "vonkoch"},
    {KNOT,                  N_("Knot"),                    "knot"},
    {CONSTRUCT_GRID,        N_("Construct grid"),          "construct_grid"},
    {SPIRO,                 N_("Spiro spline"),            "spiro"},
    {ENVELOPE,              N_("Envelope Deformation"),    "envelope"},
    {INTERPOLATE,           N_("Interpolate Sub-Paths"),   "interpolate"},
    {ROUGH_HATCHES,         N_("Hatches (rough)"),         "rough_hatches"},
    {SKETCH,                N_("Sketch"),                  "sketch"},
    {RULER,                 N_("Ruler"),                   "ruler"},
/* 0.49 */
/* Unstable effects for lpe tool */
    {ANGLE_BISECTOR,        N_("Angle bisector"),          "angle_bisector"},
    {CIRCLE_WITH_RADIUS,    N_("Circle (by center and radius)"),   "circle_with_radius"},
    {CIRCLE_3PTS,           N_("Circle by 3 points"),      "circle_3pts"},
    {LINE_SEGMENT,          N_("Line Segment"),            "line_segment"},
    {MIRROR_SYMMETRY,       N_("Mirror symmetry"),         "mirror_symmetry"},
    {OFFSET,                N_("Offset"),                  "offset"},
    {PARALLEL,              N_("Parallel"),                "parallel"},
    {PATH_LENGTH,           N_("Path length"),             "path_length"},
    {PERP_BISECTOR,         N_("Perpendicular bisector"),  "perp_bisector"},
    {PERSPECTIVE_PATH,      N_("Perspective path"),        "perspective_path"},
    {TANGENT_TO_CURVE,      N_("Tangent to curve"),        "tangent_to_curve"},
    {TEXT_LABEL,            N_("Text label"),              "text_label"},




6. Save and close the file.

7. The last change you can do, even though it's not critical, is enabling the tool in Preferences dialog. Open src/ui/dialog/inkscape-preferences.cpp, go to line 544 and remove '//' from this and the next line. You should have something like

Download source  Code

//LPETool
// commented out, because the LPETool is not finished yet.
//this->AddPage(_page_lpetool, _("LPE Tool"), iter_tools, PREFS_PAGE_TOOLS_LPETOOL);
//this->AddNewObjectsStyle(_page_lpetool, "/tools/lpetool");




8. Run the usual ./configure && make && make install routine.

Now when you start Inkscape, the tool is in the very bottom of the toolbar:

libregraphicsworld.org/images/forum/inkscape/lpe-tool.png


And here are the modes:

libregraphicsworld.org/images/forum/inkscape/lpe-options.png


Curiously, Ruler LPE was considered generic enough to be included and it's available in regular Inkscape release. You can see it used in the demo of Mirror Symmetry mode in the video below.

In case you are wondering, what other disabled LPEs do, here is a quick guide.

doEffect stack test — just applies all avaliable effects to try to crash Inkscape. No practical use at all.

Boolops — boolean operations with paths, can be quite handy for Spiro splines when you want e.g. an O glyph out of two Spiro ellipses, but it crashes Inkscape too easily.

Dynamic stroke — was an early attempt at calligraphic live path effect. Doesn't work at all.

Extrude — does exactly what you think except it is of a very limited use. I don't remember the last time I used it, so I don't really know if it's any stable.

Lattice Deformation — gives you the usual 16 point over a path that you can drag around to deform that path. Interestingly the effect was introduced to Scribus (using same lib2geom library Inkscap uses for that) back in 2008 and demoed at Libre Graphics Meeting in Wroclaw. Andy Fitzsimon was its first official user :) Here is a photo of that happening (sorry for the quality)

libregraphicsworld.org/images/forum/inkscape/img_0001_04.jpg


I think it was Franz's (principal Scribus developer, on the left below) birthday too. He came for just one day.

libregraphicsworld.org/images/forum/inkscape/img_0002.jpg


Power stroke — this is work in progress by Johan Engelen (the guy who came up with live path effects in the first place). We discussed the design of this LPE back in May at Libre Graphics Meeting (see the interview published yesterday). The point of it is that you can variate width of a stroked path. I haven't played much with it yet, it's more or less stable for me, but severely lacks polishing. Will definitely be fun for type designers once it's finished (or maybe even now). It's available only in trunk, you won't find it in 0.48, I think.

Rotate copies — I loved this effect and was sorry to see it excluded from all releases. It creates a user-defined amount of copies of selected path at a given step in degrees and rotates them around a point you can set.

Recursive skeleton — I could never figure out how it works. You tell me :)

You can enable them all and have a look yourself :) Just keep in mind they are heavily untested and will beyond all doubt crash your lovely Inkscape that you surely want to keep away from evil destruction :)

But I'm writing this also in the hope that someone interested could step up and clean all this to make it available for everybody. And probably add a Measure mode ;)
Edited by prokoudine on 14-09-2010 15:55
 
prokoudine
#2 Print Post
Posted on 14-09-2010 14:47
Super Admin


Posts: 61
Joined: 21.06.09

And since I was at it, here is a quick and dirty video that demoes the tool: http://vimeo.com/14955725
 
Headwar
#3 Print Post
Posted on 15-09-2010 22:34
Newbie


Posts: 6
Joined: 07.08.10

Huge thanks Prokoudine, that's an amazing work ! And thanks a lot for the surprise video which indeed, is a great surprise ! Thank you again - and I appreciate the dedication Wink

I hope your work will attract developpers' attention and this tool will be resurrected for everyone to use. According to your video, the tools are more than promising, and I'm going to try it right now. Did I mention the video was great ?

Thank you again, especially knowing how busy you are.
Edited by Headwar on 15-09-2010 22:37
 
prokoudine
#4 Print Post
Posted on 15-09-2010 23:59
Super Admin


Posts: 61
Joined: 21.06.09

My please Smile I wanted to dip toes into screencasting anyway Smile
 
Headwar
#5 Print Post
Posted on 18-09-2010 02:22
Newbie


Posts: 6
Joined: 07.08.10

A quick note to say it works fine with 0.48 release's source code.

And those tools are really great, they just lack a little stability and ease of use. They are nevertheless very close to being usable. Looks like most of the job has been done and it just needs polishing : an U.I. designer to think of a way to make the right tools available, and behave as a firstcommer would expect, and a developper to apply those ideas - using the existing functions.

As an exemple : the (impressive) "tangent to curve" LPE works great but :
- it's disturbing at first that the primary shape disappears (as for most LPEs...)
- it takes time to understand the parameters
- the most usefull one ("Location along curve") is not interactive but a (senseless for the average user) number.

Imagine if this LPE was a tool in the toolbar. You'd select a curve, click this button and a (blue, red, or whatever) line would appear and move along the curve as you move the mouse :

i54.tinypic.com/2jdm0yx.gif

As you would click a second time, the line would be fixed at this position. That would be very user-friendly ("Inkscapely", I'd say), and all the functionnal programming is already in place :
- clicking the tool would create a clone of the selected shape and apply the LPE to this clone (so that it doesn't erase the selected shape), and the initial value of "Location along curve" would be the point of the curve closer to the mouse pointer. A message in the status bar would say "Click again to fix the location". The line color of the tangent would be set to something showing it's selected (say, red, maybe dotted)
- As you'd move the mouse, the "Location along curve" parameter would be refreshed to stay the closer point of the curve
- As the LMB is clicked, the "Location along curve" parameter would no longer be tied to the mouse position and the line color would be applied to the newly created tangent. The message from the status bar would be cleared.

Does it sound do-able from a developper point of view ?
Edited by Headwar on 18-09-2010 02:23
 
prokoudine
#6 Print Post
Posted on 18-09-2010 16:21
Super Admin


Posts: 61
Joined: 21.06.09

It's hard for me to judge from developer's POV, but I passed your suggestion to Maximilian who created the tool.
 
Isolda Levy
#7 Print Post
Posted on 20-09-2010 05:51
Newbie


Posts: 3
Joined: 20.09.10

Please question on an item: open src / widgets / toolbox.cpp and go to line 1851. I find this file. Help me.
ThanksFrown
 
prokoudine
#8 Print Post
Posted on 20-09-2010 12:55
Super Admin


Posts: 61
Joined: 21.06.09

@Isolda Levy I'm sorry, I don't understand: have you managed to find this file?
 
Isolda Levy
#9 Print Post
Posted on 20-09-2010 23:13
Newbie


Posts: 3
Joined: 20.09.10

no...this is the problemFrown
 
prokoudine
#10 Print Post
Posted on 21-09-2010 01:41
Super Admin


Posts: 61
Joined: 21.06.09

Ah. Well, I think I failed to make a special note in the initial posting that it's all geeky stuff about tweaking and compiling source code of Inkscape. It's not exactly difficult to do on Linux, because it's just a handful of commands (albeit it might feel weird when you do it first couple of times), it's somewhat more complicated on Mac as far as I can say (at least more handiwork), and it's rather difficult on Windows.

So unless you are using a Linux distribution like Ubuntu, I wouldn't recommend going through several circles of hell just to try a feature. I'm sorry if I disappointed you Sad If somebody creates a Win or Mac build (I don't know which system you are on), I can let you know.

But if you are on Linux and feeling brave, you need to download source code, unpack its archive, and there you will find all the files mentioned above.
 
Isolda Levy
#11 Print Post
Posted on 22-09-2010 05:47
Newbie


Posts: 3
Joined: 20.09.10

I use the windows system.
Anyway, thanks.
 
Jump to Forum: