Commit e791eba9 authored by Bognár, Á.'s avatar Bognár, Á.
Browse files

Add wrapper function for create_sensor_points()

to make certain repetitive workflows shorter to implement
parent 98d18ffe
This is the Daypym Package.
# print('Daypym init happens')
......@@ -463,3 +463,29 @@ def ds_ds_illum(p_name, hea_file_name=None):
cstr = r'ds_illum {} -dds'.format(hea_file_name)
### Wrapper functions to onelinify certain workflows:
def pointgrid_over_surface(surface, d=5, edges=True, sp_offset=0.01):
"""Wrapper function for create_sensor_points(). Inputs:
surface: IDF urface (via geomeppy), d: desired point density sps/m2
edges: bool to decide if we want poits on the edge of the surface,
sp_offset: offset of sensorpoints from teh surface in m. Returns a dict:
{'surf_name':surface name, 'sensor_points':list of sensor points,
'ri':row_index, 'ci':col_index, 'sp_ori':list of normal vectors}."""
# make poly from idf (daypym)
poly = IDFsurf_to_poly(surface=surface)
# translate poly to the x-y plane (geomeppy)
poly_trans = align_face(poly).order_points('upperleftcorner')
# make the poly 2D (geomeppy)
poly_trans_2d = poly_trans.project_to_2D()
# make a 2d bbox of the translated surface on the xy pane (geomeppy)
poly_trans_bbox_2d = poly_trans.bounding_box.project_to_2D()
# make a 2D test grid on the x-y plane (daypym)
test_grid = grid_2d(bbox_2d=poly_trans_bbox_2d, d=d, edges=edges)
# makes a list of points, that are inside the 2D poly (daypym)
pip = gridpoints_in_poly_2d(grid_2d=test_grid, poly_2d=poly_trans_2d)
# sensor point data dict (daypym)
sp = create_sensor_points(surf_name=surface['Name'], points_in_poly_2d=pip,
row_index=[0], col_index=[0], original_poly=poly, sp_offset=sp_offset,
return sp
......@@ -4295,4 +4295,3 @@ Output:Variable,
SimpleAndTabular; !- Option Type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment