--- /dev/null
+infty = 200;
+eps = 0.01;
+
+card_x = 86 + 0.5;
+card_y = 54 + 0.5;
+card_z = 1.2;
+corner_r = 2.5;
+
+body_h = 10;
+wall = 1.2;
+
+clip_h = 4;
+clip_hole_d = 5;
+
+module credit_card() {
+ hull() {
+ translate([corner_r, corner_r, 0])
+ cylinder(r = corner_r, h = card_z, $fn = 32);
+ translate([card_x - corner_r, corner_r, 0])
+ cylinder(r = corner_r, h = card_z, $fn = 32);
+ translate([corner_r, card_y - corner_r, 0])
+ cylinder(r = corner_r, h = card_z, $fn = 32);
+ translate([card_x - corner_r, card_y - corner_r, 0])
+ cylinder(r = corner_r, h = card_z, $fn = 32);
+ }
+}
+
+difference() {
+ translate([0, 2*wall+card_z, 0])
+ rotate([90, 0, 0])
+ hull() {
+ cube([body_h, body_h, 2*wall+card_z]);
+ translate([sqrt(card_x^2+card_y^2) + 2*wall - body_h/2, body_h/2, 0])
+ cylinder(r = body_h/2, h = 2*wall+card_z, $fn = 12);
+
+ }
+ % translate([wall, wall, body_h/2-0.3*corner_r]) // !!! heuristka
+ rotate([0, atan((card_y-corner_r)/(card_x-corner_r)), 0])
+ translate([0, card_z, 0])
+ rotate([90, 0, 0])
+ credit_card();
+
+ translate([body_h, wall+card_z-eps, -eps])
+ cube([sqrt(card_x^2+card_y^2) + 2*wall - 2*body_h, wall+2*eps, body_h+2*eps]);
+}
+
+// clip with hole
+translate([-clip_hole_d/2, wall+card_z/2, 0])
+difference() {
+ cylinder(r = clip_hole_d/2 + wall, h = clip_h, $fn = 32);
+ translate([0, 0, -eps])
+ cylinder(r = clip_hole_d/2, h = clip_h + 2*eps);
+}