[OpenSCAD] Configuration selection

TLC123 torleif.ceder at gmail.com
Fri Sep 14 04:09:36 EDT 2018


Assign values to dim_a and dim_b separately. 
Use the  Ternary conditional operator - ?: 
usage:
/condition expression/ ? /expression if true /: /expression if false/ ;

In this case one ternary operation is nested inside one other. 

    model = 'A';
    
      dim_a = (model == 'A') ? 1:(model == 'B')?3:5;
      dim_b = (model == 'A') ? 2:(model == 'B')?4:6;

 // "let" dim_a= "if"(model == 'A')? "then" 1 : "else if"(model == 'B')?
"then" 3: "else" 5



--
Sent from: http://forum.openscad.org/



More information about the Discuss mailing list