geändert: polyhaus.scad
fixed orientation of the outer wall elements added trigonometric helper functions
This commit is contained in:
parent
38a21e79cf
commit
3210d36f3f
1 changed files with 167 additions and 108 deletions
275
polyhaus.scad
275
polyhaus.scad
|
|
@ -13,6 +13,38 @@ sides=6;
|
||||||
outer_wall_woodwidth=50;
|
outer_wall_woodwidth=50;
|
||||||
outer_wall_strawwidth=1000;
|
outer_wall_strawwidth=1000;
|
||||||
|
|
||||||
|
// Reusable functions
|
||||||
|
// returns the inner circle radius given
|
||||||
|
// the angle
|
||||||
|
// wallstrengt
|
||||||
|
// and the diameter
|
||||||
|
//
|
||||||
|
//
|
||||||
|
function radius_in_circle(angle, diameter, wallstrength) =(
|
||||||
|
(cos(angle)*diameter)-
|
||||||
|
wallstrength
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// returns the cleaned up value
|
||||||
|
// given
|
||||||
|
// angle,
|
||||||
|
// diameter,
|
||||||
|
// wallstrengt (measured 90° to the wall)
|
||||||
|
function radius_in_diameter(angle, wallstrength, diameter) = (
|
||||||
|
radius_in_circle(angle=angle, diameter=diameter, wallstrength=wallstrength)/ cos(angle));
|
||||||
|
// echo(radius_in_diameter(diameter=2,wallstrength=0,angle=45));
|
||||||
|
// should return 2
|
||||||
|
|
||||||
|
// return the length of the inside of wall
|
||||||
|
// given
|
||||||
|
// angle
|
||||||
|
// wallstrengt
|
||||||
|
// diameter
|
||||||
|
function sidelength_inside(angle,diameter,wallstrength)=(abs(sin(angle)*radius_in_diameter(angle,diameter,wallstrength)*2));
|
||||||
|
// echo(abs(sidelength_inside(diameter=2,wallstrength=0,angle=45)));
|
||||||
|
// should return 4
|
||||||
|
|
||||||
// The House Modules
|
// The House Modules
|
||||||
module ngon(
|
module ngon(
|
||||||
diameter=5,
|
diameter=5,
|
||||||
|
|
@ -86,7 +118,7 @@ module living(
|
||||||
radius_in_diameter=radius_in_circle/ sin(angle);
|
radius_in_diameter=radius_in_circle/ sin(angle);
|
||||||
side_length=2*acos(0.5*360/sides)*radius_in_circle;
|
side_length=2*acos(0.5*360/sides)*radius_in_circle;
|
||||||
#
|
#
|
||||||
difference() {
|
difference() {
|
||||||
%ring();
|
%ring();
|
||||||
echo("DEBUG LIVING building inner ring");
|
echo("DEBUG LIVING building inner ring");
|
||||||
translate([0,0,+floorstrength])
|
translate([0,0,+floorstrength])
|
||||||
|
|
@ -108,10 +140,10 @@ module spar(
|
||||||
echo("DEBUG SPAR creating spar");
|
echo("DEBUG SPAR creating spar");
|
||||||
echo("DEBUG SPAR spar vars");
|
echo("DEBUG SPAR spar vars");
|
||||||
echo(
|
echo(
|
||||||
spar_width,
|
spar_width,
|
||||||
spar_depth,
|
spar_depth,
|
||||||
spar_height
|
spar_height
|
||||||
);
|
);
|
||||||
|
|
||||||
translate(
|
translate(
|
||||||
[0.5*spar_width,
|
[0.5*spar_width,
|
||||||
|
|
@ -126,6 +158,50 @@ module spar(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module draw_spars(
|
||||||
|
spar_offset,
|
||||||
|
outer_wall_woodwidth,
|
||||||
|
wallstrength,
|
||||||
|
ringheigth
|
||||||
|
)
|
||||||
|
{
|
||||||
|
echo("DEBUG draw_spars drawing spars");
|
||||||
|
echo("DEBUG draw_spars vars:( spar_offset, outer_wall_woodwidth, wallstrength, ringheigth)");
|
||||||
|
echo(
|
||||||
|
spar_offset,
|
||||||
|
outer_wall_woodwidth,
|
||||||
|
wallstrength,
|
||||||
|
ringheigth
|
||||||
|
);
|
||||||
|
|
||||||
|
// positive spar
|
||||||
|
translate (
|
||||||
|
[
|
||||||
|
spar_offset,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
//radius_in_circle
|
||||||
|
] )
|
||||||
|
spar(
|
||||||
|
spar_width=outer_wall_woodwidth,
|
||||||
|
spar_depth=wallstrength,
|
||||||
|
spar_height=ringheigth
|
||||||
|
);
|
||||||
|
// mirrored / negative spar
|
||||||
|
translate (
|
||||||
|
[
|
||||||
|
-spar_offset,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
//radius_in_circle
|
||||||
|
] )
|
||||||
|
spar(
|
||||||
|
spar_width=outer_wall_woodwidth,
|
||||||
|
spar_depth=wallstrength,
|
||||||
|
spar_height=ringheigth
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
module outer_wall(
|
module outer_wall(
|
||||||
ringdiameter=ringdiameter,
|
ringdiameter=ringdiameter,
|
||||||
ringstrength=ringstrength,
|
ringstrength=ringstrength,
|
||||||
|
|
@ -134,17 +210,24 @@ module outer_wall(
|
||||||
ceilingstrength=ceilingstrength
|
ceilingstrength=ceilingstrength
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
echo("DEBUG OUTER WALL building with ringdiameter, ringstrength,ringheigth,floorstrength,ceilingstrength");
|
||||||
|
echo(ringdiameter, ringstrength,ringheigth,floorstrength,ceilingstrength);
|
||||||
angle=0.5*360/sides;
|
angle=0.5*360/sides;
|
||||||
echo("DEBUG angle");
|
echo("DEBUG angle");
|
||||||
echo(angle);
|
echo(angle);
|
||||||
radius_in_circle=floor(
|
radius_in_circle=floor(
|
||||||
0.5*(sin(angle)*ringdiameter)-
|
radius_in_circle(diameter=ringdiameter,angle=angle,wallstrength=wallstrength)
|
||||||
wallstrength
|
|
||||||
|
// (cos(angle)*ringdiameter)-
|
||||||
|
// wallstrength
|
||||||
);
|
);
|
||||||
echo("DEBUG radius_in_circle");
|
echo("DEBUG radius_in_circle");
|
||||||
echo(radius_in_circle);
|
echo(radius_in_circle(diameter=ringdiameter,angle=angle,wallstrength=wallstrength));
|
||||||
side_length=round(
|
echo("DEBUG radius_in_diameter")
|
||||||
2*cos(angle)*radius_in_circle
|
|
||||||
|
echo(radius_in_diameter(diameter=ringdiameter,angle=angle,wallstrength=wallstrength));
|
||||||
|
side_length=round(sidelength_inside(diameter=ringdiameter,angle=angle,wallstrength=wallstrength)
|
||||||
|
//2*cos(angle)*radius_in_circle
|
||||||
);
|
);
|
||||||
echo("DEBUG side_lenght");
|
echo("DEBUG side_lenght");
|
||||||
echo(side_length);
|
echo(side_length);
|
||||||
|
|
@ -153,109 +236,85 @@ module outer_wall(
|
||||||
echo(elements);
|
echo(elements);
|
||||||
for(side=[1:sides] )
|
for(side=[1:sides] )
|
||||||
{
|
{
|
||||||
echo("DEBUG running through sides");
|
// rotate the outerwall to every side of the building
|
||||||
echo(side);
|
rotate(angle+2*side*angle)
|
||||||
rotate(
|
translate(
|
||||||
[0,0,2*angle]
|
[
|
||||||
)
|
radius_in_circle+
|
||||||
{
|
wallstrength,
|
||||||
echo(" DEBUG OUTER WALL building spars")
|
0,
|
||||||
if (elements%2==1)
|
0
|
||||||
|
]
|
||||||
|
)
|
||||||
{
|
{
|
||||||
echo("DEBUG uneven number");
|
echo("DEBUG running through sides");
|
||||||
// center the middle modeline
|
echo(side);
|
||||||
for (spar= [0:elements])
|
rotate( [0,0,90])
|
||||||
{
|
|
||||||
echo("DEBUG OUTER WALL planking");
|
|
||||||
echo("DEBUG OUTER WALL spar");
|
|
||||||
echo(spar);
|
|
||||||
offset = (
|
|
||||||
0.5* outer_wall_strawwidth +
|
|
||||||
spar*(outer_wall_woodwidth +
|
|
||||||
outer_wall_strawwidth)
|
|
||||||
);
|
|
||||||
echo("DEBUG OUTER WALL offset for spar");
|
|
||||||
echo(offset);
|
|
||||||
echo("DEBUG OUTER WALL spar vars");
|
|
||||||
echo(
|
|
||||||
outer_wall_woodwidth,
|
|
||||||
wallstrength,
|
|
||||||
level
|
|
||||||
);
|
|
||||||
translate (
|
|
||||||
[
|
|
||||||
0,
|
|
||||||
offset,
|
|
||||||
radius_in_circle
|
|
||||||
] )
|
|
||||||
spar(
|
|
||||||
spar_width=outer_wall_woodwidth,
|
|
||||||
spar_depth=wallstrength,
|
|
||||||
spar_height=level
|
|
||||||
);
|
|
||||||
translate (
|
|
||||||
[
|
|
||||||
0,
|
|
||||||
-offset,
|
|
||||||
radius_in_circle
|
|
||||||
] )
|
|
||||||
spar(
|
|
||||||
spar_width=outer_wall_woodwidth,
|
|
||||||
spar_depth=wallstrength,
|
|
||||||
spar_height=level
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (elements%2==0)
|
|
||||||
{
|
{
|
||||||
echo("DEBUG even number");
|
echo("DEBUG OUTER WALL building spars");
|
||||||
// center the middle modeline
|
if (elements%2==1)
|
||||||
for (spar= [0:elements])
|
|
||||||
{
|
{
|
||||||
echo("DEBUG OUTER WALL planking");
|
echo("DEBUG uneven number");
|
||||||
echo("DEBUG OUTER WALL spar");
|
// center the middle modeline
|
||||||
echo(spar);
|
for (spar= [0:elements/2])
|
||||||
offset= (0.5* outer_wall_strawwidth +
|
{
|
||||||
spar*(outer_wall_woodwidth+
|
echo("DEBUG OUTER WALL planking");
|
||||||
outer_wall_strawwidth));
|
echo("DEBUG OUTER WALL spar");
|
||||||
echo("DEBUG OUTER WALL offset for spar");
|
echo(spar);
|
||||||
echo(offset);
|
offset = (
|
||||||
echo("DEBUG OUTER WALL spar vars");
|
0.5* outer_wall_strawwidth +
|
||||||
echo(
|
spar*(outer_wall_woodwidth +
|
||||||
outer_wall_woodwidth,
|
outer_wall_strawwidth)
|
||||||
wallstrength,
|
|
||||||
level
|
|
||||||
);
|
);
|
||||||
// positive spar
|
echo("DEBUG OUTER WALL offset for spar");
|
||||||
translate (
|
echo(offset);
|
||||||
[
|
echo("DEBUG OUTER WALL spar vars");
|
||||||
offset,
|
echo(
|
||||||
0,
|
outer_wall_woodwidth,
|
||||||
radius_in_circle
|
wallstrength,
|
||||||
] )
|
ringheigth
|
||||||
spar(
|
);
|
||||||
spar_width=outer_wall_woodwidth,
|
draw_spars(
|
||||||
spar_depth=wallstrength,
|
offset,
|
||||||
spar_height=level
|
outer_wall_woodwidth,
|
||||||
);
|
wallstrength,
|
||||||
// negative spar
|
ringheigth
|
||||||
translate (
|
);
|
||||||
[
|
}
|
||||||
-offset,
|
}
|
||||||
0,
|
if (elements%2==0)
|
||||||
radius_in_circle
|
{
|
||||||
] )
|
echo("DEBUG even number");
|
||||||
spar(
|
// center the middle modeline
|
||||||
spar_width=outer_wall_woodwidth,
|
for (spar= [0:elements/2])
|
||||||
spar_depth=wallstrength,
|
{
|
||||||
spar_height=level
|
echo("DEBUG OUTER WALL planking");
|
||||||
);
|
echo("DEBUG OUTER WALL spar");
|
||||||
}
|
echo(spar);
|
||||||
|
// offset "along" the wall
|
||||||
|
offset= (0.5* outer_wall_strawwidth +
|
||||||
|
spar*(outer_wall_woodwidth+
|
||||||
|
outer_wall_strawwidth));
|
||||||
|
echo("DEBUG OUTER WALL offset for spar");
|
||||||
|
echo(offset);
|
||||||
|
echo("DEBUG OUTER WALL spar vars");
|
||||||
|
echo(
|
||||||
|
outer_wall_woodwidth,
|
||||||
|
wallstrength,
|
||||||
|
ringheigth
|
||||||
|
);
|
||||||
|
draw_spars(
|
||||||
|
offset,
|
||||||
|
outer_wall_woodwidth,
|
||||||
|
wallstrength,
|
||||||
|
ringheigth=ringheigth
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
living();
|
living();
|
||||||
translate([0,0,level]) living();
|
translate([0,0,level]) living();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue