I am working up an extension for Inkscape in Python and in short want to break a line in 2 pieces. Here are the parts I am struggling with though:
The line segment might be part of a larger object (i.e. a square). I only want to break the line segment that is selected (i.e. the nodes on both ends of the segment are highlighted).
I know how to iterate through selected objects, and through the paths belonging to each object... but I am not clear on how I can detect if a node on the end of a line segment is selected or not.
To add some additional details here... The intention is to automatically create a "bridge" for laser-cutting parts. If I have a square for example, and it is just 4 straight line segments, the piece will fall out when it is laser cut. If you create small (1/64") breaks in the middle of the lines, then the square stays in place and can be separated from the main sheet of material by breaking these small bridges. I am working towards selecting a line segment, (nodes on both ends of the segment is selected), and then the extension code detects that particular segment, breaks the line in the middle and separates the two new handles by a configurable amount (1/64" by default). I would not want it to do all line segments of an object... just the one that has selected nodes.
Any suggestions?
Also... If anyone is aware of something like this that already exists, let me know!
Yes, that is indeed what I am after. Only need it to work on straight line segments however. Would you be willing to share your extension code and we could share efforts?
I am working up an extension for Inkscape in Python and in short want to break a line in 2 pieces. Here are the parts I am struggling with though:
The line segment might be part of a larger object (i.e. a square). I only want to break the line segment that is selected (i.e. the nodes on both ends of the segment are highlighted).
I know how to iterate through selected objects, and through the paths belonging to each object... but I am not clear on how I can detect if a node on the end of a line segment is selected or not.
Any suggestions?
Thanks!
- Robert
To add some additional details here... The intention is to automatically create a "bridge" for laser-cutting parts. If I have a square for example, and it is just 4 straight line segments, the piece will fall out when it is laser cut. If you create small (1/64") breaks in the middle of the lines, then the square stays in place and can be separated from the main sheet of material by breaking these small bridges. I am working towards selecting a line segment, (nodes on both ends of the segment is selected), and then the extension code detects that particular segment, breaks the line in the middle and separates the two new handles by a configurable amount (1/64" by default). I would not want it to do all line segments of an object... just the one that has selected nodes.
Any suggestions?
Also... If anyone is aware of something like this that already exists, let me know!
- Robert
Would probably be a good idea to look at the various laser cutting extensions and tabgen extensions.
As well as https://inkscape.org/gallery/=extension/
There is a large updated collection of practical cnc/crafting extensions at https://github.com/eridur-de/mightyscape-1.2
I tried myself to make a gap extension using `cspbezsplitatlength`
https://inkscape.gitlab.io/extensions/documentation/source/inkex.bezier.html
It does work if you make two splits, each 1/2 the gap eitherside of the bezier midpoint after converting to a cubicsuperpath.
What I can't get to work is working out the correct direction for reversed paths and closed paths / combined paths.
Also how to reassemble the path so it is properly joined not just combined.
I assume you want what is shown in the attached video ? ( the demo fails when tested with some paths )
Yes, that is indeed what I am after. Only need it to work on straight line segments however. Would you be willing to share your extension code and we could share efforts?
https://gitlab.com/inklinea/path-gap/
Thanks so much... I will give it a try!