FlorianPommerening / FingerJoints

Fusion 360 add-in for creating finger joints
128 stars 11 forks source link

Along the curved edge of a surface #1

Open GorillaDaddy opened 3 years ago

GorillaDaddy commented 3 years ago

Thanks so much for your efforts. I was very happy to see your addin work for straight edges.

Please take a look at this video. He's made fingers manually (although he doesn't show how) like I wished your addin did automatically. I'm laser cutting parts (toys for my daughter) from flat sheets of a constant thickness, and things like this "curved" chair design are tedious to do manually. https://youtu.be/p4MB0HhkA5M?t=95

Pretty please? :)

FlorianPommerening commented 3 years ago

Unfortunately, I don't have much time to work on this at the moment (I'm working on this in my free time, not professionally). I'll collect some thoughts and ideas here, in case I find some time later but at the moment it seems unlikely, sorry. So given that, here are my thoughts:

Do you mean the way the seat of the chair is connected to the base or how the different parts of the base are connected? I guess the first one because the base has straight edges. In this case, I think the easiest way to achieve that would be to design all the boards of the seat and design the base in a way that it overlaps them (without any joints yet). Then use a "combine" feature with all the boards as the "tool body" and the base as the target (and "keep tools" enabled). This should automatically cut all the joints without the need for a plugin.

I'm not exactly sure what the general case of what you are interested in would look like. The plugin can already create joints along curved edges (there is an example at the end of the readme) but it will always orient the cuts perpendicular to a selected axis. I think what you are asking about is to make the cuts perpendicular to the tangent of a curve instead. If that is the case, I'm not sure how exactly to define the cuts because one side of the cut might have a different angle than the other. I can imagine what it would look like on some specific examples but to make this work in a plugin, I'd need a more mathematical understanding of this.

The plugin works by first considering the intersection of the two selected bodies. This intersection is then cut into slices which are eventually used to cut the teeth out of the overlap. To get the slices, loosely speaking, we create rectangles and "pull" them through the intersection body. Whatever is left forms the fingers of one side and the part that was removed forms the fingers of the other side. The rectangles conceptually start on the axis selected for the direction (*). This leaves one degree of freedom for the rectangles but the choice here doesn't matter for a rectangle. I think in the case where we have an arbitrary curve as a reference instead of an axis, we'd need a different shape than rectangles that we pull through the intersection. Maybe a triangle or trapezoid. This would get messy if the curve has very tight bends in it and these shapes start to overlap. Another (technical) issue is that the part marked with (*) above is actually more complicated because the intersection body is transformed into the coordinate system where the selected axis is the x axis. This is not easily possible with a general curve as a reference, so all the math would have to be be redone in the original space.

To implement this, the relevant parts of the code are where the intersection is transformed to local coordinate system and the part that creates the slices: https://github.com/FlorianPommerening/FingerJoints/blob/master/geometry.py#L131 https://github.com/FlorianPommerening/FingerJoints/blob/master/geometry.py#L56

Maybe we could define a triangle that intersects the curve at the start and end of each slice and has the correct angle on those two legs. The definition of the third side of the triangle would be unclear but it would have to be outside the projection