How OpenSCAD for Mac to export multiple portions from a script?

OpenScad not interactive modeler. Instead, it is similar to 3D compiler that reads a script file that describe the object and render 3D models from the script file. How OpenSCAD for Mac to export more parts of it from a script? Let us explain.

17264662-7e319737134afadb.jpeg

OpenSCAD for Mac (3D modeling software) 2019.0.5 Free Portal

How OpenSCAD for Mac to export multiple part tutorial from a script

One way to generate them pile geometry derived from a single script as STL file without comments / annotation cancel code.

A variable PARTNO, for indicating the current operating member being exported. If PARTNO is 'undef', it is not exported anything.

PARTNO = undef; // default Part Number

module tree(){

Color ( "green") of the cylinder (r1 = 12, r2 = 1, h = 30);

// ...

}

module trunk(){

Color ( "Brown") of the cylinder (r = 3, h = 10);

// ...

}

module base(){

color(“white”)translate([ -  10,-10,0])cube([20,20,5]);

// ...

}

if(PARTNO == 1)tree();

if(PARTNO == 2)trunk();

if(PARTNO == 3)base();

// 0 for the whole object can choose to use

if(PARTNO == 0){

basis();

translate([0,0,5])trunk();

translate([0,0,15])tree();

}

An interactive work, PARTNO variable at the top of the file can be set from the GUI display / export number of components.

By writing shell scripts on Linux or MacOS or write a batch file on Windows, you can automatically export all components. shell script looks like this:

STL export to the part #

openscad -DPARTNO = 1 -o tree.stl model.scad

openscad -DPARTNO = 2 -o trunk.stl model.scad

openscad -DPARTNO = 3 -o base.stl model.scad

# Export images all combinations of parts

openscad -DPARTNO = 0 -o model.png model.scad

These are the answers to how OpenSCAD for Mac to export more than part of the problem from a script, I hope you can help.

Reproduced in: https: //www.jianshu.com/p/a96433c03ff3

Guess you like

Origin blog.csdn.net/weixin_34000916/article/details/91259117
Recommended