Can't figure this out - need some advice

Posted by andy.wpg
 Can't figure this out - need some advice June 29, 2015 05:15PM Registered: 9 years ago Posts: 24
I'm making an end cap that goes in the end of a carbon fiber tube with an outside diameter of 12mm and an inside diameter of 10mm.

To that end, I created the following:

```difference ()
{

union ()
{
cylinder(13,3,3,\$fn=100);  //main cylinder
cylinder(3,6,6,\$fn=100);   //disk on end
translate([0,0,5])
cylinder(1,5,5,\$fn=100);   //fin 1
translate([0,0,7])
cylinder(1,5,5,\$fn=100);	//fin 2
translate([0,0,9])
cylinder(1,5,5,\$fn=100); //fin 3
translate([0,0,11])
cylinder(1,5,5,\$fn=100);  //fin4
}
translate ([0,0,1])
cylinder(25,1,1,\$fn=100); //hollow center
}```

This works just fine, and looks......ok. What I really want to do is make the end cap (the 12mm X 3mm disk) into a slightly domed shape so it will look nicer. That's been the problem. Nothing I've tried works. Anyone have any advice?

Thanks,

Andy

"I have noticed that even those who assert that everything is predestined and that
we can change nothing about it still look both ways before they cross the street"

-Stephen Hawking
 Re: Can't figure this out - need some advice June 30, 2015 02:24AM Registered: 7 years ago Posts: 5,232

```difference ()
{

union ()
{
translate([0,0,3])
cylinder(10,3,3,\$fn=100);  //main cylinder
intersection(){
translate ([0,0,6])
sphere(6, \$fn=100);
cylinder(3,6,6,\$fn=100);    //disk on end
}
translate([0,0,5])
cylinder(1,5,5,\$fn=100);   //fin 1
translate([0,0,7])
cylinder(1,5,5,\$fn=100);	//fin 2
translate([0,0,9])
cylinder(1,5,5,\$fn=100); //fin 3
translate([0,0,11])
cylinder(1,5,5,\$fn=100);  //fin4
}
translate ([0,0,1])
cylinder(25,1,1,\$fn=100); //hollow center
}```
"
You can play around with the sphere size and itÂ´s translation value until you find a nice looking shape. ( I like "12" for both )

Edited 2 time(s). Last edit at 06/30/2015 02:31AM by o_lampe.
 Re: Can't figure this out - need some advice June 30, 2015 10:02AM Registered: 9 years ago Posts: 24
Quote
o_lampe

Perfect! You have no idea how much I messed around trying to achieve that! I should mention, while I have many technical talents, math and I don't get along very well, so sometimes, SCAD is a challenge for me.

Thanks again

"I have noticed that even those who assert that everything is predestined and that
we can change nothing about it still look both ways before they cross the street"

-Stephen Hawking
 Re: Can't figure this out - need some advice August 16, 2015 01:37AM Registered: 7 years ago Posts: 19
Sorry about replying to an old topic. I am still learning Openscad but I have been a hobby programmer for many years. I slightly modify o_lampe's code to use a for loop

```difference ()
{

union ()
{
translate([0,0,3])
cylinder(10,3,3,\$fn=100);  //main cylinder
intersection(){
translate ([0,0,6])
sphere(6, \$fn=100);
cylinder(3,6,6,\$fn=100);    //disk on end
}
//For loop Z = 5 to 11 step 2 - Z movement
for (z = [5:2:11]) {
translate([0,0,z])
cylinder(1,5,5,\$fn=100);   //4 fins
}

}
translate ([0,0,1])
cylinder(25,1,1,\$fn=100); //hollow center
}```

Edited 1 time(s). Last edit at 08/16/2015 01:39AM by rrowan327.
 Re: Can't figure this out - need some advice October 02, 2015 04:16AM Registered: 8 years ago Posts: 4,977
Or

`for (z = [5,7,9,11])`

 Triffid Hunter's Calibration Guide --> X <-- Drill for new Monitor Most important Gcode.
Sorry, only registered users may post in this forum.