[OpenSCAD] Function to return the Opposite value

Bryan Lee leebc11 at acm.org
Thu Oct 31 14:16:09 EDT 2019


Thanks for the replies guys!

@MichaelAtOz
>   notThing = ( (isThing == 0) ? 1 : 0);

Unfortunately, this produces a booleen.


@Troberg
> oppositething=1-thing;

Brilliant!   I knew there had to be an easy math way to do it.


@Alex Gibson
>       oppositeThing = 1-isThing;
> I sometimes also use this as a dirty way of enabling or disable whole chunks
> of code, by putting it within a scale fubction 

Still brilliant.  That's what I plan on doing with it, enable and disable
chunks of translation code.  ;-)



More information about the Discuss mailing list