I am attempting to split a closed path to sub-paths, the image is of a tree and I want to be able to easily manipulate branches by dividing them from the path between two nodes and then recombining later.
I have tried "Break apart" and "Cut Path" but neither work predictably (annoyingly, it worked for one branch but can't get to to work for others!).
Ideally, I want to cut the path at the base of a branch by selecting the nodes on either side at the base of the branch so that I can rotate and translate that branch independently.
Asked
Active
Viewed 5.4k times
47

Abdul Rahman
- 2,097
- 4
- 28
- 36

FGiorlando
- 1,121
- 2
- 12
- 22
-
Make sure you only selected two nodes : sometimes nodes are so close that that UI displays them as a single one when in fact there are more. I believe that's why your output seems unpredictable. Zoom in as much as you can to distinguish very close nodes. Simplifying your path may help (Ctrl+L) – Dec 05 '12 at 09:54
-
programmatically: http://stackoverflow.com/questions/33836224/splitting-svg-paths-programmatically – Ciro Santilli OurBigBook.com Jan 21 '17 at 11:45
1 Answers
72
Try this:
- Select the two nodes at each side of the base of the branch (as shown in your image).
- Use the "Break path at selected nodes"-button. It's located in the upper toolbar visible when you press F2.
- Now you have two connected paths which you can separate using Path->"Break Apart".

jotrocken
- 2,263
- 3
- 27
- 38
-
1
-
1Iterate over the nodes of a path in a [pairwise fashion](https://docs.python.org/2/library/itertools.html). Check for each pair, if your split criteria apply. If not, just copy the nodes to the output path. If the path should be split, add two new nodes at the desired split position, for example at `[(x-x')/2, (y-y')/2]`. Add one of these nodes to the current output path, then end it. Start a new path and add the other new node as first node to it. Then continue with the nodes of the original path. You can use any xml library for that, like `lxml`. – jotrocken May 26 '20 at 07:19