Obstacle Object ServiceΒΆ

Service for accessing Obstacle object. Obstacle objects can be loaded and its content modified and sent back to windPRO. A small example can be found below.

import time
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('3.6'), 'Ebeltoft - Denmark\\3.6')
project_path = os.path.join(working_dir, 'DEMO - Ebeltoft, DK.w36p')

_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)