discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

another problem program

DS
Dan Shriver
Mon, Dec 12, 2016 11:20 PM

So I have another program that I wrote which I am banging my head over.
Another OpenSCAD list member gave me the necessary code for a ogee arch
(namely the pie slice...) and I have a program that morphs from a "Roman"
arch to an ogee arch.

There are a few bugs with it that I can't figure out:

  1. halfway down the progression (where it is 100% Roman arch) there is a
    bump on the top surface that I can't figure out why it is there

  2. I thought I offset the height difference between a Roman arch and an
    ogee arch (using two pie slices), but I think I messed up because the
    bottom edges of my thing seem to form a rounded w shape (rather than being
    co planiar).  I don't understand that.  As the ogee is transitioning to a
    Roman arch I tried to offset the whole thing with the goal that the bottom
    would be coplaniar and that the Roman arch would be at the same height as
    the bottom part of the ogee arch.

  3. my contraption is narrowest at the 100% Roman arch.  I can't quite
    figure out a good way of making it widest there (and keeping everything
    else the same).

How do other people pick these kind of problems apart in OpenSCAD?


module halfPieOgee(r1,r2,width,fnNum,offset,elongate) {
r1a = r1 + elongate;
translate([0,offset,0]) {
translate([((r2)-((r2)cos(45)))-width,(r2(sin(45))),0]) {
rotate( [0,0,-45] ){
difference() {
translate([(-r1a+width),0,0]) {
pie_slice(r1a,0,45,fnNum);
}
translate([-r1a,0,0]) {
pie_slice(r1a,0,45,fnNum);
}
}
translate([r2,0,0]) {
mirror( [0,1,0]) mirror( [1,0,0]) {
difference() {
pie_slice(r2,0,45,fnNum);
pie_slice((r2-width),0,45,fnNum);
}
}
}
}
}
}
}

module hpOgee(r1,r2,width,fnNum,offset,elongate) {
difference() {
halfPieOgee(r1,r2,width,fnNum,offset,elongate);
translate([(-0.5*width),0,0]) {
square([width,r2],center=true);
}
}
}

module pieOgee(r1,r2,width,fnNum,offset=0,elongate=0) {
hpOgee(r1,r2,width,fnNum,offset,elongate);
mirror(0,1,0) {
hpOgee(r1,r2,width,fnNum,offset,elongate);
}
}

module OgeeMorph(r1,r2,width,fnNum,stepSize,steps,r1a=0) {
angleFactor = 180/steps;
for(i = [1:steps]) {
translate([0,0,((i-1)stepSize)]) {
linear_extrude(height=stepSize,convexity=10) {
r = (r1a == 0) ? (r1 + (abs(r2
cos(angleFactor*i)))) : (r1 + (r1a

  • r1)(cos(angleFactori)));
    /*

pieOgee(r,abs(r2cos(angleFactori)),width,fnNum,abs(r2sin(angleFactori)),(r2-abs(r2cos(angleFactori))));
*/

pieOgee(r1,abs(r2cos(angleFactori)),width,fnNum,abs(r2sin(angleFactori)),0);
}
}
}
}

OgeeMorph(20,10,1,100,0.1,200);

module point(x,y) translate([x,y]) circle(0.01);

module pie_slice(r, a0, a1, fnNum) {
//$fa = 5;
R = r * sqrt(2) + 1;
intersection() {
circle(r, $fn=fnNum);
hull() {
point(0,0);
for(i = [0:4])
//a = (((4 - i) * a0 + i * a1) / 4);
point(R * cos((((4 - i) * a0 + i * a1) / 4)), R *
sin((((4 - i) * a0 + i * a1) / 4)));
}
}
}

//archTopOff(10,0,20,100,20);

So I have another program that I wrote which I am banging my head over. Another OpenSCAD list member gave me the necessary code for a ogee arch (namely the pie slice...) and I have a program that morphs from a "Roman" arch to an ogee arch. There are a few bugs with it that I can't figure out: 1) halfway down the progression (where it is 100% Roman arch) there is a bump on the top surface that I can't figure out why it is there 2) I thought I offset the height difference between a Roman arch and an ogee arch (using two pie slices), but I think I messed up because the bottom edges of my thing seem to form a rounded w shape (rather than being co planiar). I don't understand that. As the ogee is transitioning to a Roman arch I tried to offset the whole thing with the goal that the bottom would be coplaniar and that the Roman arch would be at the same height as the bottom part of the ogee arch. 3) my contraption is narrowest at the 100% Roman arch. I can't quite figure out a good way of making it widest there (and keeping everything else the same). How do other people pick these kind of problems apart in OpenSCAD? -------------------------------------------------------------------------------------------------------------------------- module halfPieOgee(r1,r2,width,fnNum,offset,elongate) { r1a = r1 + elongate; translate([0,offset,0]) { translate([((r2)-((r2)*cos(45)))-width,(r2*(sin(45))),0]) { rotate( [0,0,-45] ){ difference() { translate([(-r1a+width),0,0]) { pie_slice(r1a,0,45,fnNum); } translate([-r1a,0,0]) { pie_slice(r1a,0,45,fnNum); } } translate([r2,0,0]) { mirror( [0,1,0]) mirror( [1,0,0]) { difference() { pie_slice(r2,0,45,fnNum); pie_slice((r2-width),0,45,fnNum); } } } } } } } module hpOgee(r1,r2,width,fnNum,offset,elongate) { difference() { halfPieOgee(r1,r2,width,fnNum,offset,elongate); translate([(-0.5*width),0,0]) { square([width,r2],center=true); } } } module pieOgee(r1,r2,width,fnNum,offset=0,elongate=0) { hpOgee(r1,r2,width,fnNum,offset,elongate); mirror(0,1,0) { hpOgee(r1,r2,width,fnNum,offset,elongate); } } module OgeeMorph(r1,r2,width,fnNum,stepSize,steps,r1a=0) { angleFactor = 180/steps; for(i = [1:steps]) { translate([0,0,((i-1)*stepSize)]) { linear_extrude(height=stepSize,convexity=10) { r = (r1a == 0) ? (r1 + (abs(r2*cos(angleFactor*i)))) : (r1 + (r1a - r1)*(cos(angleFactor*i))); /* pieOgee(r,abs(r2*cos(angleFactor*i)),width,fnNum,abs(r2*sin(angleFactor*i)),(r2-abs(r2*cos(angleFactor*i)))); */ pieOgee(r1,abs(r2*cos(angleFactor*i)),width,fnNum,abs(r2*sin(angleFactor*i)),0); } } } } OgeeMorph(20,10,1,100,0.1,200); module point(x,y) translate([x,y]) circle(0.01); module pie_slice(r, a0, a1, fnNum) { //$fa = 5; R = r * sqrt(2) + 1; intersection() { circle(r, $fn=fnNum); hull() { point(0,0); for(i = [0:4]) //a = (((4 - i) * a0 + i * a1) / 4); point(R * cos((((4 - i) * a0 + i * a1) / 4)), R * sin((((4 - i) * a0 + i * a1) / 4))); } } } //archTopOff(10,0,20,100,20);