gotcha

Author Topic: Simplifying THOUSANDS of nodes  (Read 2774 times)

July 24, 2018, 12:34:42 PM
Read 2774 times

KeenanArcLight

  • Sr. Newbie

  • Offline
  • **

  • 5
I am dealing with an issue that I am using a program called "Scanything" on my CNC table that will automatically trace and image i have outlined or drawn on a piece of paper. It exports the traced image as a ".dxf" file that i can import into Inkscape. The major issue i am running into is that the camera picks up everything. So the lines are not smooth. I am trying to simplying my nodes or "clean up" my drawing, but having a hard time dealing with the thousands of nodes that are in the image.

I am using a 32-bit Linux Ubuntu computer if that helps. Using i believe version 0.91 of Inkscape.

I will post screenshots and an explanation of what i am seeing to see if anyone has any ideas on what i can do to help edit my drawing.

- I import my .dxf and make sure to use the "manual scale factor" and input 25.4 to get my correct sizing.
- Then i select my drawing and see that there is a message at the bottom "group of 3 objects in layer". So i group the image and it goes to one group.
- Then i click the "nodes" tool and all my nodes pop up around my image.
- Then i drag a box and select all of them. 4448 of them.

- What should i do now? i have tried clicking "Path" then "simplify" but it doesn't work. it actually gave me more nodes one time. Is this because my processing power might not be high enough?

Anything help!

Keenan

Tracer Test Import.png
*Tracer Test Import.png
(148.35 kB . 1280x1024)
(viewed 1153 times)

Tracer Test Selected and Groups.png
*Tracer Test Selected and Groups.png
(133.43 kB . 1280x1024)
(viewed 1243 times)

Tracer Test Combine then Nodes.png
*Tracer Test Combine then Nodes.png
(134.5 kB . 1280x1024)
(viewed 1163 times)

Tracer Test Selected Nodes.png
*Tracer Test Selected Nodes.png
(132.87 kB . 1280x1024)
(viewed 1118 times)
  • 0.91
  • Linux Ubuntu

July 24, 2018, 01:23:55 PM
Reply #1

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Hi.

Personally I  think you could get much better results redrawing/reconstructing/tracing those manually with either inkscape or a cad application, which may you prefer.

There is a simplify path path effect as well as the mentioned option in the path menu, however they cannot differenciate much on which part to keep, where should be a pointy node and where one with a tangent curve.
Any automatic simplification process will give you some errors.

Here is a more brute force one: export the imported path into a raster image and then trace the bitmap with the trace bitmap option.

July 25, 2018, 07:44:55 AM
Reply #2

KeenanArcLight

  • Sr. Newbie

  • Offline
  • **

  • 5
What is a "raster image" and do you need a newer version to export that?
  • 0.91
  • Linux Ubuntu

July 25, 2018, 11:58:17 AM
Reply #3

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Raster image is pretty much the opposite you use with cnc.
It is a bitmap image where rows and columns of pixels in a diagonal raster make up the graphic -just as you see it on screen.
As is, it can be used effectively with a set resolution -you cannot scale it up or down without pixelation/blurriness, degrading the visual appearance.

Doesn't need a newer version, exporting to a raster image/creating a raster copy is an old feature.
Inkscape can export to png, or you can create a raster copy of a selected object by pressing Alt+B.

Keep in mind that inkscape's built-in trace bitmap option is not a centerline tracer so you'd need a filled path instead of one with stroke only and no fill to start with.

July 25, 2018, 05:05:21 PM
Reply #4

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
I think the problem might be that the path consists of thousands of disconnected subpaths, as they often do when imported as dxf.

What do you get if you do 'Path -> Break apart' (use undo after this operation). Do you get lots and lots of paths? If so, after undoing, switch to node tool, select all nodes in your path, then click on the icon with the tooltip 'join selected nodes'. This will join all the ends of subpaths together.

Note that, if your result is meant to consist of a path that is not closed, you need to avoid selecting the 'real' end nodes, else they will be joined, too.

Afterwards, try the simplifying again.

July 25, 2018, 06:46:53 PM
Reply #5

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
If it is as Moini suggests, that you have many, many, many subpaths which are not connected, that explains why it doesn't work.  But if the nodes are connected, and you have a single path, it might just be taking longer than you expect.

Moini's instructions will connect everything.  But if you get stuck, I just wanted to mention that you're welcome to share your SVG file with us.  That would eliminate the guessing  :)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

July 26, 2018, 08:08:39 AM
Reply #6

phiscribe

  • Jr. Member

  • Offline
  • ***

  • 43
This extension, chain paths, has helped me in cases where I get a bunch of line segments I want to be continuous.  https://github.com/fablabnbg/inkscape-chain-paths
  • Latest Stable
  • Win 8.1

July 27, 2018, 06:04:58 AM
Reply #7

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
@phiscribe Thanks for sharing that link - we've had lots of questions about that, and the extension existed all the time... It's sad, I've never seen it suggested before, although it works very well.

Now we know :)

July 27, 2018, 03:58:02 PM
Reply #8

phiscribe

  • Jr. Member

  • Offline
  • ***

  • 43
@ Moni Yeah, I still find a gem out in the rough every once and awhile.  One suv put out at https://gitlab.com/su-v/inx-pathops lets you do some boolean operations on more than two items at a time.  It's another great one and little known.
  • Latest Stable
  • Win 8.1

July 27, 2018, 05:20:38 PM
Reply #9

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
That one is one I know :) It's a rewrite of an extension of my own, very much improved. Her export_objects extension is cool, too :) (https://gitlab.com/su-v/inx-exportobjects/) . This discussion reminded me of something I've wanted to do for long. So I've spent this afternoon collecting extensions and other stuff related to Inkscape from various git (version control) repositories, pulling them in as submodules. There's still a lot of work to do on it, though, but I find it quite useful.

https://gitlab.com/Moini/ink_extensions
https://gitlab.com/Moini/ink_addons
https://gitlab.com/Moini/svg_tools

July 27, 2018, 11:37:12 PM
Reply #10

phiscribe

  • Jr. Member

  • Offline
  • ***

  • 43
I just looked at all of those.  I knew the svgnest one as a script and not a website. I had seen many of the others, but many I had not.  Some are a bit inscrutable and others not applicable to things I do.  I was going to ask if you had heard of the centerline trace one, but see it is in the list.
  • Latest Stable
  • Win 8.1

July 28, 2018, 06:40:53 AM
Reply #11

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
phiscribe, if you ever have some time to spare, I'd be glad if you (or anyone coming along) could help with filling in the missing data in the README, or adding new extensions (or throwing out some that don't work - I haven't tested all of them).

We could also add extensions that do not have a git repository.

July 28, 2018, 06:41:51 AM
Reply #12

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
I'm especially interested in help with the LaTeX and plotting extensions, as those provide functionality that I do not know enough about to be a qualified tester.

July 30, 2018, 02:22:05 AM
Reply #13

phiscribe

  • Jr. Member

  • Offline
  • ***

  • 43
Have no LaTex knowledge.  I use vector mostly to drive a vinyl cutter.  The plot function I have never gotten to work on my cutter.  I am not sure if it is because the cutter isn't HPGL compliant.  It's a chinese cutter and hard to get information on.   I have to use commercial cutting software.
  • Latest Stable
  • Win 8.1

July 30, 2018, 02:54:00 PM
Reply #14

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
I think it would be interesting to see what you make :) What a pity, with the cutter... but as long as it's working, it's all good.

July 31, 2018, 12:25:00 PM
Reply #15

KeenanArcLight

  • Sr. Newbie

  • Offline
  • **

  • 5
Honestly just wanna say thank you to all the responses. This has been an issue i have been working with for a few months and i finally threw in the towel and wanted to ask for help.

You guys have lead me to how i am able to make it work and also more adjustment i will make to my program to help make this better.

The "join selected paths" worked great after i did Object->Group (i had 2 or 3 groups for who know what reason). Then Path->Combine (when i would click i would only get single nodes and now i could get all of them). Then Path->Simplify. And i went from 4500 nodes, to 2200 nodes, then 42. very happy now for editing.

I will be working on the program to give me a whole lot less of nodes becuase it is very taxing on the processing power and takes a good deal of time

Thanks everyone
  • 0.91
  • Linux Ubuntu