[OpenSCAD] Configuration selection

Michael Frey michael.frey at gmx.ch
Thu Sep 13 16:20:34 EDT 2018

Hi Dan,

I see two practical approaches:

*Approach 1:*
If you don´t mind Development snapshoots, try our customizer.
You can get those snapshoots from http://www.openscad.org/downloads.html
You also have to go into the preferences and enable the customzier.

In the customizer you can handle your configurations as so called presets.


*Approach 2:*
If you want to stay on the release line of openscad:
I would write a "base_model.scad" (or something like that), which is let 
us say model default:
     dim_a = 5;
     dim_b = 6;
     //lots of code that creates the actual model

For model b, I would create a file called "model_b.scad" and then simply
     include <base_model.scad>;
     dim_a = 1;
     dim_b = 2;

For model b, I would create a file called "model_b.scad" and then simply
     include <base_model.scad>;
     dim_a = 3;
     dim_b = 4;

The trick is, that the last assignment overwrites any previous 
assignments to a variable.

Every model has then its own file.
Most of the code being in base_model.scad.
The other files only need to overwrite the variables.

Depending on what you really want/need, use might also be an option.
But when you use "use", you need a bit more code for each configuration.

see also 

With Kind regards,
Michael Frey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180913/58d60163/attachment.html>

More information about the Discuss mailing list