Skip to content

Instantly share code, notes, and snippets.

@omerfarukz
Last active July 21, 2020 17:48
Show Gist options
  • Save omerfarukz/42a11f99a8e831b71af30900674326df to your computer and use it in GitHub Desktop.
Save omerfarukz/42a11f99a8e831b71af30900674326df to your computer and use it in GitHub Desktop.
$fn = 60;
node_radius = 3;
node_bar_height = 16;
nodes = [40, 50];
node_height = 3;
bend_padding = 4;
bend_height = 1.5;
bend_angle = -5;
leaf_width = 30;
leaf_heigth = 20;
leaf_border = 10;
leaf_outher_corner_radius = 5;
leaf_inner_corner_radius = 2;
leaf_height = 1.5;
module node(x) {
translate([node_radius,0,0])
{
translate ([-x ,node_bar_height/2])
circle(node_radius);
translate ([-x,-node_bar_height/2])
circle(node_radius);
translate ([-x -node_radius,-node_bar_height/2])
square([node_radius*1.5,node_bar_height]);
}
}
module bend()
{
bend_bar_height = node_bar_height - (bend_padding / 2) - (node_radius * 2);
hull() {
translate(-[nodes[len(nodes)-1], bend_bar_height/2])
square([1, bend_bar_height]);
translate([0 - leaf_width/2, -bend_bar_height/2])
square([1, bend_bar_height]);
}
}
module leaf_base(x, y, r) {
translate([-x/2, -y/2])
hull() {
translate([r, r])
circle(r);
translate([r, y - r])
circle(r);
translate([x - r, r])
circle(r);
translate([x - r, y - r])
circle(r);
}
}
module leaf() {
difference() {
leaf_base(leaf_width, leaf_heigth, leaf_outher_corner_radius);
leaf_base(leaf_width - leaf_border, leaf_heigth - leaf_border, leaf_inner_corner_radius);
}
}
module bend_and_nodes() {
rotate(bend_angle, 0, 0) {
linear_extrude(height = node_height) {
for(x = nodes) {
node(x, node_radius);
}
}
linear_extrude(height= bend_height) {
bend();
}
}
}
bend_and_nodes();
mirror()
bend_and_nodes();
linear_extrude(height = leaf_height)
leaf();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment