Re: Using OpenSCAD to produce drawings for 3D Printing
Posted: Sat Jan 01, 2022 4:05 pm
In Tinkercad for curved words I just use this, it's built in and simple to use.
An international forum for garden railway modellers in all scales and gauges. It is free to join and is funded through voluntary contributions by its members. Many thanks to all those who keep it going.
https://gardenrails.org/forum/
This is a great question. But not an easy one! Especially as I've never made a dome virtually or physically. I've had a look at the way you did it in TinkerCAD (cutting into a disc with a Taurus) and I guess physically you'd do it on a lathe (and a mill?) which seems like a good excuse to look at OpenSCAD's rotate_extrude() which is sort of like a virtual lathe... although the outcome is really just going to be the same as what you did in TinkerCAD, nothing more.
Code: Select all
difference(){
square([3,3]);
translate([0,3,0])
circle(3);
}
$fn=100;
Code: Select all
rotate_extrude()
translate([-10,0,0])
difference(){
square([3,3]);
translate([0,3,0])
circle(3);
}
$fn=100;
Code: Select all
dome();
module dome() {
cylinder(10,7,7);
translate([0,0,10])
sphere(7);
flare();
}
module flare() {
rotate_extrude()
translate([-10,0,0])
difference(){
square([3,3]);
translate([0,3,0])
circle(3);
}
}
$fn=100;
Well that could have saved me a lot of work! (Although I'd have learned a lot less...) I looked for something like that - and couldn't find it - and indeed I still can't find it!
This definitely has the feel of a 3 pipe problem…-steves- wrote: ↑Sun Jan 02, 2022 9:36 am The dome looks fantastic, however it's only good for a flat boiler. The dome for a round boiler needs the flare to change inline with the size of the curve of the boiler.
If you can do the code for that, it would be extremely useful, especially for those of us who struggle with any type of programming
Cor blimey...my brain 'urts just reading wot you've rit, let alone trying to understand it!SimonWood wrote: ↑Sun Jan 02, 2022 10:01 amThis definitely has the feel of a 3 pipe problem…-steves- wrote: ↑Sun Jan 02, 2022 9:36 am The dome looks fantastic, however it's only good for a flat boiler. The dome for a round boiler needs the flare to change inline with the size of the curve of the boiler.
If you can do the code for that, it would be extremely useful, especially for those of us who struggle with any type of programming
I think there may be ways to do it… Googling suggests I need to understand how it handles minkowski() addition - I don’t - and there may be less computationally intensive ways to do it, but I probably need other OpenSCAD transformations and keywords I don’t know about. Which is why I’m enjoying the puzzle (especially as I have no need to print a dome!) I found an online book Mastering OpenSCAD which is excellent (I’ve already identified errors in my techniques, and discovered things e.g. submodules that could make my ‘code’ much neater).
Code: Select all
// How thick the board on which the lettering is placed should be
backboard_depth=2;
// How high the letters should be
font_size=6;
// The thickness of the letters above the board
lettering_depth=1;
// The radius of arc forming the outer edge of the headboard
outer_radius=50;
// How big the border around the edge of the board should be
border_width=1;
backboard_height=3*font_size+2*border_width;
rotate(-120/2)
translate([0,outer_radius,-1])
cylinder(backboard_depth+lettering_depth+2,backboard_height/2,backboard_height/2);
rotate(120/2)
translate([0,outer_radius,-1])
cylinder(backboard_depth+lettering_depth+2,backboard_height/2,backboard_height/2);
Code: Select all
// How thick the board on which the lettering is placed should be
backboard_depth=2;
// How high the letters should be
font_size=6;
// The thickness of the letters above the board
lettering_depth=1;
// The radius of arc forming the outer edge of the headboard
outer_radius=50;
// How big the border around the edge of the board should be
border_width=1;
backboard_height=3*font_size+2*border_width;
for (i=[0:1])
mirror( [i, 0, 0] )
rotate(120/2)
translate([0,outer_radius,-1])
cylinder(backboard_depth+lettering_depth+2,backboard_height/2,backboard_height/2);
As Philip says - it looks like quite a steep initial learning curve. I skimmed through the 'Basics' section and got brain meltdown about half way through. No doubt, if I put my mind to it with a specific outcome in sight, I might be able to make some progress. My trouble is that I'm a bit impatient and want to start seeing results quickly. I suspect I'd have to do a fair amount of basic stuff before I could get to the stage of drawing a simple half decent shape.SimonWood wrote: ↑Sun Jan 02, 2022 10:01 am I found an online book Mastering OpenSCAD which is excellent (I’ve already identified errors in my techniques, and discovered things e.g. submodules that could make my ‘code’ much neater).
Thank you - incidentally, rotate_extrude() would be an excellent way of creating a hat to 3D print
Mastering OpenSCAD, excellent though it is, keeps teaching me new things that I think might be helpful with this... and then they turn out not to be. Mind you, I'm only 6 chapters in. Still an impatient corner of my brain wants to find a solution already, and I've started wondering if my approach isn't running against the grain of what OpenSCAD is good at. I've been thinking of transforming the 3D mesh, using some kind of fillet, a bit like Metalmuncher demonstrated in Fusion 360. But it seems to me the strength of OpenSCAD is being able to create a piece of geometry and then reuse it - with different parameters as needed.-steves- wrote: ↑Sun Jan 02, 2022 9:36 am The dome looks fantastic, however it's only good for a flat boiler. The dome for a round boiler needs the flare to change inline with the size of the curve of the boiler.
If you can do the code for that, it would be extremely useful, especially for those of us who struggle with any type of programming
Code: Select all
steps=360;
fwidth=3;
fradius=10;
boiler_radius=25;
function h(angle) = boiler_radius*(1-cos(asin(fradius*sin(angle/steps)/boiler_radius)));
function x(h)=h+pow(h,2)/(2*fwidth);
for (i=[0:steps]) {
rotate(360*i/steps)
rotate_extrude(angle=360/steps)
translate([-fradius,0,0])
difference(){
translate([0,-h(360*i),0])
square([fwidth,fwidth+h(360*i)]);
translate([-x(h(360*i)),fwidth,0])
circle(fwidth+x(h(360*i)));
if(sin(360*i/steps)!=0)
translate([fradius,-boiler_radius,0])
scale([1/sin(360*i/steps),1,1])
circle(boiler_radius);
}
}
$fn=100;
Exactly my thoughts as well. That was how I got my head around Sketchup and probably why I can't get on with Tinker.
I also have an old (7 years old and not high spec) laptop and it took less than 10 mins to render, so no issues there, it gives a great finish and easy to change, liking it so far
Good stuff, let me know if you attempt to print it!
I won't get chance to print it for a few days, but I will do, plus I will add the rest of the dome to the top in Tinkercad, once printed I will post it up.
Yes, I really like this too.
Thanks for the tip! Only runs on Windows though - however that's probably for the best, I have little enough time to spend learning OpenSCAD without getting distracted by another CAD system...I found Solid Edge Community Edition and although it took more effort to learn than SCAD had, it's my go-to CAD system these days (it's free to download btw).
That's fantastic - I will take a look at those when I have a moment, I'm sure they can be rescaled so I might well have a go at printing the phone box - and more than that, to learn from the SCAD techniques used. Thank you.Meanwhile, some other G3S members have really dived deeper into SCAD and you may like to look at the G3 Forum where John C has been posting printable LNER carriage parts and more recently a water tower and early GPO phone box. Worth a look if you are interested in using SCAD for model railway related work. Being SCAD, I suspect they can be easily rescaled...
You'll find the telephone box here if interested....
https://g3forum.org.uk/index.php?topic= ... n#msg18464
I've had a bit of a go a that one. Just three "orange segment" shapes stuck together.
Code: Select all
$fn=64;
module ShellShape(width, straightlen, angle){
rotate([90,90+angle/2,0])
rotate_extrude(angle=angle)
translate([-straightlen,-0,0])
union(){
translate([0,-width/2,0])
square([straightlen,width]);
difference(){
circle(d=width);
translate([0,-width/2,0])
square([width/2,width]);
}
}
};
union(){
cylinder(d=11, h=0.5);
ShellShape(8 ,3 ,60);
ShellShape(7.8,2.5,120);
ShellShape(7.4,2 ,160);
}
Excellent! I'm still finding OpenSCAD fascinating, and enjoying the new uses it can be put to...
Oh wow, this is great. I just stared at Steve's pics and scratched my head.metalmuncher wrote: ↑Wed Jan 05, 2022 6:48 pmI've had a bit of a go a that one. Just three "orange segment" shapes stuck together.
Not quite perfectly proportioned, maybe a bit of unequal scaling of the shells would make it better. I also didn't bother making the shells thin, depending on print scale such thin structures might not be easily printable, but the thin wall could be added relatively easily.
Code: Select all
topShellAngle = 50; // [20:5:80]
secondShellAngle = 110; // [80:5:140]
thirdShellangle = 160; // [140:5:180]
bluntness = 0; // [0:0.5:5]
// Decrements in the radius of each shell
redrad = 0.2; // [0.1:0.1:0.5]
angles = [topShellAngle,secondShellAngle,thirdShellangle,180];
module ShellShape(width, straightlen, angle, bluntness){
pf=bluntness*pow((1-angle/180),2);
difference() {
translate([0,0,-pf])
rotate([90,90+angle/2,0])
rotate_extrude(angle=angle)
translate([-straightlen-pf,-0,0])
union(){
translate([0,-width/2,0])
square([straightlen+pf,width]);
difference(){
circle(d=width);
translate([0,-width/2,0])
square([width/2,width]);
}
}
translate([-straightlen-pf-width/2-1,-width/2-1,-pf])
cube([2*(straightlen+pf)+width+2,width+2,pf]);
}
};
union(){
cylinder(d=11, h=0.5);
for (i=[0:3]) {
ShellShape(8-redrad*i,3-0.5*i,angles[i],bluntness);
}
}
$fn=64;
Glad it's not just me.