View Full Version : Tool to connect all the pieces with 2-point polygons or splines?

07-18-2012, 04:57 AM
Does anyone know of a tool that would find all separate (not connected polygons) pieces and connect them with 2-point polygons. I imagine its not a big scripting challenge, but exceeds all I know :)


07-18-2012, 05:03 AM
Don't know of one. And connected how exactly? Should there only be a single connection between each island? Should it connect from island border to border, rather than just any two points? Should it connect the closest points of two islands or just any two points? Should it create connections from each island to all the other islands or is it enough to chain link all islands (meaning you might have to cross all islands to get from A to Z)? Or do you perhaps want something that connects all border points to create a closed shell from all islands? I think a quick sketch/overpaint would help get the idea across along with a explanation why you need this specific structure.

07-18-2012, 05:11 AM
Like this. Plugin would find an island of connected polygons and connect it to the next island with 2-point polygon.

07-18-2012, 06:33 AM
You could run Triangulatepoints on your mesh. It would not be pretty but your islands would be connected. http://www.artssphere.com/plugins/triangulatepoints.php

07-18-2012, 07:04 AM
I don;t think that one would work as i still need to render what I get :)

Oedo 808
07-18-2012, 07:49 AM
I don't mean to state the obvious, but if the islands are mostly regular and uniformly spaced as in your image, could you not just connect a corner island to its two neighbours and array the 2point polys then merge (delete 1 poly points then 1 point polys to clean up). And do the irregular one(s) manually?

Are you looking to render the 2point polys or were you just looking to have the object made contiguous with 2point polys? That's fairly easy I think, but not every island would be connected to the next and it would be too irregular for rendering.

07-18-2012, 08:34 AM
It's not a huge scripting challenge, but it's not non-trivial either, especially as details still aren't known why you need it and how you'd like it to work - in your example screenshot it's the intuitive center points that look connected rather than some other points; identifying such center points is an advanced algorithm; if that is not a necessity it should be stated! But I would venture something usable would take about a day to develop with testing (excluding the center points identification). That's for something that automatically identifies the parts, the order they might have been selected, the closest points between two parts, and finally connects those points. So question is if you do this so frequently and with such a big collections of parts that it's worth the hours it would take to develop such a tool. Clearly the current example would only take you about a minute or two to do manually with some careful selecting and a make spline/make line command. It might also be the case that a much simpler tool could be developed that only do part of the work, but still saves you 90% of the hassle - this is why you should always try to explain the root cause or need rather than just state that you need specifically x.

Having said that, this is probably a good exercise for someone that is an not a noob nor a pro scripter. I don't think I'm that man though. Mainly because I fail to see the mass appeal.

Again, why do you need these polylines to connect the parts? I would assume you don't want the lines rendered. Is it to force dynamics treat all parts as one? Or why?

PS. I'm aware that the original question was if it already existed (already a sunk cost, might aswell milk it for all it got), not a request for someone to write it. Either way I'm just trying to add my 2 cents, because I have nothing better to do at the mo. :)

07-18-2012, 08:53 AM
Yes, it is to force dynamics to treat certain group of lego blocks (and pegs) as a single entity. While doing one piece isn't a biggie, having a lot of them is ;)

Oedo 808
07-18-2012, 09:47 AM
I don't know if not having each island directly connected to its neighbour will work for your needs, but you can try this and see it helps:

*Oh, and there will be a good few extraneous 2pt polys, I don't know if these will cause an issue at render time. Though it's easy enough to go between rows and isolate the good'uns... depending on just how many rows there.

Select the top polys
change selection to points and make a polygon
bevel ngon out and back to 0mm, deselect, merge points
delete the ngon (you can delete the long 2pt poly also)
all islands will be connected via 2pt polys, just not directly to each other

I've attached a very rough .gif to outline the idea... not that watching clarifies much.