Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Chopping a path
(10-11-2021, 08:08 AM)denzjos Wrote: @Ottia Tuota, I just used the 'break path apart' plugin to visualise that the chop is done the right way. Also, I have to break the paths apart to use the 'Render / Mass render / Stroke line on paths'. This way it is easy to choose parts of the path that I want to give a specific color.

Selecting the NO option produces the same effect as using the break path apart plugin (Part of the ofn-path-edit plugin)

[Image: cA6kMEV.png]
Samj PortableGimp 2.10.28 - Win-10 /64.
Another chopping plugin inspired by denzjos. Download the .zip file (now version 0.3) from

and unzip and place the file in your user's plugin folder and restart Gimp. Then you will find at

Tools > Chopping > ...

three plugins; in addition to the two old ones (with a little reformulated GUIs) there is one new: "Chop path by lengths."

The following picture shows what the new plugin "Chop path by lengths" does. On the top is a path; to have a clear picture, I chose a simple one with only one stroke and only two anchors. Below it you see the result when the plugin is applied with default inputs. Of the stroke there are chopped 4 pieces, each 100 pixels long; those new anchors are indeed end points of new strokes so that the path consists now of 5 strokes.


The bottom curve shows what happened when I changed in the GUI the "Action" to "Chop each stroke to equal pieces from start to end": the stroke was cut to 4 equal strokes.

That's that. I feel that the GUI should be self-explanatory enough.

Some notes:

Original anchors are preserved. So in general the pictures are not so clear as in my example, with all the original and the new anchors.

Optionally all pieces can be made to separate paths.

Since the user generally does not know which of the two ends of a stroke is the start, I put there an option to use all strokes reversed. For closed strokes the starting point is even more obscure and I have no good solution to how it should be handled. For the user this means that one anchor is silently chosen to be the starting point and there is no way to control which anchor. (One could try, prior to applying the plugin, to cut any closed stroke at some point to make it open. But do we have a tool for that?)

The lengths are measured along the strokes, following each bend. Here the plugin relies on the procedure pdb.gimp_vectors_stroke_get_point_at_dist().

If the plugin does not work as it should, please tell me.
Using the chop_path_by_path plugin with the simple purpose of dividing a circle in half (I know there are other / several ways to do this) I get an error like: Exception: loop_case: ulos
PHP Code:
Traceback (most recent call last):
 File "C:\Gimp-2.10.28_Portable_32-64bit-Win\lib\gimp\2.0\python/"line 740in response
.res run_script(params)
 File "C:\Gimp-2.10.28_Portable_32-64bit-Win\lib\gimp\2.0\python/"line 361in run_script
    return apply
(function, params)
 File "C:\Gimp-2.10.28_Portable_32-64bit-Win\Preferences\plug-ins\PluginsUso\"line 1797in path_chop_by_path_main
 File "C:\Gimp-2.10.28_Portable_32-64bit-Win\Preferences\plug-ins\PluginsUso\"line 1759in path_chop_by_path
 File "C:\Gimp-2.10.28_Portable_32-64bit-Win\Preferences\plug-ins\PluginsUso\"line 1660in bcurve_intersections
 File "C:\Gimp-2.10.28_Portable_32-64bit-Win\Preferences\plug-ins\PluginsUso\"line 1476in open_arc_intersections
    for t1
,t2 in barc_intersections(arc1.cp4arc2.cp4): #[(t1,t2)]
 File "C:\Gimp-2.10.28_Portable_32-64bit-Win\Preferences\plug-ins\PluginsUso\"line 1587in barc_intersections
,c2 c.split()
 File "C:\Gimp-2.10.28_Portable_32-64bit-Win\Preferences\plug-ins\PluginsUso\"line 961in split
extreme_for_Bezier_sub_arc(self# splitting point
 File "C:\Gimp-2.10.28_Portable_32-64bit-Win\Preferences\plug-ins\PluginsUso\"line 1012in extreme_for_Bezier_sub_arc
    raise Exception
("loop_case: ulos"########  KOE

Possibly something related to anchors and cutpoints in paths.

Maybe something similar to what happened at:

If I have a segment larger than the diameter of the circle, the plugin works fine.

But in this case I created the circumference from its diameter, so it would be practical to use it for the execution of the cut, instead of creating another segment for it.

BTW, I didn't know this third member, my version is still Version 0.2 - It's good that this problem appeared, so I was warned of the existence of version 0.3.
Samj PortableGimp 2.10.28 - Win-10 /64.

Forum Jump: