Init: DNA Double Helix OpenSCAD project.

This commit is contained in:
2024-10-04 14:46:22 +01:00
parent 45bb72ea3c
commit 5d39466974
6 changed files with 92 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
// Author: Edward Middleton-Smith
// Project: DNA Double Helix
// Technology: Main
// Feature:
include <modules/constants.scad>;
use <modules/dna_double_helix.scad>;
DNA_Double_Helix(radius_rotation_helix, radius_strand_helix, angle_twist_total, height, rise, length_discretisation, pi, angle_incline);

View File

@@ -0,0 +1,17 @@
// Author: Edward Middleton-Smith
// Project: DNA Double Helix
// Technology: Constants and Variables
// Feature:
// constants
radius_rotation_helix = 80; // radius of helix (displacement of any part of helix from central axis)
radius_strand_helix = 20;
angle_twist_total = 1440;
height = 1300;
rise = 240; // vertical spacing between base-pair rungs
length_discretisation = 1; // length_discretisationretisation of points per units length
pi = 3.14159265359; // rounded
// intermediate variables
angle_incline = asin(height * 360 / angle_twist_total / 2 / pi / radius_rotation_helix);
echo("angle_incline: ", angle_incline);

View File

@@ -0,0 +1,45 @@
// Author: Edward Middleton-Smith
// Project: Miscellaneous
// Technology: DNA Double Helix
// Feature: Main
include <constants.scad>;
use <tip_cutting_cube.scad>;
module DNA_Double_Helix(radius_rotation_helix, radius_strand_helix, angle_twist_total, height, rise, length_discretisation, pi, angle_incline) {
union() {
difference() {
union() {
linear_extrude(height = height, center = false, convexity = 10, twist = angle_twist_total, slices = height * length_discretisation) translate([radius_rotation_helix, 0, 0]) scale([1, 2, 1]) circle(radius_strand_helix);
linear_extrude(height = height, center = false, convexity = 10, twist = angle_twist_total, slices = height * length_discretisation) translate([-radius_rotation_helix, 0, 0]) scale([1, 2, 1]) circle(radius_strand_helix);
}
// grooves
// tip removal - forces faces at ends of helix to be tangential to helix circumference at that point
for (index_tip_helix = [1:4]) {
rotate([0, 0, -7]) tip_cutting_cube(radius_rotation_helix, radius_strand_helix, index_tip_helix, angle_incline, height, angle_twist_total);
}
}
// knobs - balls at ends of helixes
rotate([0, 0, -25]) translate([radius_rotation_helix, radius_strand_helix * (1 - sin(angle_incline)),radius_strand_helix * cos(angle_incline)]) sphere(radius_strand_helix);
rotate([0, 0, 155]) translate([radius_rotation_helix, radius_strand_helix * (1 - sin(angle_incline)),radius_strand_helix * cos(angle_incline)]) sphere(radius_strand_helix);
rotate([0, 0, 39]) mirror([0, 0, 1]) translate([0, 0, -height]) {
rotate([0,0,-25]) translate([radius_rotation_helix, radius_strand_helix * (1 - sin(angle_incline)),radius_strand_helix * cos(angle_incline)]) sphere(radius_strand_helix);
rotate([0,0,155]) translate([radius_rotation_helix, radius_strand_helix * (1 - sin(angle_incline)),radius_strand_helix * cos(angle_incline)]) sphere(radius_strand_helix);
}
// base-pair rungs
for (index_rung = [1 : (height - height % rise) / rise]) {
echo("index rung: ", index_rung);
position_rung = rise * index_rung / height * angle_twist_total;
echo("position rung: ", position_rung);
translate([0, 0, rise * index_rung - radius_strand_helix * 3/2]) rotate([-angle_incline, 90, -position_rung]) scale([1/2, 1, 1]) cylinder(2 * radius_rotation_helix, radius_strand_helix, radius_strand_helix, center = true);
}
}
}
DNA_Double_Helix(radius_rotation_helix, radius_strand_helix, angle_twist_total, height, rise, length_discretisation, pi, angle_incline);

View File

@@ -0,0 +1,21 @@
// Author: Edward Middleton-Smith
// Project: Miscellaneous
// Technology: DNA Double Helix
// Feature: Main
include <constants.scad>;
module tip_cutting_cube (radius_rotation_helix, radius_strand_helix, index_tip_helix, angle_incline, height, angle_twist_total) {
dx = radius_rotation_helix / 2 + radius_strand_helix * 2;
dy = radius_strand_helix * 2 * (1 - cos(angle_incline));
edge_size = 3 * radius_strand_helix;
echo("cutting cube edge size: ", edge_size);
requires_rotation_to_alternative_tip_at_end = (index_tip_helix == 1 || index_tip_helix == 4);
tip_is_at_top = (index_tip_helix == 3 || index_tip_helix == 4);
height_tip_top = height;
rotate([0, 0, (requires_rotation_to_alternative_tip_at_end ? 180 : 0) + (tip_is_at_top ? 0 : 0)]) translate([dx, dy, tip_is_at_top ? height_tip_top : 0]) rotate([-angle_incline, 0, 0]) cube(edge_size, center = true);
}
index_tip_helix = 1; // 1 - 4
tip_cutting_cube(radius_rotation_helix, radius_strand_helix, index_tip_helix, angle_incline, height, angle_twist_total);

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.