1
Fork 0

project wing spar

This is known bad, I couldn't get hulls betweens segments to work
properly. There are likely negative tolerances along the struts
This commit is contained in:
Andy Killorin 2023-11-02 15:07:37 -05:00
parent cd3580477a
commit 2f00aaec57
No known key found for this signature in database
GPG key ID: 8CB11B45B690DC2A

View file

@ -38,8 +38,8 @@ fn main() {
for port in [true,false] {
let mut wing = wing(&wing_airfoil, STRUTS/2, WINGSPAN/2.0, CHORD, CHORD * WING_TAPER, SparType::Top);
let top_spar = topwing_spar(&wing_airfoil, STRUTS/2, WINGSPAN/2.0, CHORD, CHORD * WING_TAPER);
register_part(scad!(Projection(false); top_spar));
wing = scad!(Translate(vec3(0.0, FUSELAGE_GAP,0.0)); wing);
wing.add_child(top_spar);
if port {
wing = scad!(Mirror(vec3(0.0, 1.0, 0.0)); wing);
}
@ -119,10 +119,10 @@ fn strut(airfoil: &Airfoil, chord: f32, width: f32, spar: &SparType) -> ScadObje
}
};
extrude_strut(shape, strut_hole, width, chord)
extrude_strut(shape, strut_hole, width, chord, true)
}
fn extrude_strut(shape: ScadObject, strut_hole: ScadObject, width: f32, chord: f32) -> ScadObject {
fn extrude_strut(shape: ScadObject, strut_hole: ScadObject, width: f32, chord: f32, register:bool) -> ScadObject {
let mut strut_shape = scad!(Difference);
strut_shape.add_child(shape);
strut_shape.add_child(strut_hole);
@ -137,7 +137,9 @@ fn extrude_strut(shape: ScadObject, strut_hole: ScadObject, width: f32, chord: f
let unit: Vector3<f32> = Vector3::new(1.0, 1.0, 1.0);
let scaled = scad!(Scale(unit * chord); shape);
register_part(scaled.clone());
if register {
register_part(scaled.clone());
}
let strut = scad!(LinearExtrude(extrude); scaled);
let rotated = scad!(Rotate(90.0, vec3(1.0, 0.0, 0.0)); strut);
rotated
@ -218,7 +220,7 @@ fn wing(aerofoil: &Airfoil, struts: usize, length: f32, chord: f32, taper: f32,
}
fn topwing_spar(aerofoil: &Airfoil, struts: usize, length: f32, chord: f32, taper: f32) -> ScadObject {
let mut wing = scad!(Translate(vec3(0.0,0.0,0.0)));
let mut wing = scad!(Hull);
let mut last_segment : Option<ScadObject> = None;
let mut pre_vis = scad!(Union);
@ -233,7 +235,7 @@ fn topwing_spar(aerofoil: &Airfoil, struts: usize, length: f32, chord: f32, tape
let spacing = strut_idx as f32 * gap;
let shape = topspar_negative(&aerofoil, chord, 0.1..0.6);
let extruded = extrude_strut(shape.clone(), scad!(Union), CARDBOARD_WIDTH, chord);
let extruded = extrude_strut(shape.clone(), scad!(Union), CARDBOARD_WIDTH, chord, false);
let mut transform = scad!(Translate(vec3(0.0, spacing ,0.0)));
transform.add_child(extruded);
@ -242,13 +244,16 @@ fn topwing_spar(aerofoil: &Airfoil, struts: usize, length: f32, chord: f32, tape
// in betweens
if let Some(last) = last_segment {
let mut hull = scad!(Hull);
hull.add_child(last);
hull.add_child(shape.clone());
let extrude = LinExtrudeParams {
height: 0.01,
center: true,
..Default::default()
};
let unit: Vector3<f32> = Vector3::new(1.0, 1.0, 1.0);
hull = scad!(Scale(unit * chord); hull);
hull = scad!(Rotate(90.0, vec3(1.0, 0.0, 0.0)); hull);
let mut last_t = scad!(Translate(vec3(0.0, -gap ,0.0)));
last_t.add_child(scad!(LinearExtrude(extrude.clone()); last));
hull.add_child(last_t);
hull.add_child(scad!(LinearExtrude(extrude); shape.clone()));
transform.add_child(hull);
}