Is there any way to select objects based on their size? I know that there are already functions for selecting objects with the same colour and stroke, but I have a document with lots of small objects that I'd like to remove.
Document attached.
Select objects with similar size
- hellocatfood
- Posts: 193
- Joined: Fri Aug 29, 2008 8:49 pm
- Contact:
Select objects with similar size
- Attachments
-
- linedrawing.zip
- (35.04 KiB) Downloaded 131 times
Re: Select objects with similar size
I don't know about removal, but you can join the nodes that overlap, to get real curves, instead of many disconnected lines.
https://github.com/fablabnbg/inkscape-chain-paths
I thought there also was an extension that deletes short paths, with a settable path length, but I cannot find it now. Can anyone else, or does anyone remember where it lives?
https://github.com/fablabnbg/inkscape-chain-paths
I thought there also was an extension that deletes short paths, with a settable path length, but I cannot find it now. Can anyone else, or does anyone remember where it lives?
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: Select objects with similar size
I remember a couple of users asking about an extension to remove objects based on size (in the last couple of years), but I don't remember seeing one.
Hhmm, I don't seem to have one in my master list, although I could have missed adding it to the list.
Hhmm, I don't seem to have one in my master list, although I could have missed adding it to the list.
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
- hellocatfood
- Posts: 193
- Joined: Fri Aug 29, 2008 8:49 pm
- Contact:
Re: Select objects with similar size
Moini wrote:I don't know about removal, but you can join the nodes that overlap, to get real curves, instead of many disconnected lines.
Thanks! That extension looks like it'll be very useful, especially as I plan to use a plotter to draw these images.
brynn wrote:I remember a couple of users asking about an extension to remove objects based on size (in the last couple of years), but I don't remember seeing one.
Hhmm, I don't seem to have one in my master list, although I could have missed adding it to the list.
Maybe something to add to the bug tracker? Seems like it could be useful, especially for people who trace bitmaps a lot.
Re: Select objects with similar size
I've never heard of putting specifically extension requests in the bug tracker. But it could be added just as a general feature request. Who knows, maybe some developer would want to make it a native feature?
Here's the new bug tracker: https://gitlab.com/inkscape/inbox/issues
Here's the new bug tracker: https://gitlab.com/inkscape/inbox/issues
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Re: Select objects with similar size
This is a completely useless idea. You have been warned.
You can select and delete all objects below a certain size by selecting everything and aligning their right or left edges with the left or right edge of the page or any target (or top and bottom or even center etc). Then by making your selection marquee narrow enough you can only enclose those objects that are small enough to fit inside it, and then delete them.
Of course this leaves your document completely wrecked so that's why it's useless.
A similar method would clone everything, drag the clones away from the drawing and align them to an edge as above. Marquee select all the small clones as above and drag them away to separate them from big clones which you can then delete. Now click on a small clone, Shift D to find the original, then delete it, delete the clone, and do the next one. This method is only slightly less useless than the first but makes up for it by being very slow. Sadly Inkscape will not perform Shift D 'Look up original' if more than one clone is selected.
You can select and delete all objects below a certain size by selecting everything and aligning their right or left edges with the left or right edge of the page or any target (or top and bottom or even center etc). Then by making your selection marquee narrow enough you can only enclose those objects that are small enough to fit inside it, and then delete them.
Of course this leaves your document completely wrecked so that's why it's useless.
A similar method would clone everything, drag the clones away from the drawing and align them to an edge as above. Marquee select all the small clones as above and drag them away to separate them from big clones which you can then delete. Now click on a small clone, Shift D to find the original, then delete it, delete the clone, and do the next one. This method is only slightly less useless than the first but makes up for it by being very slow. Sadly Inkscape will not perform Shift D 'Look up original' if more than one clone is selected.
Your mind is what you think it is.
Re: Select objects with similar size
Hi.
For this specific project you may find a solution besides the previous requests where each path would take some analysation on their sizes.
The small paths seems to be paths with 0 length. In the xml they look like "m 609,210 0,0" -that 0,0 is probably good enough to spot them all.
At least now with notepad++ you can mark them all.
Search for >>v 0"<< in your file and you'll find 1380 matches.
Other idea is importing it to blender, joining objects, converting to a mesh, select all nodes, then remove doubles.
Sadly this will also result in one compound path in the process and may remove other details -if you manage to transfer the result from blender to inkscape. (For example by exporting to an obj file and using the render 3D polyhedron extension in inkscape.)
Edit:
That notepad++ method seems to work.
Open svg in notepad++
Find (Ctrl+F), choose the mark tab and type in >>v 0"<< in the spinbox; Find All
then
Search/Bookmark/Cut bookmarked Lines and
save as svg.
Open that svg in inkscape,
select all (Ctrl+A) and paste it in place (Ctrl+Alt+V) in another document so you won't have the garbage in your file from those brute-forcedly deleted path code segments.
Upon testing your 1646 objects became reduced to 265.
Although you'd still have alot of unwanted clipping and cloning going on and a weird page size.
Attaching a cleaned up version.
For this specific project you may find a solution besides the previous requests where each path would take some analysation on their sizes.
The small paths seems to be paths with 0 length. In the xml they look like "m 609,210 0,0" -that 0,0 is probably good enough to spot them all.
At least now with notepad++ you can mark them all.
Search for >>v 0"<< in your file and you'll find 1380 matches.
Other idea is importing it to blender, joining objects, converting to a mesh, select all nodes, then remove doubles.
Sadly this will also result in one compound path in the process and may remove other details -if you manage to transfer the result from blender to inkscape. (For example by exporting to an obj file and using the render 3D polyhedron extension in inkscape.)
Edit:
That notepad++ method seems to work.
Open svg in notepad++
Find (Ctrl+F), choose the mark tab and type in >>v 0"<< in the spinbox; Find All
then
Search/Bookmark/Cut bookmarked Lines and
save as svg.
Open that svg in inkscape,
select all (Ctrl+A) and paste it in place (Ctrl+Alt+V) in another document so you won't have the garbage in your file from those brute-forcedly deleted path code segments.
Upon testing your 1646 objects became reduced to 265.
Although you'd still have alot of unwanted clipping and cloning going on and a weird page size.
Attaching a cleaned up version.
- hellocatfood
- Posts: 193
- Joined: Fri Aug 29, 2008 8:49 pm
- Contact:
Re: Select objects with similar size
brynn wrote:I've never heard of putting specifically extension requests in the bug tracker. But it could be added just as a general feature request. Who knows, maybe some developer would want to make it a native feature?
Here's the new bug tracker: https://gitlab.com/inkscape/inbox/issues
Thanks, I'll definitely request it. I'll probably reference this topic as I think it makes a good case for why it would be a good idea.
Lazur wrote:Hi.
For this specific project you may find a solution besides the previous requests where each path would take some analysation on their sizes.
The small paths seems to be paths with 0 length. In the xml they look like "m 609,210 0,0" -that 0,0 is probably good enough to spot them all.
At least now with notepad++ you can mark them all.
Search for >>v 0"<< in your file and you'll find 1380 matches.
That's what I ended up doing but you're right that a more general feature would be more useful in the future and for more people.
Re: Select objects with similar size
I'm sorry I did not see that you had attached a file in your original post!
All you had to do really is use the Find and replace dialog (Ctrl F) and type in ' v 0' and search in properties (the default is usually text). 1380 objects are found and selected, just hit delete. 266 objects left. You don't have to do this outside Inkscape. Afterwards do 'clean up document' to get rid of 1440!! unused definitions...
It looks like the svg was created by converting from some kind of data? If you are trying to make it more presentable I have combined the multiple path on the right into one path and used a gradient to paint it, if you think that looks better... That also cleaned up another 150 defs, making the file smaller, which might be a goal: so far a 1MB file has become a 129KB file, I estimate you can get it down to 90KB.
All you had to do really is use the Find and replace dialog (Ctrl F) and type in ' v 0' and search in properties (the default is usually text). 1380 objects are found and selected, just hit delete. 266 objects left. You don't have to do this outside Inkscape. Afterwards do 'clean up document' to get rid of 1440!! unused definitions...
It looks like the svg was created by converting from some kind of data? If you are trying to make it more presentable I have combined the multiple path on the right into one path and used a gradient to paint it, if you think that looks better... That also cleaned up another 150 defs, making the file smaller, which might be a goal: so far a 1MB file has become a 129KB file, I estimate you can get it down to 90KB.
- Attachments
-
- linedrawing2.svg
- (129.21 KiB) Downloaded 120 times
Your mind is what you think it is.
- hellocatfood
- Posts: 193
- Joined: Fri Aug 29, 2008 8:49 pm
- Contact:
Re: Select objects with similar size
I added a feature request here https://gitlab.com/inkscape/inbox/issues/449
Re: Select objects with similar size
druban wrote:All you had to do really is use the Find and replace dialog (Ctrl F) and type in ' v 0' and search in properties (the default is usually text).
Nice found!
druban wrote:That also cleaned up another 150 defs, making the file smaller, which might be a goal: so far a 1MB file has become a 129KB file, I estimate you can get it down to 90KB.
And a little more.
I suspect it can still be compressed way more. Like, by not using the most possible digits to store coordinates and definitely by combining the paths, merging double nodes and one gradient only etc. 10-20 KB I'd estimate.
Re: Select objects with similar size
How about that legacy file warning, haven't seen that for a while.
Mostly I was suggesting by my example the combining of the paths (which are in little pieces in order to perhaps simulate a gradient with many flat colors) and then using an actual gradient.
Saving as non inkscape svg and reducing precision is more than I was suggesting but of course would bring size down. In my experience no one really cares these days about several thousand bytes here and there...
Mostly I was suggesting by my example the combining of the paths (which are in little pieces in order to perhaps simulate a gradient with many flat colors) and then using an actual gradient.
Saving as non inkscape svg and reducing precision is more than I was suggesting but of course would bring size down. In my experience no one really cares these days about several thousand bytes here and there...
Your mind is what you think it is.
- hellocatfood
- Posts: 193
- Joined: Fri Aug 29, 2008 8:49 pm
- Contact:
Re: Select objects with similar size
The SVG was created in Processing with a modified version of the following sketch https://www.openprocessing.org/sketch/694218
It's PDF and SVG export libraries probably do need some work.
If you look at the sketch then you'll see that in order to simulate a gradient along a path, at major turns in the path it just draws a straight line and changes colour. Replacing this with one gradient wouldn't work as the path turns back on itself many times.
It's PDF and SVG export libraries probably do need some work.
Mostly I was suggesting by my example the combining of the paths (which are in little pieces in order to perhaps simulate a gradient with many flat colors) and then using an actual gradient.
If you look at the sketch then you'll see that in order to simulate a gradient along a path, at major turns in the path it just draws a straight line and changes colour. Replacing this with one gradient wouldn't work as the path turns back on itself many times.
- hellocatfood
- Posts: 193
- Joined: Fri Aug 29, 2008 8:49 pm
- Contact:
Re: Select objects with similar size
hellocatfood wrote:I added a feature request here https://gitlab.com/inkscape/inbox/issues/449
I updated the feature request with an idea for fuzzy selection for selecting objects with same size which could also extend to the Select Same Fill Colour option. Take a look and add your thoughts!