Hello,
One day we will get there I hope. Meanwhile you should generate the objects
separately and export one at time.
Eventually using a python script and calling OpenSCAD in command mode you
can do that, but I'm not a python/programmer specialist so I can't tell you
how to.
The way I'm seeing it is to create a module for the "actions" and then
generate the set of objects as children.
If you search the forum for "export from script" you will find some threads
about the subject.
Cheers
jpmendes
--
View this message in context: http://forum.openscad.org/Export-seperate-objects-tp16373p16374.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
phlipp wrote:
I could not find any solution for that, so I hope to get any help here.
Taking the
following code for example:
for(x=[0:10:40]) translate([x, 0, 0]) {
cube(center=true, size=5);
}
As expected, it generates four cubes.
five, actually...
If I export that as *.stl and import it into
blender, it appears as one single Object, having a »four cube
geometry«.
The simple solution in OpenSCAD is to create and export each part
separately. But if you insist on doing it in one go, you need to use
another tool. AngelScript CSG can do it:
==========
shape@ main_shape()
{
solid@[] shapes;
for(int i=0;i<5;i++) {
double x = 10+i*10;
shapes.push_back(translate(x,0,0)*cube(center:true,size:5));
shapes[i].write_csg(GetOutputFullPath('part'+i+'.csg'));
}
return union3d(shapes);
}
void main()
{
shape@ obj = main_shape();
obj.write_csg(GetOutputFullPath('.csg'));
}
===============
This generates messages:
Created OpenSCAD file: ..\samples\separate_example.part1.csg
Created OpenSCAD file: ..\samples\separate_example.part2.csg
Created OpenSCAD file: ..\samples\separate_example.part3.csg
Created OpenSCAD file: ..\samples\separate_example.part4.csg
Created OpenSCAD file: ..\samples\separate_example.part5.csg
Created OpenSCAD file: ..\samples\separate_example.csg
I.e. one OpenSCAD file per part + one with all as in your original
example. The above will run in the latest public version
http://arnholm.org/using-angelscript-csg/ . You would still use OpenSCAD
for creating STL for each part.
[ In an upcoming version it will be possible to use named parameters
similar to your example, i.e. it would become: cube(center:true,size:5))
]
Carsten Arnholm