Displaying concentric circles

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Displaying concentric circles

rglissmann
I want to create a SVG that will display concentric circles. OpenSCAD will only show the largest circle. Is there a way to do this?

for (a = [1, 5]){
   circle(r=a);  
    }

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Displaying concentric circles

fred_dot_u
A couple items here. One is the separator is a colon :

The other is you are creating a circle with a solid center, making the inner ones invisible.

I used a difference to subtract a circle of 0.25 smaller diameter, keeping the outside diameter to your formula:

$fn = 90;
for (a = [1 : 5]){
    difference(){
        circle(r = a); 
        circle(r = a - 0.25);
    }
}

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Displaying concentric circles

MichaelAtOz
Administrator
In reply to this post by rglissmann
OpenSCAD produces 2D geometry, a circle in a circle is just a circle.

If you want to do concentric rings you will need to remove (difference) inner circles.

difference() {
  circle(40);
  circle(35);
}
Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Displaying concentric circles

MichaelAtOz
Administrator
Beat me by 3 min...
Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Displaying concentric circles

shadowwynd
In reply to this post by rglissmann
The short answer is no. OpenSCAD performs a top-level union. Since your largest circle encompasses the smaller ones, you are always left with one big circle.

You can approximate it using a difference.  This creates nonintervention thin shells.

for (a=[1,5])
{
     difference()
     {
          circle (r=a);
          circle (r=a-0.1);
     }
}

Sent from my iPhone

> On Jul 26, 2017, at 6:27 PM, rglissmann <[hidden email]> wrote:
>
> I want to create a SVG that will display concentric circles. OpenSCAD will
> only show the largest circle. Is there a way to do this?
>
> for (a = [1, 5]){
>   circle(r=a);  
>    }
>
> Thanks
>
>
>
> --
> View this message in context: http://forum.openscad.org/Displaying-concentric-circles-tp21939.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
|  
Report Content as Inappropriate

Re: Displaying concentric circles

rglissmann
The application is creating gcode files for CNC and the overlapping circles was just an example of my problem. If it's impossible, I'll need to selectively display and create several SVGs of my design. Not the best solution, but it works.

On Wed, Jul 26, 2017 at 4:45 PM Ezra Reynolds <[hidden email]> wrote:
The short answer is no. OpenSCAD performs a top-level union. Since your largest circle encompasses the smaller ones, you are always left with one big circle.

You can approximate it using a difference.  This creates nonintervention thin shells.

for (a=[1,5])
{
     difference()
     {
          circle (r=a);
          circle (r=a-0.1);
     }
}

Sent from my iPhone

> On Jul 26, 2017, at 6:27 PM, rglissmann <[hidden email]> wrote:
>
> I want to create a SVG that will display concentric circles. OpenSCAD will
> only show the largest circle. Is there a way to do this?
>
> for (a = [1, 5]){
>   circle(r=a);
>    }
>
> Thanks
>
>
>
> --
> View this message in context: http://forum.openscad.org/Displaying-concentric-circles-tp21939.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

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

Re: Displaying concentric circles

Gadgetmind
In reply to this post by fred_dot_u
On 2017-07-26 23:35, fred_dot_u wrote:
> A couple items here. One is the separator is a colon :

Usually, but [1, 5] will go through to the loop twice with a equal to
first 1 and then 5, which is useful at times.


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

Re: Displaying concentric circles

algotruneman
In reply to this post by rglissmann
On 07/26/2017 06:27 PM, rglissmann wrote:

> I want to create a SVG that will display concentric circles. OpenSCAD will
> only show the largest circle. Is there a way to do this?
>
> for (a = [1, 5]){
>     circle(r=a);
>      }
>
> Thanks
>
>
>
> --
> View this message in context: http://forum.openscad.org/Displaying-concentric-circles-tp21939.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

Maybe it would be easier to make the concentric circles using Inkscape
to generate the SVG which can then be exported to OpenSCAD using the
library from Drew Newman https://www.thingiverse.com/thing:25036.


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

Re: Displaying concentric circles

Parkinbot
In reply to this post by rglissmann
Generally spoken, OpenScad is not the right language to produce Gcode, as Gcode is always target machine dependent. For simple stuff like circles try http://www.intuwiz.com/circle.html and see what you get.

Well, if you know what you do, you indeed can use OpenSCAD to design "flat" and "line-like" 3D objects, export them as STL and abuse a slicer tool to generate Gcode from that. Say you want to have your 5 circles with 1 to 5 cm radius then your code would be something like this:

$fa = .2;  // resolution
for (a = [10:10:50])
{
   difference()    // use line thickness of 0.5mm for single line slicing
   {
     cylinder(r=a+.25, h=.5, center=true);
     cylinder(r=a-.25, h=.6, center=true);  
   }
}
after F6 and export as STL, you can use a slicer to do the dirty work. A slicer uses a profile to adopt its code to the target machine. It outputs a text file and you can use any editor to find what you are trying to find, if you know what you are looking for. Of course you should study G-Code a bit, but the sematics is quite simple and straight forward.

For the above code my kisslicer (which uses the profile for my 3D Printer) produced the following circle code (find the raw file attached):

G1 X122.18 Y118.94 E15.8864 F1200
G1 X123.65 Y117.02 E15.9503
G1 X125.65 Y114.09 E16.0439
G1 X126.85 Y112.08 E16.1058
G1 X128.42 Y109.06 E16.1955
G1 X129.41 Y106.86 E16.2594
G1 X130.5 Y104.03 E16.3394
G1 X131.35 Y101.37 E16.413
G1 X131.87 Y99.42 E16.4665
G1 X132.33 Y97.37 E16.5219
G1 X132.68 Y95.45 E16.5734
G1 X132.94 Y93.59 E16.6229
G1 X133.21 Y90.53 E16.7042
G1 X133.32 Y87.42 E16.7862
G1 X133.28 Y85.48 E16.8376
G1 X133.13 Y83.2 E16.898
... and so on.
The E Parameter is the Extrusion and the F parameter the speed. It depends on your target machine, whether it just ignores it. Also you should add a G0 X122.18 Y118.94 and some other code to instruct your targetmachine to do what you want it to do before and after each circle.

Here is the raw gcode file:  test.gcode
Loading...