Control Point Object ServiceΒΆ
For accessing control points in windPRO. Control points can be loaded with a Get method and send back to windPRO wiht a Set method. Three different point types can be set that are listed below.
An example for using the control point 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'), 'ObjCtrlPointService')
os.makedirs(working_dir, exist_ok=True)
project_path = os.path.join(working_dir, 'ObjCtrlPointService.w36p')
_windproapi.start_windpro_random_port()
# Project service for making a new project
project_service = _windproapi.get_service('ProjectService')
objects_service = _windproapi.get_service('ObjectsService')
obj_ctrl_point_service = _windproapi.get_service('ObjCtrlPointService')
# Project path and location
lng = 10.
lat = 55.
# Making a new empty project and saving it
project_service.NewProject(lng=lng, lat=lat, filename=project_path)
# Make new control point object
obj = objects_service.AddObject(apiObjType='CtrlPoint',
lat=55.,
lng=10.,
userDesc='New CtrlPoint')
# Get object with more detail
ctrl_point_obj = obj_ctrl_point_service.GetCtrlPointObject(obj.Handle)
print(ctrl_point_obj)
# Modify object
ctrl_point_obj.UncertaintyHorz = 1000
ctrl_point_obj.UncertaintyVert = 1000
ctrl_point_obj.CtrlPointType = 'ApicptUncertainty'
ctrl_point_obj.Color.Green = 0
# Sending changes back to windPRO
nan_to_skipvalue(ctrl_point_obj)
obj_ctrl_point_service.SetCtrlPointObject(ctrl_point_obj)