### OpenSCAD linear extrude that interpolates between two shapes

Full source code is available for this thing on thingiverse.

OpenSCAD has proven to be an easy to use and flexible tool, but at times I'm left scratching my head to figure out ways around its limitations. In this case I had two squares with rounded corners, their sizes and the corner radius for both squares are configurable. Now I wanted a square tube to join these two pieces together.

This simply creates a rectangle with rounded corners and subtracts a slightly smaller rectangle from the middle, then extrudes the whole assembly some height. This piece goes around a rectangle with square corners, so the inside has square corners. Then I created a second tube designed to fit into a rectangle with rounded corners, so the outside of this tube must have rounded corners. After spacing them out I get something that looks like this:

This is where I realized I need some fancy function to extrude the bottom shape into something which meets up with the upper shape. The solution I ended up with works the same way as the 3D printer I'll print this object with: slice it up into multiple extrusions. For each extrusion I interpolate the inner radius, outer radius, width and length depending on how far into the overall extrusion we are.

With this I can now create a shape which connects my two adapters. The final product printed out nicely:

OpenSCAD has proven to be an easy to use and flexible tool, but at times I'm left scratching my head to figure out ways around its limitations. In this case I had two squares with rounded corners, their sizes and the corner radius for both squares are configurable. Now I wanted a square tube to join these two pieces together.

My hope was that I could get it close enough with some fancy parameters piped into the OpenSCAD linear_extrude function. It seemed possible since there are some pretty fancy parameters regarding rotations and twists. After checking out the documentation it didn't look like there was anything that would be close.

For this project I found a module by Felipe C. da S. Sanches to create squares with rounded corners. I'm sure there are many like it, but this was the first one I found and it worked as advertised.

So made a little module using this which wraps around a rectangle for one side, and another which fits into a rectangle for the other side:

This simply creates a rectangle with rounded corners and subtracts a slightly smaller rectangle from the middle, then extrudes the whole assembly some height. This piece goes around a rectangle with square corners, so the inside has square corners. Then I created a second tube designed to fit into a rectangle with rounded corners, so the outside of this tube must have rounded corners. After spacing them out I get something that looks like this:

This is where I realized I need some fancy function to extrude the bottom shape into something which meets up with the upper shape. The solution I ended up with works the same way as the 3D printer I'll print this object with: slice it up into multiple extrusions. For each extrusion I interpolate the inner radius, outer radius, width and length depending on how far into the overall extrusion we are.

With this I can now create a shape which connects my two adapters. The final product printed out nicely:

Finished product! |

Fits perfectly. |

I would probably have done the same job by using the hull function.

ReplyDeleteI would probably have done the same job by using the hull function.

ReplyDeleteThe rounded square you need is just:

ReplyDeletemodule rounded_square(x,y,r) {

translate([r,r]) minkowski() {

square([x-2*r,y-2*r]);

circle(r=r);

}

}

... and this one is even simpler:

ReplyDeletemodule rounded_square(x,y,r) {

translate([r,r]) offset(r=r) square([x-2*r,y-2*r]);

}

The turn to be banker now returns to B, who puts up a stake of €1500 and the sport 1xbet continues. Chemin de Fer is usually performed with six 52-card decks, sometimes with eight. The casino provides a croupier who directs the play and takes a commission for the casino when the banker wins. The quantity of commission is determined by} the casino but is usually 5% of the amount won by the banker, sometimes less. The croupier uses an extended paddle made from wooden, generally known as|often identified as} a palette, to maneuver the cards and casino chips on the far ends of the desk.

ReplyDelete