Community Forum
ANVEL Licensing Options

Precipitation control via Python API?



  • I see that precipitation type, rate, and duration can be set via the UI. I also see that "Precipitation" is a property of the WeatherManager. Is there a way to manipulate this property via the Python API? Can it be done dynamically or does it need to be set at the start of simulation? Is this the only way to modify visibility or is there a more direct way?



  • @petersle said in Precipitation control via Python API?:

    I see that precipitation type, rate, and duration can be set via the UI. I also see that "Precipitation" is a property of the WeatherManager. Is there a way to manipulate this property via the Python API? Can it be done dynamically or does it need to be set at the start of simulation? Is this the only way to modify visibility or is there a more direct way?

    @petersle, good question! There is a way to manipulate these properties using the API, but the calls to find the properties are a bit obtuse. We're working on an example that we'll post here, but it will take a bit of time. Thanks for your patience!

    Regards,
    The ANVEL Team



  • Please find the aforementioned API script at https://wiki.anvelsim.com/index.php/Python_Example_Weather_Demo.

    Let us know if you have any questions.



  • Excellent. Thank you for that.

    I have a follow-up question about fog. I can find the different fog properties under OgreRenderer in the UI. I can set some of these parameters before starting a simulation and they seem to hold on for a few moments. Is there a way to fix these so they don't change, namely the Fog Mode and the Fog Density?



  • Hi.
    Many properties under the OgreRenderer that control the weather and ambient lighting are updated by the environment manager and thus these properties will update automatically if edited. This behavior can be worked around, at least for the fog scenario that you are asking about, by doing the following:

    • In the Properties pane, locate the Environment property. Modify the "Use Dynamic Sunlight" and "Use Dynamic Ambient Light" properties to False.

    • Set the DefaultWeather property to Rain or Snow, either of which will automatically edit the Fog Mode and Fog Density properties under OgreRenderer. Then, under Environment > Weather, locate the RainPrecipitation (or SnowPrecipitation) property and set the Magnitude value to 0. This will leave the fog without generating precipitation.

    Thank you.

    ANVEL Support