Obstacle Object Service
Service for accessing Obstacle object. Obstacle objects can be loaded and its content modified and sent back to windPRO. Properties of the object can be found here TApiObjObstacle. A small example can be found below.
"""
Copyright 2023 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.0'), 'Ebeltoft - Denmark\\4.0')
project_path = os.path.join(working_dir, 'DEMO - Ebeltoft, DK.w40p')
_windproapi.start_windpro_random_port()
# Services
project_service = _windproapi.get_service('ProjectService')
objects_service = _windproapi.get_service('ObjectsService')
obj_obstacle_service = _windproapi.get_service('ObjObstacleService')
# Loading project
project_service.LoadFromFile(filename=project_path)
objs = objects_service.GetObjects(apiObjType='Obstacle')
# Loading are object specific data
obstacle_obj = obj_obstacle_service.GetObstacleObject(objs[0].Handle)
# Changing the depth and angle
obstacle_obj.Depth = 300
obstacle_obj.Angle = 16
nan_to_skipvalue(obstacle_obj)
obj_obstacle_service.SetObstacleObject(obstacle_obj)