LBNL-ETA / pyWinCalc

Other
19 stars 10 forks source link

(not an issue, a question) Flipping a layer imported as an optics file #29

Closed aegis1980 closed 1 year ago

aegis1980 commented 2 years ago

If I import a glass layer from an optics file, can I flip it programmatically?

StephenCzarnecki commented 1 year ago

Once you create a GlazingSystem you should be able to flip any layer by using the flip_layer method. That takes the index (0-based) of the solid layer to flip as the first parameter and a bool indicating whether the layer is to be treated as flipped or not.

Since you just mention glass layers and optics files I assume you are not doing any BSDF-defined shades correct? In WINDOW those are "Shade with XML data" in the shading layer library:

image

If you are doing anything with those let us know because I am not sure what exactly flipping one of those means or to what degree it is supported but can look into it if it is something you will be using.

A quick note for clarity: Calling flip_layer twice (or however many times) on the same layer with a value of true should result in a layer that is reversed from whatever the original data was. It does not flip back and forth each time flip_layer is called with a value of true.

For example:

glazing_system.flip_layer(0, true) # First solid layer is treated as reversed from what the glazing system was constructed with
glazing_system.flip_layer(0, true) # First solid layer is still treated as reversed from what the glazing system was constructed with.
glazing_system.flip_layer(0, false) # First solid layer is now treated the same as what the glazing system was constructed with
aegis1980 commented 1 year ago

Perfect! I had been looking for a method on the layer rather then the glazing_system. I had a jerry-rigged solution swapping the rf and rb values in wavelength data in optics file and some other bits and bobs, to same effect (I think). Proper approach better of course! Not thinking about shades (yet!)