py4design.urbangeom module¶
-
py4design.urbangeom.
generate_sensor_surfaces
(occface, xdim, ydim, distance_offset=0.01)¶ This function generates a gridded face from an OCCface, the gridded faces are not on the OCCface but moved in the face normal direction.
Parameters: occface : OCCface
OCCface to be gridded
xdim : float
The x-dimension of each grid.
ydim : float
The y-dimension of each grid.
distance_offset : float, optional
The distance moved in the direction of the face normal, Default = 0.01.
Returns: sensor faces : list of OCCfaces
List of OCCfaces of the grid.
sensor points : pyptlist
The mid point of each grid. Pyptlist is a list of tuples of floats. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z), thus a pyptlist is a list of tuples e.g. [(x1,y1,z1), (x2,y2,z2), …]
sensor directions : pyveclist
Pyveclist is a list of tuples of floats. A pyvec is a tuple that documents the xyz coordinates of a direction e.g. (x,y,z), thus a pyveclist is a list of tuples e.g. [(x1,y1,z1), (x2,y2,z2), …]
-
py4design.urbangeom.
landuse_2_grid
(landuse_occface, xdim, ydim)¶ This function generates a gridded face from an OCCface.
Parameters: occface : OCCface
OCCface to be gridded
xdim : float
The x-dimension of each grid.
ydim : float
The y-dimension of each grid.
Returns: grid points : pyptlist
The mid point of each grid. Pyptlist is a list of tuples of floats. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z), thus a pyptlist is a list of tuples e.g. [(x1,y1,z1), (x2,y2,z2), …]
grid faces : list of OCCfaces
List of OCCfaces of the grid.
-
py4design.urbangeom.
identify_srfs_according_2_angle
(occface_list)¶ This function identify if a OCCface is a roof, wall, or floor depending on the angle of its normal.
Parameters: occface_list : a list of OCCfaces
List of OCCfaces that will be analysed.
Returns: facades : list of OCCfaces
List of OCCfaces identified as facade, angle of normal between 45 < n < 170, with reference to the up direction (0,0,1).
roofs : list of OCCfaces
List of OCCfaces identified as roof, angle of normal between n<=45 , with reference to the up direction (0,0,1).
floors : list of OCCfaces
List of OCCfaces identified as floors, angle of normal between n>=170 , with reference to the up direction (0,0,1).
-
py4design.urbangeom.
identify_surface_direction
(occface_list)¶ This function identify if a OCCface is facing north, south, east and west depending on the angle of its normal. The y-direction is assumed as north.
Parameters: occface_list : a list of OCCfaces
List of OCCfaces that will be analysed.
Returns: north facades : list of OCCfaces
List of OCCfaces identified as facing north, angle of normal between 0 <= n <= 45 and n >= 315, with reference to the y direction (0,1,0).
south facades : list of OCCfaces
List of OCCfaces identified as facing south, angle of normal between 135 <= n <= 225, with reference to the y direction (0,1,0).
east facades : list of OCCfaces
List of OCCfaces identified as facing east, angle of normal between 225 < n < 315, with reference to the y direction (0,1,0).
west facades : list of OCCfaces
List of OCCfaces identified as facing west, angle of normal between 45 < n < 135, with reference to the y direction (0,1,0).
-
py4design.urbangeom.
faces_surface_area
(occface_list)¶ This function measures the total surface area of the list of OCCfaces.
Parameters: occface_list : a list of OCCfaces
List of OCCfaces that will be analysed.
Returns: total surface area : float
The total surface area of all the OCCfaces summed up.
-
py4design.urbangeom.
extrude_move_down_occ_faces
(occface_list, distance=1)¶ This function moves the OCCfaces down a distance from its original position and extrude the OCCfaces.
Parameters: occface_list : a list of OCCfaces
List of OCCfaces that will be analysed.
distance : float
The distance moved by the OCCface.
Returns: list of extruded solids : list of OCCsolids
The list of extruded OCCsolids.
-
py4design.urbangeom.
redraw_occfaces
(occface_list)¶ This function redraws all the OCCfaces.
Parameters: occface_list : a list of OCCfaces
List of OCCfaces to be redrawed.
Returns: list of redrawn faces : list of OCCfaces
The list of redrawn OCCfaces.
-
py4design.urbangeom.
reconstruct_bldg_shell
(bldg_occshell)¶ This function reconstructs the OCCshell.
Parameters: occshell : OCCshell
OCCshell to be reconstructed.
Returns: reconstructed shell : OCCshell
The reconstructed OCCshell.
-
py4design.urbangeom.
is_shell_faces_planar
(occshell)¶ This function identify if all OCCfaces in the OCCshell are planar.
Parameters: occshell : OCCshell
OCCshell to be analysed.
Returns: is planar : bool
True or False, if True OCCshell is planar, if False OCCshell not planar.
-
py4design.urbangeom.
is_shell_simple
(occshell)¶ This function check if the OCCshell is simple. Simple is defined as having less than 6 surfaces.
Parameters: occshell : OCCshell
OCCshell to be analysed.
Returns: is planar : bool
True or False, if True OCCshell is simple, if False OCCshell not simple.
-
py4design.urbangeom.
identify_open_close_shells
(occshell_list)¶ This function identify if the OCCshells are open or closed.
Parameters: occshell_list : a list of OCCshells
List of OCCshells to be analysed.
Returns: list of closed shell : list of OCCshells
The list of closed OCCshells.
list of open shell : list of OCCshells
The list of open OCCshells.
-
py4design.urbangeom.
reconstruct_open_close_shells
(occshell_list)¶ This function recombines all the OCCfaces in the OCCshells , and rearrange the OCCfaces into new OCCshells. This is to check if there are e.g. two open shells that can be recombined to form a closed shell.
Parameters: occshell_list : a list of OCCshells
List of OCCshells to be analysed and recombined.
Returns: list of recombined shell : list of OCCshells
The list of recombined OCCshells.
-
py4design.urbangeom.
identify_building_surfaces
(bldg_occsolid)¶ This function identifies all the OCCfaces in a OCCsolid as a roof, wall, or floor depending on the angle of its normal.
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be analysed.
Returns: facades : list of OCCfaces
List of OCCfaces identified as facade, angle of normal between 45 < n < 170, with reference to the up direction (0,0,1).
roofs : list of OCCfaces
List of OCCfaces identified as roof, angle of normal between n<=45 , with reference to the up direction (0,0,1).
floors : list of OCCfaces
List of OCCfaces identified as floors, angle of normal between n>=170 , with reference to the up direction (0,0,1).
-
py4design.urbangeom.
get_bldg_footprint_frm_bldg_occsolid
(bldg_occsolid, tolerance=1e-05, roundndigit=6, distance=0.1)¶ This function gets the footprint of a building.
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be analysed.
tolearnce : float, optional
The tolerance used for the analysis, the smaller the float it is more precise. Default = 1e-05.
roundndigit : int, optional
The number of decimal places of the xyz of the points for the boolean section function, Default = 6. The higher the number the more precise are the points. Depending on the precision of the points, it will decide whether the edges are connected.
distance : float, optional
The smallest distance between two points from the edges for boolean section function, Default = 0.01. The further the distance the less precise is the resultant faces.
Returns: footprints : list of OCCfaces
List of OCCfaces identified as footprints.
-
py4design.urbangeom.
get_building_roofplates
(bldg_occsolid, nstorey, storey_height, tolerance=1e-05, roundndigit=6, distance=0.1)¶ This function gets the roof plate of a building, roof plates in this function is defined as the plates at the very top of the building.
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be analysed.
nstorey : int
The number of storey of the building.
storey_height : float
The floor to floor height the building.
tolearnce : float, optional
The tolerance used for the analysis, the smaller the float it is more precise. Default = 1e-05.
tolearnce : float, optional
The tolerance used for the analysis, the smaller the float it is more precise. Default = 1e-05.
roundndigit : int, optional
The number of decimal places of the xyz of the points for the boolean section function, Default = 6. The higher the number the more precise are the points. Depending on the precision of the points, it will decide whether the edges are connected.
distance : float, optional
The smallest distance between two points from the edges for boolean section function, Default = 0.01. The further the distance the less precise is the resultant faces.
Returns: roof plates : list of OCCfaces
List of OCCfaces identified as roofs.
-
py4design.urbangeom.
get_building_flrplates
(bldg_occsolid, nstorey, storey_height)¶ This function gets the floor plates of a building.
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be analysed.
nstorey : int
The number of storey of the building.
storey_height : float
The floor to floor height the building.
Returns: floor plates : list of OCCfaces
List of OCCfaces that are floors.
-
py4design.urbangeom.
get_building_plates_by_level
(bldg_occsolid, nstorey, storey_height, roundndigit=6, distance=0.1)¶ This function gets the floor plates of a building and return a 2d list instead of a list of the OCCfaces.
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be analysed.
nstorey : int
The number of storey of the building.
storey_height : float
The floor to floor height the building.
roundndigit : int, optional
The number of decimal places of the xyz of the points for the boolean section function, Default = 6. The higher the number the more precise are the points. Depending on the precision of the points, it will decide whether the edges are connected.
distance : float, optional
The smallest distance between two points from the edges for boolean section function, Default = 0.01. The further the distance the less precise is the resultant faces.
Returns: floor plates : 2dlist of OCCfaces
2d List of OCCfaces that are floors. The 2d list is in such format: [floorplates on level 1, floorplates on level 2, floorplates on level x}, floorplates on level x = [face1,face2,facex]
-
py4design.urbangeom.
detect_clash
(bldg_occsolid, other_occsolids)¶ This function detects if this building OCCsolid clashes with the other OCCsolids.
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be analysed.
other_occsolids : list of OCCsolid
The list of other OCCsolid to be analysed.
Returns: clash : bool
True or False, if True there is a clash, if False there is no clash.
-
py4design.urbangeom.
detect_in_boundary
(bldg_occsolid, luse_occface)¶ This function detects if this building OCCsolid is inside the boundary of the landuse OCCface.
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be analysed.
luse_occface : OCCface
The boundary landuse OCCface.
Returns: in boundary : bool
True or False, if True in boundary, if False not in boundary.
-
py4design.urbangeom.
calculate_bldg_height
(bldg_occsolid)¶ This function calculates the building height of this building OCCsolid.
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be analysed.
Returns: height : float
The building height.
-
py4design.urbangeom.
calculate_bldg_height_n_nstorey
(bldg_occsolid, storey_height)¶ This function calculates the building height and the number of storeys of this building OCCsolid.
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be analysed.
storey_height : float
The floor to floor height the building.
Returns: height : float
The building height.
storey : int
The the number of storeys of the building.
-
py4design.urbangeom.
get_building_bounding_footprint
(bldg_occsolid)¶ This function calculates the building’s bounding footprint (the footprint of the bounding box of the OCCsolid).
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be analysed.
Returns: bounding footprint : OCCface
The bounding footprint of the OCCface.
-
py4design.urbangeom.
get_building_location_pt
(bldg_occsolid)¶ This function calculates the building’s location point (the mid point of the building’s bounding footprint).
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be analysed.
Returns: location point : pypt
Tuple of floats. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z)
-
py4design.urbangeom.
reconstruct_building_through_floorplates
(bldg_occsolid, bldg_flr_area, storey_height)¶ This function reconstructs the building OCCsolid according to the given floor area.
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be reconstructed.
bldg_flr_area : float
The floor area of the reconstructed building.
storey_height : float
The floor to floor height the building.
Returns: reconstructed building : OCCsolid
The reconstructed building OCCsolid.
-
py4design.urbangeom.
calculate_bldg_flr_area
(bldg_occsolid, flr2flr_height)¶ This function calculates the building floor area.
Parameters: bldg_occsolid : OCCsolid
The OCCsolid that is a building to be calculated.
flr2flr_height : float
The floor to floor height the building.
Returns: bldg_flr_area : float
The floor area of the building.
-
py4design.urbangeom.
calculate_bld_up_area
(bldg_occsolid_list, flr2flr_height)¶ This function calculates the total floor area of all the buildings.
Parameters: bldg_occsolid_list : list of OCCsolids
The list of OCCsolids that are buildings to be calculated.
flr2flr_height : float
The floor to floor height the building.
Returns: total_bldg_flr_area : float
The total floor area of all the buildings.
-
py4design.urbangeom.
calculate_urban_vol
(bldg_occsolid_list)¶ This function calculates the total volume of all the buildings.
Parameters: bldg_occsolid_list : list of OCCsolids
The list of OCCsolids that are buildings to be calculated.
Returns: total_bldg_volume_list : list of floats
The list of volumes of all the buildings.
-
py4design.urbangeom.
rearrange_building_position
(bldg_occsolid_list, luse_gridded_pyptlist, luse_occface, parameters, other_occsolids=[], clash_detection=True, boundary_detection=True)¶ This function rearranged the building OCCsolids positions on a land use plot according to the given parameters.
Parameters: bldg_occsolid_list : list of OCCsolids
The list of OCCsolids that are buildings to be positioned.
luse_gridded_pyptlist : pyptlist
All the possible positions on the landuse plot. A list of tuples of floats. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z), thus a pyptlist is a list of tuples e.g. [(x1,y1,z1), (x2,y2,z2), …]
luse_occface : OCCface
The landuse OCCface.
parameters : list of int.
The index of the points in luse_gridded_pyptlist. If parameter is 5, the building will be placed on the 5th point of the pyptlist.
other_occsolids : list of OCCsolids
The other OCCsolids on the landuse plot.
clash_detection : bool
True or False, if True while rearranging ensures does not clash with other OCCsolid, if False does not.
boundary_detection : bool
True or False, if True while rearranging ensures stays within land use boundary, if False does not.
Returns: repositioned buildings : list of OCCsolids
The repositioned building OCCsolids.
-
py4design.urbangeom.
redraw_occshell
(occcompound, tolerance)¶ This function redraws and recombine all OCCshells in the OCCcompound.
Parameters: occcompound : OCCcompound
OCCcompound to be redrawed.
tolerance : float
The precision of the recombination operation.
Returns: reconstructed shells : OCCcompound of OCCshells
The reconstructed shells.
-
py4design.urbangeom.
redraw_occedge
(occcompound, tolerance)¶ This function redraws all OCCedges in the OCCcompound.
Parameters: occcompound : OCCcompound
OCCcompound to be redrawed.
tolerance : float
The precision of the recombination operation.
Returns: reconstructed edges : OCCcompound of OCCedges
The reconstructed edges.