Results 11 to 20 of 74
Thread: Need some geometry help
-
12-02-2014, 03:59 AM #11
- Join Date
- Jun 2014
- Location
- Burnley, UK
- Posts
- 1,662
rotate(a = [90, 0, 0]) {
linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
translate([1, 0, 0])
square(r = 1);}
rotate (a = [0, 0, 90]){
rotate(a = [90, 0, 0]) {
linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
translate([1, 0, 0])
square(r = 1);}
}
rotate (a = [0, 0, 180]){
rotate(a = [90, 0, 0]) {
linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
translate([1, 0, 0])
square(r = 1);}
}
rotate (a = [0, 0, 270]){
rotate(a = [90, 0, 0]) {
linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
translate([1, 0, 0])
square(r = 1);}
}
-
12-02-2014, 06:04 AM #12
That coding just makes cubes at various locations around the Z axis. I want to make whizzo things like this:
and at the moment i's stumped by not having the answer to this question:
how do I get OpenScad to automatically use all the values for theta and phi in their respective ranges (0 to 2 pi)?
How about doing it this way?
iteration over a range specifying an increment: // Note: The middle parameter in the range designation
// ('0.2' in this case) is the 'increment-by' value
// Warning: Depending on the 'increment-by' value, the
// real end value may be smaller than the given one.
for ( i = [0 : 0.2 : 5] )
{
rotate( i * 360 / 6, [1, 0, 0])
translate([0, 10, 0])
sphere(r = 1)
OME
Last edited by old man emu; 12-02-2014 at 08:13 PM.
-
12-02-2014, 06:38 AM #13
- Join Date
- Jun 2014
- Location
- Burnley, UK
- Posts
- 1,662
OK, then you have to do it this way for circular ones.
rotate_extrude(convexity = 10, $fn=100)
translate([6, 0, 0])
polygon(points=[[0,0],[0,10],[10,10],[10,0]], paths=[[0,1,2,3]]);
The polygon defining your cross sectional shape.
-
12-02-2014, 07:09 AM #14
- Join Date
- Jun 2014
- Location
- Burnley, UK
- Posts
- 1,662
Hmm, it seems square ones are a lot more complicated because of the parts where they touch.
First attempt:
for (i=[1:4]){
rotate (a = [0, 0, i*90]){
translate ([0,15,0])
rotate(a = [90, 0, 0]) {
linear_extrude(height = 35, convexity = 10, $fn=100)
translate([10, 0, 0])
polygon(points=[[0,0],[3,3],[0,10],[7,7],[8,8],[10,0]], paths=[[0,1,2,3,4,5]]);
}}}
It needs more polygons defining the ends of the shape I think
-
12-02-2014, 08:16 PM #15
My question is:
Can this formula
http://paulbourke.net/geometry/torus/supertoroid3.gif
be written in a way that OpenScad can produce an object from it?
If so,
how do I get OpenScad to automatically use all the values for theta and phi in their respective ranges (0 to 2 pi)?
Old Man Emu
-
12-04-2014, 06:49 AM #16
- Join Date
- Jun 2014
- Location
- Burnley, UK
- Posts
- 1,662
Because you can only define variables to work on primatives the only way this can be done is to define a very small sphere (or cube) and then move that through the values of x y z that you want. I will give you any shape but it will take massive processing power to do anything complex.
For that sort of manipulation it would be a lot easier to work with straight Gcode than anything else. This is because Gcode naturally joins specific dots where Openscad does not.
-
12-04-2014, 09:14 AM #17
This is an interesting test of the powers of OpenScad. I think Mjolinor is right about it taking a lot of processing power. But I think it can be done very successfully. At the highest level, I would define a module that used a 'for' loop on n1 and n2 to send them through their range. (That way, you can generate each shape in your table up above.) I would have this module call the toriod() module that I wrote. And I would display this torroid and some suitable translate() based on n1 and n2 so I could generate the same table.
In the toriod() module I would use a nested 'for' loop to vary theta and phi over their range. I would generate a small sphere at each of the (x,y,z) coordinates that got generated from these loops. And here is the difference from what Mjolinor suggests.
All of that logic inside the toriod() module's loops would be inside a hull() statement. I think OpenScad will draw a hull around those points so you get a nice, smooth skin.
-
12-04-2014, 09:40 AM #18
- Join Date
- Jun 2014
- Location
- Burnley, UK
- Posts
- 1,662
That is what I did. A very small sphere redrawn for 1 degree movements and you do end up with a toroid but you had better have a Cray handy if you want to do anything with it other than grow your fingernails and hair while you wait.
-
12-04-2014, 09:46 AM #19
-
12-04-2014, 10:34 AM #20
- Join Date
- Jun 2014
- Location
- Burnley, UK
- Posts
- 1,662
You have a Cray then.
r0 = 4;
r1 = 2;
for (v = [0:360])
{
for (u = [0:360])
{
assign (A = ((r0 + r1 * cos(v)) * cos (u)), B = ((r0 + r1 * cos(v)) * sin (u)), C = (r1 * sin(v)))
{
translate ([A,B,C])
sphere (r=1);
}
}
}
AB and C are xy and z (I thought xyz maybe special within Openscad), your angles are u and v, radii are r0 and r1.
Ender 3v2 poor printing quality
10-28-2024, 09:08 AM in Tips, Tricks and Tech Help