Shadow Object Service
Service for accessing shadow objects. Shadow receptor objects can be loaded and its content modified and sent back to windPRO. Properties of the object can be found here TApiObjShadow. A small example can be found below.
import time
"""
Copyright 2024 EMD International
License for this script: MIT https://opensource.org/license/mit/
License for windPRO commercial software: https://www.emd-international.com/contact-us/general-terms-conditions-sale/
"""
import os
from windproapi.utils import get_windpro_sample_path
from windproapi import WindProApi
from windproapi import nan_to_skipvalue
# Opening windPRO
_windproapi = WindProApi()
working_dir = os.path.join(get_windpro_sample_path('4.1'), 'Ebeltoft - Denmark', '4.1')
project_path = os.path.join(working_dir, 'DEMO - Ebeltoft, DK.w41p')
_windproapi.start_windpro_random_port()
# Services
project_service = _windproapi.get_service('ProjectService')
objects_service = _windproapi.get_service('ObjectsService')
obj_shadow_service = _windproapi.get_service('ObjShadowService')
# Loading project
project_service.LoadFromFile(filename=project_path)
objs = objects_service.GetObjects(apiObjType='Shadow')
# Loading are object specific data
shadow_obj = obj_shadow_service.GetShadowObject(objs[0].Handle)
# Changing height of window and height above ground
shadow_obj.Height = 2
shadow_obj.HeightAboveGround = 4.0
# Changing the direction of the window. Watch out, this is in the same coordinate system as the wind direction whereas
# it is in degree from south in windPRO
shadow_obj.AngleShadow = 210
nan_to_skipvalue(shadow_obj)
obj_shadow_service.SetShadowObject(shadow_obj)