Hi there,
I need to make some things from many layers of acrylic. I want to be able
to neatly 3 D render as I go.
I will make each layer as its own module. There will be some copy/paste.
I wonder if I can automate calling the modules using a string somehow?
This was my optimistic attempt which failed...
module layer_1()
{
difference()
{
circle(outer_diameter/2);
circle(outer_diameter/2-wall_thickness);
}
}
module 3d_render()
{
for (i=[0:10])
translate([0,0,iacrylic_thickness+iexplode_by_mm])
linear_extrude(acrylic_thickness)
{
str("layer_",i,"();");
}
}
3d_render();
Thanks!
Alex
...is there maybe a way I could store the module names in an array, and
recall them using string?
On 1 November 2017 at 13:27, Alex Gibson alex@alexgibson.net wrote:
Hi there,
I need to make some things from many layers of acrylic. I want to be able
to neatly 3 D render as I go.
I will make each layer as its own module. There will be some copy/paste.
I wonder if I can automate calling the modules using a string somehow?
This was my optimistic attempt which failed...
module layer_1()
{
difference()
{
circle(outer_diameter/2);
circle(outer_diameter/2-wall_thickness);
}
}
module 3d_render()
{
for (i=[0:10])
translate([0,0,iacrylic_thickness+iexplode_by_mm])
linear_extrude(acrylic_thickness)
{
str("layer_",i,"();");
}
}
3d_render();
Thanks!
Alex
Something like this should be possible:
3d_render() {
// layer 1
difference() { circle(outer_diameter/2);
circle(outer_diameter/2-wall_thickness); }
// layer 2
...
}
module 3d_render() {
for (i=[0:10])
translate(...i...) linear_extrude(...) children(i);
}
On 1 November 2017 at 09:27, Alex Gibson alex@alexgibson.net wrote:
Hi there,
I need to make some things from many layers of acrylic. I want to be able
to neatly 3 D render as I go.
I will make each layer as its own module. There will be some copy/paste.
I wonder if I can automate calling the modules using a string somehow?
This was my optimistic attempt which failed...
module layer_1()
{
difference()
{
circle(outer_diameter/2);
circle(outer_diameter/2-wall_thickness);
}
}
module 3d_render()
{
for (i=[0:10])
translate([0,0,iacrylic_thickness+iexplode_by_mm])
linear_extrude(acrylic_thickness)
{
str("layer_",i,"();");
}
}
3d_render();
Thanks!
Alex
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
use solidpython or rubyscad.
you can do a lot of things there that you just cannot do in openscad itself.
and once you have created what you want, then do a render to a file.
--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Openscad developer
The most exciting phrase to hear in science - the one that heralds new
discoveries - is not "Eureka!" but "That's funny...".- Isaac. Asimov
On Wed, Nov 1, 2017 at 6:40 AM, doug moen doug@moens.org wrote:
Something like this should be possible:
3d_render() {
// layer 1
difference() { circle(outer_diameter/2); circle(outer_diameter/2-wall_
thickness); }
// layer 2
...
}
module 3d_render() {
for (i=[0:10])
translate(...i...) linear_extrude(...) children(i);
}
On 1 November 2017 at 09:27, Alex Gibson alex@alexgibson.net wrote:
Hi there,
I need to make some things from many layers of acrylic. I want to be
able to neatly 3 D render as I go.
I will make each layer as its own module. There will be some copy/paste.
I wonder if I can automate calling the modules using a string somehow?
This was my optimistic attempt which failed...
module layer_1()
{
difference()
{
circle(outer_diameter/2);
circle(outer_diameter/2-wall_thickness);
}
}
module 3d_render()
{
for (i=[0:10])
translate([0,0,iacrylic_thickness+iexplode_by_mm])
linear_extrude(acrylic_thickness)
{
str("layer_",i,"();");
}
}
3d_render();
Thanks!
Alex
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
I do something similar when doing step by step building instructions.
Basically, I have a main drawing module, which looks like this:
module drawsteps(){
if(currentstep==1){
}
if(currentstep>=1){
}
if(currentstep==2){
}
if(currentstep>=2){
}
}
Then, I put all the drawing in separate modules, and call them from this
module. The reason I have == and >= is that I often have stuff that will
only be that way for a single frame (such as screws being shown not screwed
in fully), and then I use >= for the stuff that should remain in the
following frames.
--
Sent from: http://forum.openscad.org/