1
Fork 0

wing struts

This commit is contained in:
Andy Killorin 2023-10-31 08:23:51 -05:00
parent fc8267e104
commit 2bf48965f9
No known key found for this signature in database
GPG key ID: 8CB11B45B690DC2A
2 changed files with 22 additions and 6 deletions

View file

@ -5,3 +5,4 @@ pub const LENGTH: f32 = 0.0;
pub const STRUTS: usize = 10; pub const STRUTS: usize = 10;
pub const STRUT_WIDTH: f32 = 2.4; pub const STRUT_WIDTH: f32 = 2.4;
pub const SPAR_SIDE_WIDTH: f32 = 0.75; pub const SPAR_SIDE_WIDTH: f32 = 0.75;
pub const FUSELAGE_GAP: f32 = 10.0 * IN2MM;

View file

@ -9,11 +9,25 @@ fn main() {
let mut scad_file = ScadFile::new(); let mut scad_file = ScadFile::new();
scad_file.set_detail(50); scad_file.set_detail(50);
let e393 = selig::parse(include_str!("../e393.selig")); // cambered airfoil, used in the wing
let e393: Airfoil = selig::parse(include_str!("../e393.selig"));
// symetric airfoil, used in the control surfaces
let exxx: Airfoil = selig::parse(include_str!("../e393.selig"));
let mut wing = scad!(Translate(vec3(0.0,0.0,0.0))); let mut wing = scad!(Translate(vec3(0.0,0.0,0.0)));
for strut_idx in 0..STRUTS {
let mut transform = scad!(Translate(vec3(0.0, strut_idx as f32 * 30.0 ,0.0))); for strut_idx in 0..STRUTS + 2 {
let port: bool = strut_idx % 2 == 1;
let out: usize = strut_idx/2;
let mut spacing = WINGSPAN/2.0 * out as f32 + FUSELAGE_GAP / 2.0;
println!("{port} {out} {spacing}");
if port { spacing = -spacing };
let mut transform = scad!(Translate(vec3(0.0, spacing ,0.0)));
transform.add_child(strut(&e393, CHORD, STRUT_WIDTH)); transform.add_child(strut(&e393, CHORD, STRUT_WIDTH));
wing.add_child(transform); wing.add_child(transform);
@ -24,18 +38,19 @@ fn main() {
scad_file.write_to_file(String::from("out.scad")); scad_file.write_to_file(String::from("out.scad"));
} }
fn strut(airfoil: &Airfoil, length: f32, width: f32) -> ScadObject { /// returns a extruded airfoil with the given dimensions
fn strut(airfoil: &Airfoil, chord: f32, width: f32) -> ScadObject {
let aerofoil = scad::PolygonParameters::new(airfoil.clone()); let aerofoil = scad::PolygonParameters::new(airfoil.clone());
let shape = scad!(Polygon(aerofoil)); let shape = scad!(Polygon(aerofoil));
let extrude = LinExtrudeParams { let extrude = LinExtrudeParams {
height: width, height: width,
slices: 5, center: true,
..Default::default() ..Default::default()
}; };
let unit: Vector3<f32> = Vector3::new(1.0, 1.0, 1.0); let unit: Vector3<f32> = Vector3::new(1.0, 1.0, 1.0);
let scaled = scad!(Scale(unit * length); shape); let scaled = scad!(Scale(unit * chord); shape);
let strut = scad!(LinearExtrude(extrude); scaled); let strut = scad!(LinearExtrude(extrude); scaled);
let rotated = scad!(Rotate(90.0, vec3(1.0, 0.0, 0.0)); strut); let rotated = scad!(Rotate(90.0, vec3(1.0, 0.0, 0.0)); strut);
rotated rotated