# tilt a wall

13 messages
Open this post in threaded view
|

## tilt a wall

 This post has NOT been accepted by the mailing list yet. hi there, my very first own design will be a envelope holder. i want the front wall to be tilted in an adjustable angle. however I dont seem to understand the rotate function can anyone help me? \$fn=30; //rear wall height=100; width=130; wall_thickness=6; bottom_width=50; //rear wall cube([width,wall_thickness,height]); //bottom wall translate([0,wall_thickness-1,0]) cube([width,bottom_width,wall_thickness]); //front wall frontwall_y=wall_thickness+bottom_width-1; translate([0,frontwall_y,0]) rotate([0,0,0]) cube([width,wall_thickness,height]);
Open this post in threaded view
|

## Re: tilt a wall

 Does this help? \$fn=30; //rear wall height=100; width=130; wall_thickness=6; bottom_width=50; angle=30; module holder() {     //rear wall     cube([width,wall_thickness,height]);     //bottom wall     translate([0,wall_thickness-1,0]) cube([width,bottom_width,wall_thickness]);     //front wall     frontwall_y=wall_thickness+bottom_width-1;     translate([0,frontwall_y,0]) rotate([0,0,0]) cube([width,wall_thickness,height]);     } rotate([angle,0,0]) translate([-width/2,0,0]) translate([0,-(bottom_width/2+wall_thickness),0]) holder();
Open this post in threaded view
|

## Re: tilt a wall

 My apologies for not contributing fully. I believe the original intent would be to have a flat bottom, perpendicular rear and tilted only on the front wall. If I had more time, I'd provide the modified code to accomplish that, but I also think Eric's entry should provide a foundation for the solution.
Open this post in threaded view
|

## Re: tilt a wall

 I should have read that post better. A second try. width=160; height=100; thickness=6; bottom=50; angle=-15; cube([width,thickness,height]); cube([width,bottom+thickness,thickness]); translate([0,bottom,-sin(angle)*thickness]) rotate([angle,0,0]) cube([width,thickness,height]); The -sine(angle)*thickness is for the front wall not going 'through' the bottom.
Open this post in threaded view
|

## Re: tilt a wall

 This post has NOT been accepted by the mailing list yet. Excellent, thanks. Its still a bit hard to go from 2d to 3d programming. So learning by doing. Thanks so much. if I wanted to close the sides, i need to make a polygon right? is there a function to do that - or do i need to make a large cube and substract from that?
Open this post in threaded view
|

## Re: tilt a wall

 This post has NOT been accepted by the mailing list yet. btw. here is the work in progress. now only need some help for the sides ;-) //object width=130; height=100; thickness=6; bottom=50; //front wall angle=-15; //magnets magdiameter=8; magheight=5.1; // please add 0.1mm or something in order to add some glue behinde the object magdistance=magdiameter*1.8; //distance from wall edge //rear difference() {         cube([width,thickness,height]); // the magnet holes are substracted from the cube (rear) // I made the cylinders 1mm higher than the variable because they have to break through the wall. so the translate moved the Y axis of the cylinder into the wall, but the cylinder is actually sticking out of the cube, but you cannot see the difference object translate([magdistance,magheight,magdistance]) rotate([90,0,0]) cylinder(magheight+1,magdiameter,magdiameter, \$fn=100); //left translate([width-magdistance,magheight,magdistance]) rotate([90,0,0]) cylinder(magheight+1,magdiameter,magdiameter, \$fn=100); //right translate([width/2,magheight,magdistance]) rotate([90,0,0]) cylinder(magheight+1,magdiameter,magdiameter, \$fn=100); //middle translate([magdistance,magheight,height-magdistance]) rotate([90,0,0]) cylinder(magheight+1,magdiameter,magdiameter, \$fn=100); //left translate([width-magdistance,magheight,height-magdistance]) rotate([90,0,0]) cylinder(magheight+1,magdiameter,magdiameter, \$fn=100); //right translate([width/2,magheight,height-magdistance]) rotate([90,0,0]) cylinder(magheight+1,magdiameter,magdiameter, \$fn=100); //middle } //bottom cube([width,bottom+thickness,thickness]); //angled front wall //The -sine(angle)*thickness is for the front wall not going 'through' the bottom. translate([0,bottom,-sin(angle)*thickness]) rotate([angle,0,0]) cube([width,thickness,height]);
Open this post in threaded view
|

## Re: tilt a wall

 In reply to this post by Sebastian Heyn I think I would choose for a cube and a triangle where the triangle is made of the difference between two cubes. Some trigonometry is needed. The code could use some functions I suppose but this is just a quick example where one side is closed.   width=160; height=100; thickness=6; bottom=50; angle=-15; cube([width,thickness,height]); cube([width,bottom+thickness,thickness]); translate([0,bottom,-sin(angle)*thickness]) rotate([angle,0,0]) cube([width,thickness,height]); cube([thickness,bottom+thickness,height]); translate([thickness,bottom+thickness,0]) rotate([0,-90,0]) difference() {     cube([height,abs(tan(angle))*height,thickness]);     rotate([0,0,atan(abs(tan(angle))*height/height)]) cube([sqrt(pow(abs(tan(angle))*height,2)+pow(height,2)),abs(tan(angle))*height,thickness]); }
Open this post in threaded view
|

## Re: tilt a wall

 Administrator In reply to this post by Sebastian Heyn Sebastian, your post is still flagged as "This post has NOT been accepted by the mailing list yet", so nobody gets it unless they look. You need to subscribe to the mailing list, and CLICK THE LINK in the registration email (check your spam folder). Admin - email* me if you need anything, or if I've done something stupid... * click on my MichaelAtOz label, there is a link to email me. Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Open this post in threaded view
|

## Re: tilt a wall

 In reply to this post by Sebastian Heyn Sebastian, You may think in 2D for most part of your job and use linear_extrude to jump into the 3D world. Here is my approach that starts from the sides: // the 2D profile of a side module side_profile(w, h, b){     tg = (w-b)/h; // trig math     a  = atan2(w-b,h);     cs = cos(a);     difference(){         square([w, h]);         translate([b,0])             rotate(-a)                 square([h*tg*cs,h/cs]);     } } // the 2D profile of the walls module wall_profile(w, h, b, t) {     difference(){         side_profile(w, h, b);         translate([t,t]) side_profile(w-2*t, h, b-2*t);     } } module holder(w,h,b,t,l)     rotate([90,0,0]) {         // channel walls         translate([0,0,t])         linear_extrude(height=l-2*t)             wall_profile(w, h, b, t);         // sides         color("blue")         linear_extrude(height=t)             side_profile(w, h, b);         color("red")         translate([0,0,l-t])             linear_extrude(height=t)                 side_profile(w, h, b); }     width = 40; height = 40; bottom = 20; thickness = 3; length = 60; holder(width,height,bottom,thickness,length);
Open this post in threaded view
|

## Re: tilt a wall

 In reply to this post by MichaelAtOz MichaelAtOz: Thanks for pointing this out. I now subscribed
Open this post in threaded view
|

## Re: tilt a wall

 In reply to this post by Ronaldo thanks for that - and it got me completely confused. LOL