Third Skew on a Cube

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Third Skew on a Cube

ats3788
Hello I have this Cube and it has two skew side but I have no Idea to get a
third shew and the forth should be in a perfect 90 degree angle.
My code so far.

$fn=200;
Radius = 10;
    dRadius = 2 * Radius;

Length = 45 - dRadius;
WidthD = 75 - dRadius;

Width  =  WidthD - dRadius * 2;
Height = 75;

cornerRadius = 10;

inRedBox(0,0,0);
//inRedBox(0,50,0);


module inRedBox(x,y,z)
{
    union() {
        translate([x, y, z]){
    difference() {
squerefunel(Length, WidthD , Height);
translate([3,-3,3]) squerefunel(Length - 6, WidthD - 6 , Height +100);      
    } }
} }



module squerefunel(x, y, z ) {

Skew1 = 5;
Skew2 = 10;  
   
//translate([x + 140 , - y - Radius , 0]) cube ([ dRadius ,  y + dRadius,
z]);
   
    minkowski(){
      rotate([90,0,0]) linear_extrude(height = x )
    polygon(points=[[0,0],[-Skew1, z],[y+Skew2, z],[y  , 0]]);
      translate([ Width-dRadius,-Radius,0]) {
         cylinder(r=Radius, h=0.01);    
    }      }   }




--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Third Skew on a Cube

ats3788
I got it by myself. I thought I hate this polyhedron lets give it a chance
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#polyhedron
this make it real easy to understand
so that is my code

$fn=200;

Radius = 10;
dRadius = 2 * Radius;

Length = 45 - dRadius;
WidthD = 75 - dRadius;

Width  =  WidthD - dRadius * 2;
Height = 75;

cornerRadius = 10;

inRedBox(0,0,0);
// inRedBox(0,50,0);


 
CubeFaces = [
  [0,1,2,3],  // bottom
  [4,5,1,0],  // front
  [7,6,5,4],  // top
  [5,6,2,1],  // right
  [6,7,3,2],  // back
  [7,4,0,3]]; // left
 



module inRedBox(x,y,z)
{
    union() {
        translate([x, y, z]){
    difference() {
squerefunel(Length, WidthD , Height);
translate([3,3,3]) squerefunel(Length - 6, WidthD - 6 , Height +100);      
    } }
} }



module squerefunel(x, y, z ) {
CubePoints = [
  [ 0 ,  0,  0 ],  //0
  [ x ,  0,  0 ],  //1
  [ x,   y,  0 ],  //2
  [ 0,   y,  0 ],  //3
  [-2.5,   0,  z ],  //4
  [ x+2.5,   0,  z ],  //5
  [ x+2.5,   y+5,  z ],  //6
  [-2.5,   y+5,  z ]]; //7
 
    minkowski(){
      polyhedron(CubePoints, CubeFaces);
        cylinder(r=Radius, h=0.01);  
   }
   }
I think the polyhedron will be pretty helpful in the future



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Third Skew on a Cube

Ronaldo
You could avoid polyhedron and minkowski in your model. Just do a shallow
linear_extrude() of an offseting of a rectangle for each top and bottom
surfaces and hull() them.



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org