Results 41 to 50 of 74
Thread: Need some geometry help
-
12-05-2014, 08:00 PM #41
Whoa, pardner. Have you made a typo?
x = cos(theta) * [ r0 + r1 * cos(phi) ]
y = sin(theta) * [ r0 + r1 * cos(phi) ]
z = r1 * sin(phi)
Shouldn't your z coordinate equation be written with v ?
And this series of equations will produce a round toroid with a round cross section. My need is for square toroids with square cross section.
OME
-
12-05-2014, 08:17 PM #42
- Join Date
- Jun 2014
- Location
- Burnley, UK
- Posts
- 1,662
-
12-05-2014, 08:58 PM #43
- Join Date
- Dec 2014
- Posts
- 2
I must protest, there is nothing fake going on, no mirroring, no special treatment of quadrants. But there is a modified definition of pow() which preserves the sign ... which is in effect achieving the quadrant mappings.
Last edited by Paul Bourke; 12-05-2014 at 09:09 PM.
-
12-05-2014, 09:17 PM #44
- Join Date
- Dec 2014
- Posts
- 2
By way of introduction ... I've been doing 3D printing for almost 20 years, it isn't as new as many people think, just the machines are getting better at the high end and cheaper at the lower end. My main use of 3D printing is as part of data visualisation, printing datasets allowing researchers to explore them in the same way as one explores objects in real life. Some examples from chemistry where researchers here are now 3D printing on a regular basis
http://paulbourke.net/miscellaneous/molecular_rp/
And for indigenous Australian rock art where it is now almost a standard part of the recording process
http://paulbourke.net/miscellaneous/rapidproto/
-
12-05-2014, 11:13 PM #45
Sorry to be out of sequence, but had a sudden illness about midday and have only just recovered enough to get back on line.
I didn't get a chance to post this bit of Dr Bourke's reply to my emails:
Are you running a Windows or Linux based computer. If Linux then the
code I provided should compile easily ... almost certainly also under
Windows but I don't use that so would not be able to give advise. I
don't think the code I gave can be translated to OpenScad, it is after
all just an implementation of the equations. Openscad does things very
differently, my code is creating a surface whereas Openscad is wanting
to work on solids.
Welcome to our community Dr Bourke.
OME
-
12-06-2014, 05:16 AM #46
I used Dr Bourke's stl file and sliced it with Slic3r. I had to scale it to get a 75mm diameter torus, 15 cm high. The slice checked out OK with Pronterface.
Dr Bourke said: " my code is creating a surface whereas Openscad is wanting to work on solids."
I wonder if that really affects a 3D print. When I sliced his stl, I ended up with the shape, but still had to instruct Slic3r what sort of infill I wanted. OpenSad might indeed work with solids, but in the end, our slicers only look at the coordinates of points on the surface to make the shape.
Can we have an explanation/definition of modified definition of pow() as in "But there is a modified definition of pow() which preserves the sign ... which is in effect achieving the quadrant mappings?
What values for n0 and n1 did you use to create that torus?
Old Man Emu
-
12-06-2014, 06:27 AM #47
- Join Date
- Jun 2014
- Location
- Burnley, UK
- Posts
- 1,662
OK, how is this:
// Define polygon shape here, cross section.
module shape()
{
polygon(points=[[0,0],[0,5],[10,10],[5,0]], paths=[[0,1,2,3]]);
}
module corner(Quadrant, CentretoShape,CornerRadius)
{
rotate(Quadrant*90,0,0)
translate ([CentretoShape,CentretoShape,0])
for (c = [0:90])
{
rotate (a = [0, 0, c])
{
rotate(a = [90, 0, 0])
{
linear_extrude(height = 1, center = true, convexity = 10, twist = 0)
translate([CornerRadius, 0, 0])
shape();
}
}
}
}
module side(Quadrant, CentretoShape, CornerRadius)
{
rotate(a = [0, 0, Quadrant*90])
{
rotate(a = [90, 0, 0])
{
linear_extrude(height = 2*CentretoShape, center = true, convexity = 10, twist = 0)
translate([CornerRadius+CentretoShape, 0, 0])
shape();
}
}
}
module toroid(CentretoShape,CornerRadius)
{
corner (1, CentretoShape,CornerRadius);
corner (2, CentretoShape,CornerRadius);
corner (3, CentretoShape,CornerRadius);
corner (4, CentretoShape,CornerRadius);
side (1, CentretoShape,CornerRadius);
side (2, CentretoShape,CornerRadius);
side (3, CentretoShape,CornerRadius);
side (4, CentretoShape,CornerRadius);
}
//CentretoShape,CornerRadius
toroid (25,10);
You can make "polygon" (top of file) as complicated as you like within the processing ability of your computer. Diameter of ring and radius of corners is defined at the bottom of the file.
-
12-06-2014, 02:39 PM #48
That does work, but for the dummies amongst us, would you go back and comment the code to explain what each module is doing. please?
OME
-
12-06-2014, 03:47 PM #49
- Join Date
- Jun 2014
- Location
- Burnley, UK
- Posts
- 1,662
// Define polygon shape here, cross section.
module shape()
{
// In here you can have any 2D shape you want, circle, square or polygon
// polygon(points=[[0,0],[0,5],[5,5],[5,10],[10,10],[10,4],[5,4],[5,0]]);
polygon(points=[[0,0],[100,0],[0,100],[10,10],[80,10],[10,80]], paths=[[0,1,2],[3,4,5]]);
//square (100,false);
//circle (r=10);
}
// This makes a corner in the correct place with the shape defined above and the radii defined at the end.
module corner(Quadrant, CentretoShape,CornerRadius)
{
// Get it in the right quadrant, 1, 2, 3 or 4 being valid quadrants
rotate(Quadrant*90,0,0)
// Move it away from the origin some more, by the amount defined with CentretoShape (toroid radius)
translate ([CentretoShape,CentretoShape,0])
for (c = [0:90]) // Steps for rotate and copy defined here
{
// Draw it lots of times, one for each degree in this example, defined on the line above, you can step less than a degree if you want and have higher resolution
rotate (a = [0, 0, c])
{
// Stand the shape up so it is in YZ plane
rotate(a = [90, 0, 0])
{
// Give it some thickness, this needs to be increased if you want big shapes
linear_extrude(height = 2, center = true, convexity = 10, twist = 0)
// Move it away from the origin by the corner radius defined below
translate([CornerRadius, 0, 0])
// The shape you want in the XY plane
shape();
}
}
}
}
module side(Quadrant, CentretoShape, CornerRadius)
{
// Put it in the right quadrant
rotate(a = [0, 0, Quadrant*90])
{
/ Lie it down
rotate(a = [90, 0, 0])
{
// Extrude it to twice the toroid radius
linear_extrude(height = 2*CentretoShape, center = true, convexity = 10, twist = 0)
// Move it away from the origin by the corner radius plus the toroid radius defined below
translate([CornerRadius+CentretoShape, 0, 0])
// The shape you want in the XY plane
shape();
}
}
}
module toroid(CentretoShape,CornerRadius)
{
// Make the corners
corner (1, CentretoShape,CornerRadius);
corner (2, CentretoShape,CornerRadius);
corner (3, CentretoShape,CornerRadius);
corner (4, CentretoShape,CornerRadius);
// Make the sides
side (1, CentretoShape,CornerRadius);
side (2, CentretoShape,CornerRadius);
side (3, CentretoShape,CornerRadius);
side (4, CentretoShape,CornerRadius);
}
//CentretoShape,CornerRadius
toroid (25,5);
-
12-06-2014, 03:55 PM #50
- Join Date
- Jun 2014
- Location
- Burnley, UK
- Posts
- 1,662
As it is above it takes over three hours to compile and render on my steam powered P4 which you have to do in order to export the STL.
New to 3d printing looking for...
05-20-2024, 12:56 AM in Tips, Tricks and Tech Help