Upload files to "/"
This commit is contained in:
parent
abe843c359
commit
3c7596f28c
|
@ -0,0 +1,105 @@
|
|||
$airfoil_fn = 120;
|
||||
$close_airfoils = true;
|
||||
|
||||
//https://en.wikipedia.org/wiki/NACA_airfoil
|
||||
|
||||
function foil_y(x, c, t) =
|
||||
(5*t*c)*( ( 0.2969 * sqrt(x/c) ) - ( 0.1260*(x/c) ) - ( 0.3516*pow((x/c),2) ) + ( 0.2843*pow((x/c),3) ) - ( ( $close_airfoils ? 0.1036 : 0.1015)*pow((x/c),4) ) ); //NACA symetrical airfoil formula
|
||||
function camber(x,c,m,p) = ( x <= (p * c) ?
|
||||
( ( (c * m)/pow( p, 2 ) ) * ( ( 2 * p * (x / c) ) - pow( (x / c) , 2) ) ) :
|
||||
( ( (c * m)/pow((1 - p),2) ) * ( (1-(2 * p) ) + ( 2 * p * (x / c) ) - pow( (x / c) , 2)))
|
||||
);
|
||||
function theta(x,c,m,p) = ( x <= (p * c) ?
|
||||
atan( ((m)/pow(p,2)) * (p - (x / c)) ) :
|
||||
atan( ((m)/pow((1 - p),2)) * (p - (x / c)) )
|
||||
);
|
||||
function camber_y(x,c,t,m,p, upper=true) = ( upper == true ?
|
||||
( camber(x,c,m,p) + (foil_y(x,c,t) * cos( theta(x,c,m,p) ) ) ) :
|
||||
( camber(x,c,m,p) - (foil_y(x,c,t) * cos( theta(x,c,m,p) ) ) )
|
||||
);
|
||||
function camber_x(x,c,t,m,p, upper=true) = ( upper == true ?
|
||||
( x - (foil_y(x,c,t) * sin( theta(x,c,m,p) ) ) ) :
|
||||
( x + (foil_y(x,c,t) * sin( theta(x,c,m,p) ) ) )
|
||||
);
|
||||
|
||||
|
||||
module airfoil_poly (c = 100, naca = 0015, raw=false) {
|
||||
$close_airfoils = ($close_airfoils != undef) ? $close_airfoils : false;
|
||||
$airfoil_fn = ($airfoil_fn != undef) ? $airfoil_fn : 100;
|
||||
res = c/$airfoil_fn; //resolution of foil poly
|
||||
|
||||
//establish thickness/length ratio
|
||||
t = (raw == false) ? ((naca%100)/100) : raw[2];
|
||||
// maximum camber:chord
|
||||
m = (raw == false) ?((floor((((naca-(naca%100))/1000))) /100) ):raw[0];
|
||||
//distance of maximum camber from the airfoil leading edge in tenths of the chord
|
||||
p = (raw == false) ?((((naca-(naca%100))/100)%10) / 10): raw[1];
|
||||
|
||||
|
||||
// points have to be generated with or without camber, depending.
|
||||
points_u = ( m == 0 || p == 0) ?
|
||||
[for (i = [0:res:c]) let (x = i, y = foil_y(i,c,t) ) [x,y]] :
|
||||
[for (i = [0:res:c]) let (x = camber_x(i,c,t,m,p), y = camber_y(i,c,t,m,p) ) [x,y]] ;
|
||||
|
||||
points_l = ( m == 0 || p == 0) ?
|
||||
[for (i = [c:-1*res:0]) let (x = i, y = foil_y(i,c,t) * -1 ) [x,y]] :
|
||||
[for (i = [c:-1*res:0]) let (x = camber_x(i,c,t,m,p,upper=false), y = camber_y(i,c,t,m,p, upper=false) ) [x,y]] ;
|
||||
|
||||
polygon(concat(points_u,points_l)); //draw poly
|
||||
}
|
||||
|
||||
//Todo: Wings, w/angles
|
||||
// Airfoil definition = [c,naca]
|
||||
module airfoil_simple_wing (airfoils=false, wing_angle=[0,0], wing_length=1000){
|
||||
|
||||
if (airfoils != false) {
|
||||
if (len(airfoils[0]) == undef) {
|
||||
hull(){
|
||||
|
||||
linear_extrude(0.1) airfoil_poly(airfoils[0],airfoils[1]);
|
||||
|
||||
translate([(sin(wing_angle[0]) * wing_length),(sin(wing_angle[1]) * wing_length),wing_length]) linear_extrude(0.1) airfoil_poly(airfoils[0],airfoils[1]);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
union(){
|
||||
for( i=[1:len(airfoils)-1] ) {
|
||||
hull() {
|
||||
|
||||
translate([(sin(wing_angle[0]) * wing_length * (i-1)/len(airfoils)),
|
||||
(sin(wing_angle[1]) * wing_length * (i-1)/len(airfoils)),
|
||||
wing_length * (i-1)/len(airfoils)])
|
||||
linear_extrude(0.1) airfoil_poly(airfoils[(i-1)][0],airfoils[(i-1)][1]);
|
||||
|
||||
translate([(sin(wing_angle[0]) * wing_length * i/len(airfoils)),
|
||||
(sin(wing_angle[1]) * wing_length * i/len(airfoils)),
|
||||
wing_length * i/len(airfoils)])
|
||||
linear_extrude(0.1) airfoil_poly(airfoils[i][0],airfoils[i][1]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo("No Airfoils defined! Airfoils should be a set of [chord, naca]. Specify one for a uniform wing, two or more for compound wing. If specifying only one, do not put it in a set/vector. Multiple airfoils will be spaced evenly along the wing length.");
|
||||
}
|
||||
}
|
||||
module airfoil_help(){
|
||||
echo("<u><b>Parametric Airfoil and Wing generator v0.1</u></b> <br>\
|
||||
For a brief overview of the math and specifications used, see https://en.wikipedia.org/wiki/NACA_airfoil<br>\
|
||||
<u>Globals:</u><br> \
|
||||
<b><i>$close_airfoils</b></i>: Defines whether you want the back of your air foils closed, or if you want them open (default: false) <br>\
|
||||
<b><i>$airfoil_fn</b></i>: number of sides for your airfoil. (default: 100) <br>\
|
||||
<u>airfoil_poly help:</u><br>\
|
||||
<b><i>c</b></i>: Chord length, this is the chord length of your airfoil. (default: 100) <br>\
|
||||
<b><i>naca</b></i>: The NACA 4-digit specification for your airfoil. (default: 0015) <br>\
|
||||
<b><i>raw</b></i>: overrides the NACA code with direct ratios. Provide in the same order as the NACA digits. (e.g NACA 4123 becomes raw [.4,.1,.23])<br>
|
||||
<u>airfoil_simple_wing help:</u> <br>\
|
||||
<b><i>airfoils</b></i>: Airfoils should be a set of [chord, naca]. Specify one for a uniform wing, two or more in a vector for compound wing. If specifying only one, do not put it in a set/vector. Multiple airfoils will be spaced evenly along the wing length. (required)<br>\
|
||||
<b><i>wing_angle</b></i>: a set of angles, [sweep,slope] (optional, default=[0,0])<br>\
|
||||
<b><i>wing_length</b></i>: length of the wing (optional, default=1000)");
|
||||
}
|
||||
airfoil_help();
|
||||
//translate([0,0,100]) airfoil_poly();
|
||||
//airfoil_simple_wing(airfoils=[[100,0015],[200,2414],[100,0015],[200,2414],[100,0015]], wing_angle=[20,-20]);
|
|
@ -0,0 +1,55 @@
|
|||
// More information: https://danielupshaw.com/openscad-rounded-corners/
|
||||
|
||||
// Set to 0.01 for higher definition curves (renders slower)
|
||||
$fs = 0.15;
|
||||
|
||||
module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") {
|
||||
// If single value, convert to [x, y, z] vector
|
||||
size = (size[0] == undef) ? [size, size, size] : size;
|
||||
|
||||
translate_min = radius;
|
||||
translate_xmax = size[0] - radius;
|
||||
translate_ymax = size[1] - radius;
|
||||
translate_zmax = size[2] - radius;
|
||||
|
||||
diameter = radius * 2;
|
||||
|
||||
obj_translate = (center == false) ?
|
||||
[0, 0, 0] : [
|
||||
-(size[0] / 2),
|
||||
-(size[1] / 2),
|
||||
-(size[2] / 2)
|
||||
];
|
||||
|
||||
translate(v = obj_translate) {
|
||||
hull() {
|
||||
for (translate_x = [translate_min, translate_xmax]) {
|
||||
x_at = (translate_x == translate_min) ? "min" : "max";
|
||||
for (translate_y = [translate_min, translate_ymax]) {
|
||||
y_at = (translate_y == translate_min) ? "min" : "max";
|
||||
for (translate_z = [translate_min, translate_zmax]) {
|
||||
z_at = (translate_z == translate_min) ? "min" : "max";
|
||||
|
||||
translate(v = [translate_x, translate_y, translate_z])
|
||||
if (
|
||||
(apply_to == "all") ||
|
||||
(apply_to == "xmin" && x_at == "min") || (apply_to == "xmax" && x_at == "max") ||
|
||||
(apply_to == "ymin" && y_at == "min") || (apply_to == "ymax" && y_at == "max") ||
|
||||
(apply_to == "zmin" && z_at == "min") || (apply_to == "zmax" && z_at == "max")
|
||||
) {
|
||||
sphere(r = radius);
|
||||
} else {
|
||||
rotate =
|
||||
(apply_to == "xmin" || apply_to == "xmax" || apply_to == "x") ? [0, 90, 0] : (
|
||||
(apply_to == "ymin" || apply_to == "ymax" || apply_to == "y") ? [90, 90, 0] :
|
||||
[0, 0, 0]
|
||||
);
|
||||
rotate(a = rotate)
|
||||
cylinder(h = diameter, r = radius, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
//Psion Travel Dock
|
||||
use <airfoil.scad>
|
||||
use <roundedcorner.scad>
|
||||
|
||||
$fn=30;
|
||||
|
||||
connector_width = 6.7 + 1;
|
||||
connector_length = 17.8 + 1;
|
||||
connector_height = 11.5;
|
||||
base_width = 20;
|
||||
base_length = 17.2;
|
||||
|
||||
|
||||
|
||||
dock_base_width = 34.6;
|
||||
dock_base_length_max = 140 + 12;
|
||||
dock_base_length_min = 135;
|
||||
dock_base_height = 11.1;
|
||||
|
||||
dock_total_length = 147;
|
||||
|
||||
wing_width = 3.62;
|
||||
wing_depth = 39.0;
|
||||
wing_height_max = 15.0;
|
||||
wing_height_min = 6.0;
|
||||
|
||||
wing_clip_length = 4;
|
||||
wing_clip_depth = 0.7;
|
||||
wing_clip_height = 2.0;
|
||||
|
||||
bridge_width = 11.1;
|
||||
bridge_seperation = 3.9;
|
||||
|
||||
|
||||
difference(){
|
||||
union(){
|
||||
|
||||
difference(){
|
||||
translate([-5,0,-1 * dock_base_length_max]){
|
||||
rotate([0,0,7]){
|
||||
airfoil_simple_wing([dock_base_width -5, 0022], wing_length=dock_base_length_max, wing_angle=[0,0]);
|
||||
}
|
||||
}
|
||||
|
||||
translate([2,0,(-1 *(dock_base_length_max/2)) +1]){
|
||||
rotate([90,0,-15]){
|
||||
cube([connector_width, connector_length, connector_height], center=true);
|
||||
}
|
||||
}
|
||||
|
||||
translate([8,3.2,(-1 *(dock_base_length_max/2)) + 1]){
|
||||
rotate([90,0,-15]){
|
||||
cube([base_width, base_length, connector_height], center=true);
|
||||
}
|
||||
}
|
||||
|
||||
//Screws
|
||||
translate([2,10,(-1 *(dock_base_length_max/2)) + 1 + ((base_width / 2) + 3)]){
|
||||
rotate([90,0,0]){
|
||||
cylinder(30, d=3.5, center=true);
|
||||
}
|
||||
}
|
||||
|
||||
translate([2,10,(-1 *(dock_base_length_max/2)) + 1 + (-1*(base_width / 2) - 3)]){
|
||||
rotate([90,0,0]){
|
||||
cylinder(30, d=3.5, center=true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Wing R
|
||||
translate([0,-2,0]){
|
||||
rotate([0,0,10]){
|
||||
translate([-10,0,0]){
|
||||
rotate([0,0,0]){
|
||||
airfoil_simple_wing([wing_depth, 0032], wing_length=wing_width, wing_angle=[0,0]);
|
||||
}
|
||||
}
|
||||
|
||||
translate([-4,-3.5,-0.3]){
|
||||
rotate([0,0,-30]){
|
||||
color("green"){
|
||||
roundedcube([wing_clip_length, wing_clip_depth, wing_clip_height], true, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wing L
|
||||
translate([0,-2,-1 * dock_base_length_max]){
|
||||
rotate([0,0,10]){
|
||||
translate([-10,0,0]){
|
||||
rotate([0,0,0]){
|
||||
airfoil_simple_wing([wing_depth, 0032], wing_length=wing_width, wing_angle=[0,0]);
|
||||
}
|
||||
}
|
||||
|
||||
translate([-4,-3.5,-0.3 + wing_width]){
|
||||
rotate([0,0,-30]){
|
||||
color("green"){
|
||||
roundedcube([wing_clip_length, wing_clip_depth, wing_clip_height], true, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
rotate([90,0,0]){
|
||||
translate([7,-1 * (dock_base_length_max / 2),-9]){
|
||||
cube([dock_base_width + 10, dock_base_length_max + 10,dock_base_height],center=true);
|
||||
}
|
||||
}
|
||||
//Difference End
|
||||
}
|
Loading…
Reference in New Issue