discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Creating a better Trapezoid

F
fouroh-llc
Thu, Feb 25, 2021 8:09 PM

I have a more-less functioning polyhedron but it does not render properly, so
i would like to create trapezoid a few different ways. I use them to build
dovetails, and to be able to mount them on walls and ceilings I want to
really customize them. For ceilings i print them in them upright instead of
flat and I use 30+ angles, up to 60.

This is the best I could come up with so far, but the script really falls
apart on extereme values. Maybe there is a much simpler way to do this
(besides polyhedron, which I have and works great for printing but not for
animation and such).

// CC-BY-SA 4.0 - Factory 4.0 Open Initiative, LLC 2019
// https://welcome.factoryfouroh.net/dokuwiki

/*
1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890

*/
planeZ=1.0000+0.0060; // Galvanized 20 gauge
meshZ=0.0008;

/*
22FEB20201 - Edit your dovetail parameters here
The values are going to be adjusted after real-life experience and feedback.
1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890

*/
goodZ=0.4;
badZ=0.6;
createTrapezoid(baseA=80, baseX=2.4, baseY=5.4, baseZ=goodZ);

module createTrapezoid(baseA, baseX, baseY, baseZ) {

/* Set the narrower side, called the base. Must be wide enough to carry the
load, and we recommend the absolute minimum of 10 mm
-------------------- */
setNarrowX=baseX;

/* Set the dove tail lenght or depth.
------------------- */
setBaseY=baseY;

/* Set the dove tail height. Must be high enough to hide any screw heads,
bolts or over-hanging screw shaft. Load requirements should also be
considered.
------------------- */
setBaseZ=baseZ;

/* Critical for wall or ceiling mounted assemblies, set it to 30 degrees or
more.
------------------- */
setBaseAngle=baseA;

levelZ=((setBaseZ/2)+(planeZ/2))-meshZ; // Raise to the bounding planeZ
translate([0, 0, levelZ ])
solidCostructionTrapezoidVersionA(baseAngle=setBaseAngle, baseX=setNarrowX,
baseY=setBaseY, baseZ=setBaseZ);
}

/*

1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890

*/
module solidCostructionTrapezoidVersionA(baseAngle, baseX, baseY, baseZ) {
sideAngle=baseAngle;
cubeX=baseX;
cubeY=baseY;
cubeZ=baseX;

sideA=cubeZtan(sideAngle);
wideSide=cubeX+(2
sideA);
calculatedHeight=cubeZ*sin(90-sideAngle);
finalHeight=calculatedHeight-baseZ;

translate([0, 0, -(baseZ/2)]) difference() {
translate([-cubeX/2, -cubeY/2, 0]) union() { // union 1
cube([cubeX, cubeY, cubeZ], center=false);

rotate([0, -sideAngle, 0])
cube([cubeZ, cubeY, cubeX], center=false);

translate([cubeX, cubeY, 0])
rotate([0, -sideAngle, 180])
cube([cubeZ, cubeY, cubeX], center=false);
} // end union 1

union() { // union 2
trimHeight=sideA+finalHeight;
moveX=((wideSide/2)+(meshZ/2));
moveY=((cubeY/2)+(meshZ/2));
moveZ=calculatedHeight-finalHeight;

translate([-moveX, -moveY, moveZ])
cube([wideSide+meshZ, cubeY+meshZ, trimHeight+meshZ], center=false);
} // end union 2
} // end difference

} // end module


Cheers!
Mr. Sandor Kunyik
Founder, Technology Evangelist
Factory 4.0 Open Initiative, LLC.
https://hubzilla.factoryfouroh.net/channel/fouroh-llc

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

I have a more-less functioning polyhedron but it does not render properly, so i would like to create trapezoid a few different ways. I use them to build dovetails, and to be able to mount them on walls and ceilings I want to really customize them. For ceilings i print them in them upright instead of flat and I use 30+ angles, up to 60. This is the best I could come up with so far, but the script really falls apart on extereme values. Maybe there is a much simpler way to do this (besides polyhedron, which I have and works great for printing but not for animation and such). // CC-BY-SA 4.0 - Factory 4.0 Open Initiative, LLC 2019 // https://welcome.factoryfouroh.net/dokuwiki /* 1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890 ----------------------------------------------------------------------------- */ planeZ=1.0000+0.0060; // Galvanized 20 gauge meshZ=0.0008; /* 22FEB20201 - Edit your dovetail parameters here The values are going to be adjusted after real-life experience and feedback. 1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890 ----------------------------------------------------------------------------- */ goodZ=0.4; badZ=0.6; createTrapezoid(baseA=80, baseX=2.4, baseY=5.4, baseZ=goodZ); module createTrapezoid(baseA, baseX, baseY, baseZ) { /* Set the narrower side, called the base. Must be wide enough to carry the load, and we recommend the absolute minimum of 10 mm -------------------- */ setNarrowX=baseX; /* Set the dove tail lenght or depth. ------------------- */ setBaseY=baseY; /* Set the dove tail height. Must be high enough to hide any screw heads, bolts or over-hanging screw shaft. Load requirements should also be considered. ------------------- */ setBaseZ=baseZ; /* Critical for wall or ceiling mounted assemblies, set it to 30 degrees or more. ------------------- */ setBaseAngle=baseA; levelZ=((setBaseZ/2)+(planeZ/2))-meshZ; // Raise to the bounding planeZ translate([0, 0, levelZ ]) solidCostructionTrapezoidVersionA(baseAngle=setBaseAngle, baseX=setNarrowX, baseY=setBaseY, baseZ=setBaseZ); } /* 1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890 ----------------------------------------------------------------------------- */ module solidCostructionTrapezoidVersionA(baseAngle, baseX, baseY, baseZ) { sideAngle=baseAngle; cubeX=baseX; cubeY=baseY; cubeZ=baseX; sideA=cubeZ*tan(sideAngle); wideSide=cubeX+(2*sideA); calculatedHeight=cubeZ*sin(90-sideAngle); finalHeight=calculatedHeight-baseZ; translate([0, 0, -(baseZ/2)]) difference() { translate([-cubeX/2, -cubeY/2, 0]) union() { // union 1 cube([cubeX, cubeY, cubeZ], center=false); rotate([0, -sideAngle, 0]) cube([cubeZ, cubeY, cubeX], center=false); translate([cubeX, cubeY, 0]) rotate([0, -sideAngle, 180]) cube([cubeZ, cubeY, cubeX], center=false); } // end union 1 union() { // union 2 trimHeight=sideA+finalHeight; moveX=((wideSide/2)+(meshZ/2)); moveY=((cubeY/2)+(meshZ/2)); moveZ=calculatedHeight-finalHeight; translate([-moveX, -moveY, moveZ]) cube([wideSide+meshZ, cubeY+meshZ, trimHeight+meshZ], center=false); } // end union 2 } // end difference } // end module ----- Cheers! Mr. Sandor Kunyik Founder, Technology Evangelist Factory 4.0 Open Initiative, LLC. https://hubzilla.factoryfouroh.net/channel/fouroh-llc -- Sent from: http://forum.openscad.org/
A
adrianv
Thu, Feb 25, 2021 9:52 PM

You might find this interesting:

https://github.com/revarbat/BOSL2/wiki/joiners.scad#module-dovetail

You can take a look at the library code.  It makes dovetails that can be
tapered.

fouroh-llc wrote

I have a more-less functioning polyhedron but it does not render properly,
so
i would like to create trapezoid a few different ways. I use them to build
dovetails, and to be able to mount them on walls and ceilings I want to
really customize them. For ceilings i print them in them upright instead
of
flat and I use 30+ angles, up to 60.

This is the best I could come up with so far, but the script really falls
apart on extereme values. Maybe there is a much simpler way to do this
(besides polyhedron, which I have and works great for printing but not for
animation and such).

// CC-BY-SA 4.0 - Factory 4.0 Open Initiative, LLC 2019
// https://welcome.factoryfouroh.net/dokuwiki

/*
1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890

*/
planeZ=1.0000+0.0060; // Galvanized 20 gauge
meshZ=0.0008;

/*
22FEB20201 - Edit your dovetail parameters here
The values are going to be adjusted after real-life experience and
feedback.
1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890

*/
goodZ=0.4;
badZ=0.6;
createTrapezoid(baseA=80, baseX=2.4, baseY=5.4, baseZ=goodZ);

module createTrapezoid(baseA, baseX, baseY, baseZ) {

/* Set the narrower side, called the base. Must be wide enough to carry
the
load, and we recommend the absolute minimum of 10 mm
-------------------- */
setNarrowX=baseX;

/* Set the dove tail lenght or depth.
------------------- */
setBaseY=baseY;

/* Set the dove tail height. Must be high enough to hide any screw heads,
bolts or over-hanging screw shaft. Load requirements should also be
considered.
------------------- */
setBaseZ=baseZ;

/* Critical for wall or ceiling mounted assemblies, set it to 30 degrees
or
more.
------------------- */
setBaseAngle=baseA;

levelZ=((setBaseZ/2)+(planeZ/2))-meshZ; // Raise to the bounding planeZ
translate([0, 0, levelZ ])
solidCostructionTrapezoidVersionA(baseAngle=setBaseAngle,
baseX=setNarrowX,
baseY=setBaseY, baseZ=setBaseZ);
}

/*

1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890

*/
module solidCostructionTrapezoidVersionA(baseAngle, baseX, baseY, baseZ) {
sideAngle=baseAngle;
cubeX=baseX;
cubeY=baseY;
cubeZ=baseX;

sideA=cubeZtan(sideAngle);
wideSide=cubeX+(2
sideA);
calculatedHeight=cubeZ*sin(90-sideAngle);
finalHeight=calculatedHeight-baseZ;

translate([0, 0, -(baseZ/2)]) difference() {
translate([-cubeX/2, -cubeY/2, 0]) union() { // union 1
cube([cubeX, cubeY, cubeZ], center=false);

rotate([0, -sideAngle, 0]) 
cube([cubeZ, cubeY, cubeX], center=false);

translate([cubeX, cubeY, 0])
rotate([0, -sideAngle, 180])
cube([cubeZ, cubeY, cubeX], center=false);
} // end union 1

union() { // union 2
trimHeight=sideA+finalHeight;
moveX=((wideSide/2)+(meshZ/2));
moveY=((cubeY/2)+(meshZ/2));
moveZ=calculatedHeight-finalHeight;

translate([-moveX, -moveY, moveZ])
cube([wideSide+meshZ, cubeY+meshZ, trimHeight+meshZ], center=false);  
} // end union 2
} // end difference

} // end module


Cheers!
Mr. Sandor Kunyik
Founder, Technology Evangelist
Factory 4.0 Open Initiative, LLC.
https://hubzilla.factoryfouroh.net/channel/fouroh-llc

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


OpenSCAD mailing list

Discuss@.openscad

You might find this interesting: https://github.com/revarbat/BOSL2/wiki/joiners.scad#module-dovetail You can take a look at the library code. It makes dovetails that can be tapered. fouroh-llc wrote > I have a more-less functioning polyhedron but it does not render properly, > so > i would like to create trapezoid a few different ways. I use them to build > dovetails, and to be able to mount them on walls and ceilings I want to > really customize them. For ceilings i print them in them upright instead > of > flat and I use 30+ angles, up to 60. > > This is the best I could come up with so far, but the script really falls > apart on extereme values. Maybe there is a much simpler way to do this > (besides polyhedron, which I have and works great for printing but not for > animation and such). > > // CC-BY-SA 4.0 - Factory 4.0 Open Initiative, LLC 2019 > // https://welcome.factoryfouroh.net/dokuwiki > > /* > 1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890 > ----------------------------------------------------------------------------- > */ > planeZ=1.0000+0.0060; // Galvanized 20 gauge > meshZ=0.0008; > > /* > 22FEB20201 - Edit your dovetail parameters here > The values are going to be adjusted after real-life experience and > feedback. > 1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890 > ----------------------------------------------------------------------------- > */ > goodZ=0.4; > badZ=0.6; > createTrapezoid(baseA=80, baseX=2.4, baseY=5.4, baseZ=goodZ); > > module createTrapezoid(baseA, baseX, baseY, baseZ) { > > /* Set the narrower side, called the base. Must be wide enough to carry > the > load, and we recommend the absolute minimum of 10 mm > -------------------- */ > setNarrowX=baseX; > > > /* Set the dove tail lenght or depth. > ------------------- */ > setBaseY=baseY; > > /* Set the dove tail height. Must be high enough to hide any screw heads, > bolts or over-hanging screw shaft. Load requirements should also be > considered. > ------------------- */ > setBaseZ=baseZ; > > /* Critical for wall or ceiling mounted assemblies, set it to 30 degrees > or > more. > ------------------- */ > setBaseAngle=baseA; > > levelZ=((setBaseZ/2)+(planeZ/2))-meshZ; // Raise to the bounding planeZ > translate([0, 0, levelZ ]) > solidCostructionTrapezoidVersionA(baseAngle=setBaseAngle, > baseX=setNarrowX, > baseY=setBaseY, baseZ=setBaseZ); > } > > /* > > 1.3.5.7..10.3.5.7..20.3.5.7..30.3.5.7..40.3.5.7..50.3.5.7..60.3.5.7..70.3.5.7890 > ----------------------------------------------------------------------------- > */ > module solidCostructionTrapezoidVersionA(baseAngle, baseX, baseY, baseZ) { > sideAngle=baseAngle; > cubeX=baseX; > cubeY=baseY; > cubeZ=baseX; > > sideA=cubeZ*tan(sideAngle); > wideSide=cubeX+(2*sideA); > calculatedHeight=cubeZ*sin(90-sideAngle); > finalHeight=calculatedHeight-baseZ; > > > translate([0, 0, -(baseZ/2)]) difference() { > translate([-cubeX/2, -cubeY/2, 0]) union() { // union 1 > cube([cubeX, cubeY, cubeZ], center=false); > > rotate([0, -sideAngle, 0]) > cube([cubeZ, cubeY, cubeX], center=false); > > translate([cubeX, cubeY, 0]) > rotate([0, -sideAngle, 180]) > cube([cubeZ, cubeY, cubeX], center=false); > } // end union 1 > > union() { // union 2 > trimHeight=sideA+finalHeight; > moveX=((wideSide/2)+(meshZ/2)); > moveY=((cubeY/2)+(meshZ/2)); > moveZ=calculatedHeight-finalHeight; > > translate([-moveX, -moveY, moveZ]) > cube([wideSide+meshZ, cubeY+meshZ, trimHeight+meshZ], center=false); > } // end union 2 > } // end difference > > } // end module > > > > > ----- > Cheers! > Mr. Sandor Kunyik > Founder, Technology Evangelist > Factory 4.0 Open Initiative, LLC. > https://hubzilla.factoryfouroh.net/channel/fouroh-llc > -- > Sent from: http://forum.openscad.org/ > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Sent from: http://forum.openscad.org/
F
fouroh-llc
Thu, Feb 25, 2021 10:20 PM

Fantastic, thanks!


Cheers!
Mr. Sandor Kunyik
Founder, Technology Evangelist
Factory 4.0 Open Initiative, LLC.
https://hubzilla.factoryfouroh.net/channel/fouroh-llc

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

Fantastic, thanks! ----- Cheers! Mr. Sandor Kunyik Founder, Technology Evangelist Factory 4.0 Open Initiative, LLC. https://hubzilla.factoryfouroh.net/channel/fouroh-llc -- Sent from: http://forum.openscad.org/