How can I tell what OpenSCAD is doing?

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I tell what OpenSCAD is doing?

DanS
I know this is is somewhat of a bad question (because CGAL is a black box...) but, even if the progress bar is a complete lie (which it usually is for me) is there some way that I can tell that openSCAD is still doing something and hasn't stopped?

I ask because I have some simple test code:

module testTorus() {
  for (i = [0:360]) {
    translate([(20*cos(i)),(20*sin(i)),0]) {  
      rotate_extrude(angle=1, convexity=10){      
        translate([20,20,0]) {
          circle(r=10,$fn=5);
        }
      }
    }
  }
}

I ask it to run and I get "Rendering Polygon Mesh using CGAL..." and no other indication that things are progressing and just want to be sure it is still working.

Why am I doing things this very painful way when I could just rotate_extrude through 360 degrees?  This is just a simple test case to see if what I am doing will work.  When I actually implement things I will have the different slices each be slightly different.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

nophead
The only thing you are asking CGAL to do is union 360 overlapping tori, so that is what it will be trying to do. That will take a time approaching infinity as union is very slow especially with overlapping shapes with lots of vertices.

On 9 October 2016 at 17:05, Dan Shriver <[hidden email]> wrote:
I know this is is somewhat of a bad question (because CGAL is a black box...) but, even if the progress bar is a complete lie (which it usually is for me) is there some way that I can tell that openSCAD is still doing something and hasn't stopped?

I ask because I have some simple test code:

module testTorus() {
  for (i = [0:360]) {
    translate([(20*cos(i)),(20*sin(i)),0]) {  
      rotate_extrude(angle=1, convexity=10){      
        translate([20,20,0]) {
          circle(r=10,$fn=5);
        }
      }
    }
  }
}

I ask it to run and I get "Rendering Polygon Mesh using CGAL..." and no other indication that things are progressing and just want to be sure it is still working.

Why am I doing things this very painful way when I could just rotate_extrude through 360 degrees?  This is just a simple test case to see if what I am doing will work.  When I actually implement things I will have the different slices each be slightly different.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

DanS
I want to make sure I understand your response.

When you say "tori" you don't mean each is a torus, but each is a slice of a torus, right?

I'm trying to make a torus of 360 slices, the goal being that if I can do that I can change each slice a little bit so the torus "morphs".

I have been doing this kind of thing with linear_extrude() and am just doing a test here to make sure my approach with rotate_extrude() is correct.

You are indicating that  it will be slow and painful the way I'm doing it.  Is there any way inside of OpenSCAD for me to make it faster (like rotate_extrude() does if it does the entire 360 itself) without decreasing the number of slices?

On Sun, Oct 9, 2016 at 12:32 PM, nop head <[hidden email]> wrote:
The only thing you are asking CGAL to do is union 360 overlapping tori, so that is what it will be trying to do. That will take a time approaching infinity as union is very slow especially with overlapping shapes with lots of vertices.

On 9 October 2016 at 17:05, Dan Shriver <[hidden email]> wrote:
I know this is is somewhat of a bad question (because CGAL is a black box...) but, even if the progress bar is a complete lie (which it usually is for me) is there some way that I can tell that openSCAD is still doing something and hasn't stopped?

I ask because I have some simple test code:

module testTorus() {
  for (i = [0:360]) {
    translate([(20*cos(i)),(20*sin(i)),0]) {  
      rotate_extrude(angle=1, convexity=10){      
        translate([20,20,0]) {
          circle(r=10,$fn=5);
        }
      }
    }
  }
}

I ask it to run and I get "Rendering Polygon Mesh using CGAL..." and no other indication that things are progressing and just want to be sure it is still working.

Why am I doing things this very painful way when I could just rotate_extrude through 360 degrees?  This is just a simple test case to see if what I am doing will work.  When I actually implement things I will have the different slices each be slightly different.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

nophead
The only way to make things like that fast is to generate lists of vertices and faces and pass them to polyhedron. GCAL is too slow to union hundreds of objects.

On 9 October 2016 at 18:00, Dan Shriver <[hidden email]> wrote:
I want to make sure I understand your response.

When you say "tori" you don't mean each is a torus, but each is a slice of a torus, right?

I'm trying to make a torus of 360 slices, the goal being that if I can do that I can change each slice a little bit so the torus "morphs".

I have been doing this kind of thing with linear_extrude() and am just doing a test here to make sure my approach with rotate_extrude() is correct.

You are indicating that  it will be slow and painful the way I'm doing it.  Is there any way inside of OpenSCAD for me to make it faster (like rotate_extrude() does if it does the entire 360 itself) without decreasing the number of slices?

On Sun, Oct 9, 2016 at 12:32 PM, nop head <[hidden email]> wrote:
The only thing you are asking CGAL to do is union 360 overlapping tori, so that is what it will be trying to do. That will take a time approaching infinity as union is very slow especially with overlapping shapes with lots of vertices.

On 9 October 2016 at 17:05, Dan Shriver <[hidden email]> wrote:
I know this is is somewhat of a bad question (because CGAL is a black box...) but, even if the progress bar is a complete lie (which it usually is for me) is there some way that I can tell that openSCAD is still doing something and hasn't stopped?

I ask because I have some simple test code:

module testTorus() {
  for (i = [0:360]) {
    translate([(20*cos(i)),(20*sin(i)),0]) {  
      rotate_extrude(angle=1, convexity=10){      
        translate([20,20,0]) {
          circle(r=10,$fn=5);
        }
      }
    }
  }
}

I ask it to run and I get "Rendering Polygon Mesh using CGAL..." and no other indication that things are progressing and just want to be sure it is still working.

Why am I doing things this very painful way when I could just rotate_extrude through 360 degrees?  This is just a simple test case to see if what I am doing will work.  When I actually implement things I will have the different slices each be slightly different.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

nophead
Yes they are only one degree slices of tori.

On 9 October 2016 at 18:03, nop head <[hidden email]> wrote:
The only way to make things like that fast is to generate lists of vertices and faces and pass them to polyhedron. GCAL is too slow to union hundreds of objects.

On 9 October 2016 at 18:00, Dan Shriver <[hidden email]> wrote:
I want to make sure I understand your response.

When you say "tori" you don't mean each is a torus, but each is a slice of a torus, right?

I'm trying to make a torus of 360 slices, the goal being that if I can do that I can change each slice a little bit so the torus "morphs".

I have been doing this kind of thing with linear_extrude() and am just doing a test here to make sure my approach with rotate_extrude() is correct.

You are indicating that  it will be slow and painful the way I'm doing it.  Is there any way inside of OpenSCAD for me to make it faster (like rotate_extrude() does if it does the entire 360 itself) without decreasing the number of slices?

On Sun, Oct 9, 2016 at 12:32 PM, nop head <[hidden email]> wrote:
The only thing you are asking CGAL to do is union 360 overlapping tori, so that is what it will be trying to do. That will take a time approaching infinity as union is very slow especially with overlapping shapes with lots of vertices.

On 9 October 2016 at 17:05, Dan Shriver <[hidden email]> wrote:
I know this is is somewhat of a bad question (because CGAL is a black box...) but, even if the progress bar is a complete lie (which it usually is for me) is there some way that I can tell that openSCAD is still doing something and hasn't stopped?

I ask because I have some simple test code:

module testTorus() {
  for (i = [0:360]) {
    translate([(20*cos(i)),(20*sin(i)),0]) {  
      rotate_extrude(angle=1, convexity=10){      
        translate([20,20,0]) {
          circle(r=10,$fn=5);
        }
      }
    }
  }
}

I ask it to run and I get "Rendering Polygon Mesh using CGAL..." and no other indication that things are progressing and just want to be sure it is still working.

Why am I doing things this very painful way when I could just rotate_extrude through 360 degrees?  This is just a simple test case to see if what I am doing will work.  When I actually implement things I will have the different slices each be slightly different.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

DanS
Is it also bad to use linear_extrude() in such a manner?
I've been doing that for some programs where I make very thin slices that change slightly.
Those programs run slowly too, but not quite this slowly.

I do have a  list of verticies but I may need some help in generating a toroidal slice (given that it is slightly thicker further away from the z axis, and my list of points is not necessarily simple).

On Sun, Oct 9, 2016 at 1:05 PM, nop head <[hidden email]> wrote:
Yes they are only one degree slices of tori.

On 9 October 2016 at 18:03, nop head <[hidden email]> wrote:
The only way to make things like that fast is to generate lists of vertices and faces and pass them to polyhedron. GCAL is too slow to union hundreds of objects.

On 9 October 2016 at 18:00, Dan Shriver <[hidden email]> wrote:
I want to make sure I understand your response.

When you say "tori" you don't mean each is a torus, but each is a slice of a torus, right?

I'm trying to make a torus of 360 slices, the goal being that if I can do that I can change each slice a little bit so the torus "morphs".

I have been doing this kind of thing with linear_extrude() and am just doing a test here to make sure my approach with rotate_extrude() is correct.

You are indicating that  it will be slow and painful the way I'm doing it.  Is there any way inside of OpenSCAD for me to make it faster (like rotate_extrude() does if it does the entire 360 itself) without decreasing the number of slices?

On Sun, Oct 9, 2016 at 12:32 PM, nop head <[hidden email]> wrote:
The only thing you are asking CGAL to do is union 360 overlapping tori, so that is what it will be trying to do. That will take a time approaching infinity as union is very slow especially with overlapping shapes with lots of vertices.

On 9 October 2016 at 17:05, Dan Shriver <[hidden email]> wrote:
I know this is is somewhat of a bad question (because CGAL is a black box...) but, even if the progress bar is a complete lie (which it usually is for me) is there some way that I can tell that openSCAD is still doing something and hasn't stopped?

I ask because I have some simple test code:

module testTorus() {
  for (i = [0:360]) {
    translate([(20*cos(i)),(20*sin(i)),0]) {  
      rotate_extrude(angle=1, convexity=10){      
        translate([20,20,0]) {
          circle(r=10,$fn=5);
        }
      }
    }
  }
}

I ask it to run and I get "Rendering Polygon Mesh using CGAL..." and no other indication that things are progressing and just want to be sure it is still working.

Why am I doing things this very painful way when I could just rotate_extrude through 360 degrees?  This is just a simple test case to see if what I am doing will work.  When I actually implement things I will have the different slices each be slightly different.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

nophead
In reply to this post by nophead
Actually the version of OpenScad I use doesn't have an angle parameter so they are full tori.

Linear extrude is fast because it doesn't use CGAL, but unioning anything with lots of vertices is very slow.

To make a torus you need to just rotate flat sections of vertices and connect them together with pairs of triangles to make the faces of the tube. The rotation of the flat points takes care of the faces being bigger further from the Z axis. See previous discussions about making 3D knots.

On 9 October 2016 at 18:05, nop head <[hidden email]> wrote:
Yes they are only one degree slices of tori.

On 9 October 2016 at 18:03, nop head <[hidden email]> wrote:
The only way to make things like that fast is to generate lists of vertices and faces and pass them to polyhedron. GCAL is too slow to union hundreds of objects.

On 9 October 2016 at 18:00, Dan Shriver <[hidden email]> wrote:
I want to make sure I understand your response.

When you say "tori" you don't mean each is a torus, but each is a slice of a torus, right?

I'm trying to make a torus of 360 slices, the goal being that if I can do that I can change each slice a little bit so the torus "morphs".

I have been doing this kind of thing with linear_extrude() and am just doing a test here to make sure my approach with rotate_extrude() is correct.

You are indicating that  it will be slow and painful the way I'm doing it.  Is there any way inside of OpenSCAD for me to make it faster (like rotate_extrude() does if it does the entire 360 itself) without decreasing the number of slices?

On Sun, Oct 9, 2016 at 12:32 PM, nop head <[hidden email]> wrote:
The only thing you are asking CGAL to do is union 360 overlapping tori, so that is what it will be trying to do. That will take a time approaching infinity as union is very slow especially with overlapping shapes with lots of vertices.

On 9 October 2016 at 17:05, Dan Shriver <[hidden email]> wrote:
I know this is is somewhat of a bad question (because CGAL is a black box...) but, even if the progress bar is a complete lie (which it usually is for me) is there some way that I can tell that openSCAD is still doing something and hasn't stopped?

I ask because I have some simple test code:

module testTorus() {
  for (i = [0:360]) {
    translate([(20*cos(i)),(20*sin(i)),0]) {  
      rotate_extrude(angle=1, convexity=10){      
        translate([20,20,0]) {
          circle(r=10,$fn=5);
        }
      }
    }
  }
}

I ask it to run and I get "Rendering Polygon Mesh using CGAL..." and no other indication that things are progressing and just want to be sure it is still working.

Why am I doing things this very painful way when I could just rotate_extrude through 360 degrees?  This is just a simple test case to see if what I am doing will work.  When I actually implement things I will have the different slices each be slightly different.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

wolf
You are expecting to write a program taking a long time to render on OpenSCAD. How fast do you want to be? And how much support do you expect from your software to create your shape in? If you want and need lots of support, ignore what I am saying, use OpenSCAD, and what my fellow contributors have to say here on this forum.

If you are truly interested in speed and can think on your own, the following will give you means of obtaining just that speed.
First, understand that OpenSCAD is slow by design, if not by intent. It uses the functional programming paradigm, meaning that the smallest assembly level programming step requires at least three cycles of the CPU clock: 1.fetch some data from memory and put it into a register, 2.work on it, 3. write the result to memory. And because ordinary memory is much slower than the CPU, memory access is buffered by caches, So, if you use large caches, your computer's level 1 cache (the only cache that can match the speed of the CPU, but is rather limited in size) overflows, and the CPU must add extra clock cycles waiting for the data to be fetched. With imperative programming, you can keep your data in memory and need not do step 3. That already makes your program run faster. Additionally, you waste less level 1 cache space, since all writes to memory and, eventually, the hard disk, moves through the level 1 cache, and your CPU need not wait as much for data to arrive. So you again gain speed.

Thus, for the fastest rendering speed, you forget about OpenSCAD and use an imperative language like C or Pascal. This gives you the best speed (I have achieved speedups of up to 30000 (thirty thousand) times where I used that approach.) Major disadvantage of this approach is that you also have to figure out a means to write an .stl file to disk - not too difficult a task. In my case, writing to disk a 200000 facet file took longer than rendering it. For viewing your file I would suggest you use MeshLab, as OpenSCAD is just too slow.

For an intermediate approach, may I suggest you look at the code I reported in my second posting in http://forum.openscad.org/Improve-rendering-speed-td17580.html#a17613. The idea is simple: create polygons (I call them slices, function CircularSlice) and arrange them in space (function TiltSlice_X and function MoveSlice). Once the polygons are where you want them, connect them into two lists of, first,  vertices, and then faces. Finally, call polyhedron() and create your shape.

What you should never do is use boolean operations inside a loop, that creates very long rendering times. The problem here is not that CGAL (the library that OpenSCAD uses to render) is very slow - that is just another excuse by the OpenSCAD developers. The problem is that if you want to calculate the coordinates of the point or line at which two facets intersect, you have to divide by the tangens of the intersection angle. And for perfectly smooth intersections, that angle is 180 degrees, and its tangens is zero. You get the problem? You have to find a way to do a division by zero. OpenSCAD "solves" that (more correctly, covers it up) with the $fn directive. The smaller $fn, the less smooth is your shape, the more is the actual intersecting angle away from 180 degree, and the smaller are the demands on numerical accuracy. CGAL tackles the demands on numerical accuracy by not relying on the physical size of registers at all. Rather, it uses what is called "Arbitrary Precision Arithmetic", which allows to do numerical operations at any accuracy you may desire. The price for that is execution time - the extra precision may easily slow down the computer by a factor of 1000. Both OpenSCAD and CGAL rely on boolean operations.

If you can think outside the box far enough to realize there are other mathematics operations that deal with division by zero, you are on track to understand what I am doing. As far as I know set theory, it can demonstrate that, in general, the result of a division by zero is undefined. But set theory cannot and does not show whether there are  exceptions from this rule. And these exceptions do exist. If you are familiar with Calculus, you know one branch of mathematics that routinely does divisions by zero.
The program I suggested does that division by zero by falling back upon Calculus (that's why I call it a Reverse Slicer), or more accurately, by falling back upon epsilontics, a branch of mathematics that deals explicitly with divisions by zero. As such, I don't need arbitrary precision arithmetic, and thus can replace unions with something much faster than what OpenSCAD uses. But currently I do not attempt to do differences or intersections.  First, I need to deal with the other nonsense that is lurking under the surface of OpenSCAD and that (some?) of the developers / users on this forum are so hard-set to keep.
To give you an idea on speed that has been achieved: Hull() is somewhat faster, about twice as fast as union() for the cases I investigated (two hours for union(), one hour for hull(), 11 seconds for above program, 0.1 seconds when doing it outside OpenSCAD). The 2D functions OpenSCAD offers I have never tried, they are too limited for my purposes.
wolf
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

Parkinbot
wolf wrote
Thus, for the fastest rendering speed, you forget about OpenSCAD and use an imperative language like C or Pascal. This gives you the best speed (I have achieved speedups of up to 30000 (thirty thousand) times where I used that approach.) Major disadvantage of this approach is that you also have to figure out a means to write an .stl file to disk - not too difficult a task. In my case, writing to disk a 200000 facet file took longer than rendering it. For viewing your file I would suggest you use MeshLab, as OpenSCAD is just too slow.
Again, and again you propagate this wild approach. High level approaches are versatile but slow. Hardcoding a problem with C or Assembler will of course be faster in execution. But it can take hours, days, weeks to code such a special solution. And any attempt to alter your design later on will bring you back to start forcing you to reinvent the wheel again an again. Might be fun for you, but not for others.
The stuff you are presenting is special cases and will work for non-self-intersecting designs only. As soon as non-linear extrusion comes into play you either have to go the VERY HARD way and implement Boolean operations on your own (this is what CGAL mainly is used for), or you use some tricky code to treat self-intersections (SI) that are known by analytic means.

This, at least from an OpenSCAD perspective, FAST code will give you an example: http://www.thingiverse.com/thing:1659079. It combines a general (ignorant) sweep with a union to get around a pre-analyzed SI problem in a viable way.

Rudolf

Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

nophead
Going back to the OP, unless I misunderstand the intention, the slices should be rotated into position, not translated with sine / cosine coordinates. 

On 10 October 2016 at 10:31, Parkinbot <[hidden email]> wrote:
wolf wrote
> Thus, for the fastest rendering speed, you forget about OpenSCAD and use
> an imperative language like C or Pascal. This gives you the best speed (I
> have achieved speedups of up to 30000 (thirty thousand) times where I used
> that approach.) Major disadvantage of this approach is that you also have
> to figure out a means to write an .stl file to disk - not too difficult a
> task. In my case, writing to disk a 200000 facet file took longer than
> rendering it. For viewing your file I would suggest you use MeshLab, as
> OpenSCAD is just too slow.

Again, and again you propagate this wild approach. High level approaches are
versatile but slow. Hardcoding a problem with C or Assembler will of course
be faster in execution. But it can take hours, days, weeks to code such a
special solution. And any attempt to alter your design later on will bring
you back to start forcing you to reinvent the wheel again an again. Might be
fun for you, but not for others.
The stuff you are presenting is special cases and will work for
non-self-intersecting designs only. As soon as non-linear extrusion comes
into play you either have to go the VERY HARD way and implement Boolean
operations on your own (this is what CGAL mainly is used for), or you use
some tricky code to treat self-intersections (SI) that are known by analytic
means.

This, at least from an OpenSCAD perspective, FAST code will give you an
example: http://www.thingiverse.com/thing:1659079. It combines a general
(ignorant) sweep with a union to get around a pre-analyzed SI problem in a
viable way.

Rudolf





--
View this message in context: http://forum.openscad.org/How-can-I-tell-what-OpenSCAD-is-doing-tp18632p18646.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

Parkinbot
nophead wrote
Going back to the OP, unless I misunderstand the intention, the slices
should be rotated into position, not translated with sine / cosine
coordinates.
 
I would say the OP was a rotate_extrude with a twist. A similar question in an other thread was how to produce a satellite twist within a twisted linear_extrude.
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

nophead
I can't test it because I don't have a an angle parameter but it seems like it would make 360 1 degree slices of a torus and place them in a circle. The problem is they will all be oriented at the same angle, so will not join up to form a torus.

On 10 October 2016 at 15:14, Parkinbot <[hidden email]> wrote:
nophead wrote
> Going back to the OP, unless I misunderstand the intention, the slices
> should be rotated into position, not translated with sine / cosine
> coordinates.


I would say the OP was a rotate_extrude with a twist. A similar question in
an other thread was how to produce a satellite twist within a twisted
linear_extrude.




--
View this message in context: http://forum.openscad.org/How-can-I-tell-what-OpenSCAD-is-doing-tp18632p18650.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

Parkinbot
In reply to this post by Parkinbot
I understood it as some kind of exercise. Let's say the sin/cos part is meant to produce a rotation. Doing that properly you'd get some (rough) moebius code

testTorus();
twists = 3;
// twists = 1;
module testTorus() {
  step = 1;
  for (i = [0:step:360])
      rotate([0, 0, i])
      rotate_extrude(angle=step, convexity=10){      
        translate([20,0,0])
       //rotate([0, 0, i/2*twists]) square([1,30], center=true);    
       rotate([0, 0, i/4*twists]) circle(10, $fn=4);
  }
}
 

or look at this hypocyloide approach

testTorus();
module testTorus() {
  step = 1;
  for (i = [0:step:360])
      rotate([0, 0, i])
      rotate_extrude(angle=step, convexity=10){      
        translate([20+5*sin(2*i),0,0])
       circle(10, $fn=4);
  }
}
to get


As results are unions of rough interpolations it will be fruitless (and a waste of CPU-time) to F6-render code like this.

Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

DanS

Yes it is a debugging/ proof of concept exercise.

In the real code each slice would vary a little.

But, aside from being wrong it blows up.  So i'll need to do it as verticies instead.   Do I need to tell OpenSCAD how to form triangles or does it automatically do that between adjacent polygon slices?

Also I'll probably want to do this instead of linear extruder too since that now takes 8 hours....

On Oct 10, 2016 10:55 AM, "Parkinbot" <[hidden email]> wrote:
I understood it as some kind of exercise. Let's say the sin/cos part is meant
to produce a rotation. Doing that properly you'd get some (rough) moebius
code


> testTorus();
> twists = 3;
> // twists = 1;
> module testTorus() {
>   step = 1;
>   for (i = [0:step:360])
>       rotate([0, 0, i])
>       rotate_extrude(angle=step, convexity=10){
>         translate([20,0,0])
>        //rotate([0, 0, i/2*twists]) square([1,30], center=true);
>        rotate([0, 0, i/4*twists]) circle(10, $fn=4);
>   }
> }

<http://forum.openscad.org/file/n18652/Unbenannt.png>
<http://forum.openscad.org/file/n18652/Unbenannt2.png>

or look at this hypocyloide approach


> testTorus();
> module testTorus() {
>   step = 1;
>   for (i = [0:step:360])
>       rotate([0, 0, i])
>       rotate_extrude(angle=step, convexity=10){
>         translate([20+5*sin(2*i),0,0])
>        circle(10, $fn=4);
>   }
> }

to get
<http://forum.openscad.org/file/n18652/Unbenannt1.png>

As results are unions of rough interpolations it will be fruitless (and a
waste of CPU-time) to F6-render code like this.





--
View this message in context: http://forum.openscad.org/How-can-I-tell-what-OpenSCAD-is-doing-tp18632p18652.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

Parkinbot
DanS wrote
Do I need to tell OpenSCAD how to form triangles or
does it automatically do that between adjacent polygon slices?
Yes and no!
For the yes-part: Yes, you need to define a proper polyhedron to get your fancy 3D object.
For the no-part: No, in many cases, like for general extrusion, you can use sweep(), or skin() (which is equivalent) functionality. Have a look at the "Threading" reference at Thingiverse I gave.

You feed sweep()/skin() with a vector of polygons (living in 3D) that describe your "thing" by a series of slices. Each "polygon" is represented as a vector of 3D points and has to be properly positioned in space, so that neither two polygons intersect. How you to get this? Define the polygon as 2D and then use affine transformations (translations, rotations, and scaling) to place it into 3D. There is no test for self-intersection. This is your own responsibility.
Sweep() will connect all polygons into a polyhedron and do the hard work for you. While this approach is quite mighty, you can only model non-self-intersecting extrusions with it. For a donut you'd produce to half-donuts and union them together. This is, what I did for the Threadings.

Rudolf
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

Ronaldo


2016-10-10 14:31 GMT-03:00 Parkinbot <[hidden email]>:

Sweep() will connect all polygons into a polyhedron and do the hard work for
you. While this approach is quite mighty, you can only model
non-self-intersecting extrusions with it. For a donut you'd produce to
half-donuts and union them together. This is, what I did for the Threadings.

You can do a donut with sweep.scad using the parameter closed=true. The first and last section are matched by its indices. You couldn't model a Moebius strip with it because the total twist for closed paths is a multiple of 360.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

Parkinbot
Ronaldo wrote
You can do a donut with sweep.scad using the parameter closed=true. The
first and last section are matched by its indices. You couldn't model a
Moebius strip with it because the total twist for closed paths is a
multiple of 360.
Well, I was referring to my Thingiverse post, which uses my very own version of sweep() from Naca_sweep.scad, which, like skin(), is somehow more flexible than the version in sweep.scad. For the difference, refer to https://github.com/openscad/list-comprehension-demos/issues/3

And, you say it: You couldn't model a Moebius strip with an odd number of windings with it. Isn't any moebius strip kinda donut?
Also a threading with slope > 0 can't be closed automatically.

Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

Alan Cox
In reply to this post by wolf
> following will give you means of obtaining just that speed.
> First, understand that OpenSCAD is slow by design, if not by intent. I

If you are going to worry about OpenSCAD performance then actually study
it first. If you are going to write long bogus posts then profile it and
study the profile data.

Alan

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How can I tell what OpenSCAD is doing?

Ronaldo
In reply to this post by Parkinbot
Parkinbot wrote
Well, I was referring to my Thingiverse post, which uses my very own version of sweep() from Naca_sweep.scad, which, like skin(), is somehow more flexible than the version in sweep.scad. For the difference, refer to https://github.com/openscad/list-comprehension-demos/issues/3
I know your approach but see it more as a powerful version of linear extrusion.
And, you say it: You couldn't model a Moebius strip with an odd number of windings with it. Isn't any moebius strip kinda donut?
Also a threading with slope > 0 can't be closed automatically.
The answer to your question is: yes and no. It has a genus if you conceive it with thickness. But to resemble a Moebius strip you must give it a total twist of 180 degree and this infeasible with Linde's closed sweeps.  
For threads, your approach is perfect. Linde's sweep.scad is useless unless you control twists and initial angle. And, of course, it is not closed.