[OpenSCAD] BOM generation; SolidPython available
Giles Bathgate
giles.bathgate at gmail.com
Wed Mar 9 18:32:12 CET 2011
On 9 March 2011 17:23, nop head <nop.head at gmail.com> wrote:
> On 9 March 2011 16:46, Evan T. Jones <evan_t_jones at mac.com> wrote:
>> Having been in your shoes, ("I've written this OpenSCAD code. Now I want
>> to do something else fancy. Oh... it's really hard to do that in OpenSCAD")
>> I think the best route forward in the future is to write code in a general
>> purpose language.
>
> Yes I agree. I do like the openscad syntax for creating models though.
Hurrah!
I don't think its right to promote my own project, on someone else's
mailing list, but since others already have:
RapCAD can already mostly do what you want, and I would think by the
time its finished, it will do exactly what you want
total=0;
parts="";
module update_bom(cost,name){
total=total+cost;
parts=parts+name+"\n";
}
module mypart(){
update_bom(0.05,"mypart");
sphere(r=10);
cylinder(h=10,r=5);
}
module myotherpart(){
update_bom(10.5,"myotherpart");
}
module myassembly()
{
mypart();
myotherpart();
}
myassembly();
echo("--- Bill of Materials ---\n");
echo(parts);
echo("Total cost: ",total);
echo("\n-------------------------\n");
This then produces the following output:
giles at masala:~$ rapcad-build-desktop/rapcad -f bom.rcad
--- Bill of Materials ---
mypart
myotherpart
Total cost: 10.55
-------------------------
Sure python @decorators are nice, but you would have to convert all
your scad scripts to pyscad scripts.
Anyway nophead, have a look at http://www.rapcad.org
Regards
Giles
More information about the OpenSCAD
mailing list