Mobile app version of vmapp.org
Login or Join
Barnes313

: In Inkscape, how can I automatically generate lines (connections) between every single object? I created about one hundred randomly scattered circles. Now I want every single one of them connected

@Barnes313

Posted in: #Inkscape

I created about one hundred randomly scattered circles. Now I want every single one of them connected by a line, depending on how far the circles are away from each other. In other words, if a single circle is surrounded by 10 other ones a centimeter away, I want them to be connected with lines.

Basically, I am creating a figure that looks like a large network and then cluster it.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Barnes313

2 Comments

Sorted by latest first Latest Oldest Best

 

@Cugini998

Are there just your circles or do you have other objects in your image as well?
In the first case, I would generate the random distribution of points in my favorite programming language, do the calculation there, and output the xml-code for simple circles

<circle cx="50" cy="50" r="40" stroke="none" fill="red" />


and connections with that, embed the whole thing in a SVG-file and do the finish/control (border, background color, image size, export to png, ...) in Inkscape. The connections can be done with a line:

<line x1="50" y1="50" x2="250" y2="200" style="stroke:#006600;"/>

10% popularity Vote Up Vote Down


 

@Gretchen549

No, Inkscape can't do this on its own.

Drawing the lines manually can be made a little easier with a few tricks.


Enable snap other points and snap centers of objects.
With these enabled, you can draw directly between the centers of two circles.
Use the Measure tool M.
If snapping is enabled, this will quickly tell you if two circles are within the desired range.
Draw your lines on a layer below the circles.
If you draw the lines on the same layer as the circles, they will on top by default and you'll need to manually send them backwards. If you put the lines on a separate layer, you can just move that layer below whatever layer contains the circles.


It is possible for Inkscape to do this with an extension, but you're asking to do something very specific, so an extension does not exist. A script would need to iterate through each circle and calculate it's center, compare it to the centers of other circles and create new paths. If you know Python, writing an extension might be an option for you. For more about scripts in Inkscape, see How to get started on writing extensions.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme