discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Bending complex shapes, circle of a helix

S
stonysmith
Sun, Aug 9, 2015 1:51 AM

See if this helps:

for( i = [0 :360] ) {
rotate([0,0,i])translate([20+sin(i*6)2,0,cos(i6)*2]) sphere(r=1,$fn=16);
rotate([0,0,i])translate([20+sin((i-30)*6)*2,0,cos((i-30)*6)*2])
sphere(r=1,$fn=32);}

--
View this message in context: http://forum.openscad.org/Bending-complex-shapes-circle-of-a-helix-tp13460p13484.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

See if this helps: for( i = [0 :360] ) { rotate([0,0,i])translate([20+sin(i*6)*2,0,cos(i*6)*2]) sphere(r=1,$fn=16); rotate([0,0,i])translate([20+sin((i-30)*6)*2,0,cos((i-30)*6)*2]) sphere(r=1,$fn=32);} -- View this message in context: http://forum.openscad.org/Bending-complex-shapes-circle-of-a-helix-tp13460p13484.html Sent from the OpenSCAD mailing list archive at Nabble.com.
N
Neon22
Sun, Aug 9, 2015 5:47 AM

Parameterised but I don't have the bars right, or the 90 degree offset for
the second spiral :(

step = 1; //quality of spiral samples. [0.1-2.0]
max_angle = 90;
pipe_radius = 2;
spiral_radius = 20;
helix_count = 8;
offset = 23; //[1,168], [2,84], [4,42], [5,36], [8,21], [10,18], [16, 11],
[20,9], [30,6], [32, 5.5]
helix_radius = 12;
quality = 8;  // $fn for spheres


for( i = [0:step:max_angle] ) {
	pos_1_X = spiral_radius+sin(i*helix_count)*helix_radius;
	pos_1_Z = cos(i*helix_count)*helix_radius;
	pos_2_X = spiral_radius+sin((i-offset)*helix_count)*helix_radius;
	pos_2_Z = cos((i-offset)*helix_count)*helix_radius;
	//hull ()
	rotate([0,0,i])
	translate([pos_1_X, 0, pos_1_Z]) 
		sphere(r=pipe_radius,$fn=quality);
	//hull()
	rotate([0,0,i])
	translate([pos_2_X, 0, pos_2_Z])
		sphere(r=pipe_radius,$fn=quality);
	// bars
	// if (floor(i%10)==0){
	// echo(i*helix_count, cos(i*helix_count)*360);
		// rotate([0,0,i])
		// translate([pos_1_X, 0, pos_1_Z])
		// rotate([0, (sin(i*helix_count)*360)-180, (cos(i*helix_count)*360)-180])
			// cylinder(h=helix_radius*2, r=pipe_radius);
	// }
} 

--
View this message in context: http://forum.openscad.org/Bending-complex-shapes-circle-of-a-helix-tp13460p13485.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Parameterised but I don't have the bars right, or the 90 degree offset for the second spiral :( ``` step = 1; //quality of spiral samples. [0.1-2.0] max_angle = 90; pipe_radius = 2; spiral_radius = 20; helix_count = 8; offset = 23; //[1,168], [2,84], [4,42], [5,36], [8,21], [10,18], [16, 11], [20,9], [30,6], [32, 5.5] helix_radius = 12; quality = 8; // $fn for spheres for( i = [0:step:max_angle] ) { pos_1_X = spiral_radius+sin(i*helix_count)*helix_radius; pos_1_Z = cos(i*helix_count)*helix_radius; pos_2_X = spiral_radius+sin((i-offset)*helix_count)*helix_radius; pos_2_Z = cos((i-offset)*helix_count)*helix_radius; //hull () rotate([0,0,i]) translate([pos_1_X, 0, pos_1_Z]) sphere(r=pipe_radius,$fn=quality); //hull() rotate([0,0,i]) translate([pos_2_X, 0, pos_2_Z]) sphere(r=pipe_radius,$fn=quality); // bars // if (floor(i%10)==0){ // echo(i*helix_count, cos(i*helix_count)*360); // rotate([0,0,i]) // translate([pos_1_X, 0, pos_1_Z]) // rotate([0, (sin(i*helix_count)*360)-180, (cos(i*helix_count)*360)-180]) // cylinder(h=helix_radius*2, r=pipe_radius); // } } ``` -- View this message in context: http://forum.openscad.org/Bending-complex-shapes-circle-of-a-helix-tp13460p13485.html Sent from the OpenSCAD mailing list archive at Nabble.com.