I'm trying to create vector graphics for use with a pen plotter / cutting machine. One idea I had was to draw squiggly lines with a pen, but only where it overlaps text. My problem is how to automate this, because it's quite tedious to do manually. My approach is the following. I first have an open path and some text above it. I duplicate the text because one will be destroyed by the path operation.
ย
Then I select open path and one text and do "Path / Cut Path". I can then only manually use the remaining text to select all the cut lines that are outside of it. This is the annoying, manual labor that I'd like to avoid. The end result is this (I've hidden the yellow T):
Is there some automatic way to do this? Maybe a "select paths within path" command or extension, that determines for each section whether it's inside a path? For this example, manual mode is still workable but imagine this with more complicated patterns and texts, it gets too complicated quickly.
No, it has to be simple standalone paths, so it knows where to start and stop cutting / drawing. The plotter's software is really not very sophisticated in that way
Ok - understood. Hereยดs the catch: Go the clipping path route and make a Bitmap copy (Edit menu) - select the result and go Path->Trace Bitmap->Single Scan=Centerline tracing.ย
@David248 Put the letter underneath the swirly path - select both and go Path->Division - kill fill color - adjust Stroke color and width. Same result.
The division method is not really the same result, as each tile shares borders with its neighbors. And these borders would all be followed twice by the plotter.
The bitmap method works in principle, it just doesn't quite recover the correct paths. Might not matter for plotting so a good workaround to have. I'm currently trying my hand at writing a simple extension to remove the paths that remain after "cut path".
I'm running Inkscape 1.3 on MacOS. I installed the extension yesterday and it seems to work perfectly.ย I have no idea why it doesn't appear in your extensions menu. Have you installed other extensions successfully?
For a second I thought that extension was the real deal! Sadly, it only works with beziers flattened to line segments. While that's still cool, and for a plotter it doesn't matter that much I think (it probably converts to lines internally anyway before computing the control pattern) I never like to prematurely throw away data. I can't edit the result as well as I could with the original curves if I later need to make some adjustments.
My experiments with an extension are already not looking too bad, although I'm still having problems with computing bezier intersections correctly. Will need some more fiddling and learning about inkscape's data structures.
The proof of concept of my extension seems to work :)
It loops through the paths, of which we know that they are either completely inside or outside the cutting path. So we have to just check a single point on each for being inside / outside. This is done by doing a line intersection against each segment of the cutter path and counting the intersection points. Even is outside, odd is inside. I delete all outside paths and concatenate the rest. It seems to work with paths that only have curves, but not with my initial example, the letter "T". I'm probably still doing something wrong with the `CubicSuperPath` and conversions.
Edit: Actually a T shape also works, it's just that text sets a `transform` so the path coordinates I was reading were the untransformed ones so it didn't work.
Now I've got the extension in a pretty convenient state, it does the path conversion, cutting and other bookkeeping automatically. Might upload that somewhere at some point so it's useful for others. I did have to implement a custom bezier line intersection algorithm because the inkex-supplied one seemed to be buggy. It would sometimes get intersections in places way off the line, pretty weird.
I'm trying to create vector graphics for use with a pen plotter / cutting machine. One idea I had was to draw squiggly lines with a pen, but only where it overlaps text. My problem is how to automate this, because it's quite tedious to do manually. My approach is the following. I first have an open path and some text above it. I duplicate the text because one will be destroyed by the path operation.
ย
Then I select open path and one text and do "Path / Cut Path". I can then only manually use the remaining text to select all the cut lines that are outside of it. This is the annoying, manual labor that I'd like to avoid. The end result is this (I've hidden the yellow T):
Is there some automatic way to do this? Maybe a "select paths within path" command or extension, that determines for each section whether it's inside a path? For this example, manual mode is still workable but imagine this with more complicated patterns and texts, it gets too complicated quickly.
Thanks for your help!
Will Object->Clip->Set Clip work with the plotter?
No, clip paths sadly don't work as the plotter's software just ignores those. That's how I'd normally do this as well.
And converting the swirl into a pattern to fill the "T". Can the plotter work with that?
No, it has to be simple standalone paths, so it knows where to start and stop cutting / drawing. The plotter's software is really not very sophisticated in that way
Ok - understood. Hereยดs the catch: Go the clipping path route and make a Bitmap copy (Edit menu) - select the result and go Path->Trace Bitmap->Single Scan=Centerline tracing.ย
(method derived from a recent YT video from Sweater Cat Designs)
@David248 Put the letter underneath the swirly path - select both and go Path->Division - kill fill color - adjust Stroke color and width. Same result.
The division method is not really the same result, as each tile shares borders with its neighbors. And these borders would all be followed twice by the plotter.
Thatยดs why I didnยดt have this approach on the agenda. Howยดs with #6?
The bitmap method works in principle, it just doesn't quite recover the correct paths. Might not matter for plotting so a good workaround to have. I'm currently trying my hand at writing a simple extension to remove the paths that remain after "cut path".
I wonder why this isnยดt implemented as it absolutely makes sense.
Try this extension.
https://github.com/funnypolynomial/DestructiveClip
ย
@Paddy_CAD :ย I failed to install this extension with inkscpae 1.3 (released in july 2023).
.inx file seems to have been updated for compatibily in march 2023 in github
ย I copy-pasted both .inx and .py in extension folder, but, once inkscape restarted, can't find it in Extensions > Modify Path menu
ย
Edit : fixed
I'm running Inkscape 1.3 on MacOS. I installed the extension yesterday and it seems to work perfectly.ย I have no idea why it doesn't appear in your extensions menu. Have you installed other extensions successfully?
For a second I thought that extension was the real deal! Sadly, it only works with beziers flattened to line segments. While that's still cool, and for a plotter it doesn't matter that much I think (it probably converts to lines internally anyway before computing the control pattern) I never like to prematurely throw away data. I can't edit the result as well as I could with the original curves if I later need to make some adjustments.
My experiments with an extension are already not looking too bad, although I'm still having problems with computing bezier intersections correctly. Will need some more fiddling and learning about inkscape's data structures.
@Paddy_CAD : other installed extensions work well ๐ถ
There is also the Alt+LMB drag to quickly select.ย
ย
You can also use fracture / division then Remove Duplicate Lines Extension, a handy extension for plotter users.
The proof of concept of my extension seems to work :)
It loops through the paths, of which we know that they are either completely inside or outside the cutting path. So we have to just check a single point on each for being inside / outside. This is done by doing a line intersection against each segment of the cutter path and counting the intersection points. Even is outside, odd is inside. I delete all outside paths and concatenate the rest. It seems to work with paths that only have curves, but not with my initial example, the letter "T". I'm probably still doing something wrong with the `CubicSuperPath` and conversions.
Edit: Actually a T shape also works, it's just that text sets a `transform` so the path coordinates I was reading were the untransformed ones so it didn't work.
ย
Now I've got the extension in a pretty convenient state, it does the path conversion, cutting and other bookkeeping automatically. Might upload that somewhere at some point so it's useful for others. I did have to implement a custom bezier line intersection algorithm because the inkex-supplied one seemed to be buggy. It would sometimes get intersections in places way off the line, pretty weird.
ย
This looks very useful.
If you would like to share it, please add it to the Inkscape Gallery. There is a button in the upper-right corner of your user profile.
Some members post a screenshot with links to a GitLab page where the code is hosted. Example:ย https://inkscape.org/~Moini/%E2%98%85multiple-boolean-operations-with-inx-pathops
ย
ย
ย
Looks very promising ! It would be very kind of you to share it.
I've done that here, hope it helps https://inkscape.org/~jgk/%E2%98%85cut-and-remove-by-shape-extension
A stroke of genius. Thanks for sharing.