def calculate_windows_size(self): global epsilon #======================================================================= # Get the insert node with windows #======================================================================= insert_windows = None for insert in self.get_inserts(): for filter_group in insert.parm('filter').evalAsString().split(): if(filter_group == self.extract_parm_from_user_restrictions('label_window')): insert_windows = insert break try: if(not insert_windows): logging.error('Class BuildingStructure, Label window not found at inserts') raise Errors.CantBeNoneError('Window cant be none', 'Label window not found at inserts') except Errors.CantBeNoneError as e: Errors.Error.display_exception(e) exit() #======================================================================= # Get the size of the geometry of own window primitive #======================================================================= # We use the parent node because the insertnode has a cooked geometry # with windows inserteds. previous_node = insert_windows.inputs()[0] delete_node = previous_node.createOutputNode('delete') delete_node.parm('group').set(self.extract_parm_from_user_restrictions('label_window')) delete_node.parm('negate').set('keep') some_window = delete_node.geometry().prims()[0] window_points = [list(p.point().position()) for p in some_window.vertices()] window_bounding_box = GeoMath.boundingBox(window_points) window_size = [window_bounding_box.sizevec()[0], window_bounding_box.sizevec()[1]] return window_size
def display_on(self, name = 'floor', HI = None): if(not HI): HI = HouInterface.HouInterface() # Get the size of the floor using its points bounding_box = GeoMath.boundingBox(self.get_absolute_points()) size = bounding_box.sizevec() # Put the size 'y' that user wants the floor to be size[1] = self.extract_parm_from_user_restrictions('floor_default_size_y') center = GeoMath.centerOfPoints(self.get_absolute_points()) nodeName = HI.showCube(name, size, center) self.associate_nodes = HI.cubes[nodeName]
def display_on(self, name='floor', HI=None): if (not HI): HI = HouInterface.HouInterface() # Get the size of the floor using its points bounding_box = GeoMath.boundingBox(self.get_absolute_points()) size = bounding_box.sizevec() # Put the size 'y' that user wants the floor to be size[1] = self.extract_parm_from_user_restrictions( 'floor_default_size_y') center = GeoMath.centerOfPoints(self.get_absolute_points()) nodeName = HI.showCube(name, size, center) self.associate_nodes = HI.cubes[nodeName]
def calculate_windows_size(self): global epsilon #======================================================================= # Get the insert node with windows #======================================================================= insert_windows = None for insert in self.get_inserts(): for filter_group in insert.parm('filter').evalAsString().split(): if (filter_group == self.extract_parm_from_user_restrictions( 'label_window')): insert_windows = insert break try: if (not insert_windows): logging.error( 'Class BuildingStructure, Label window not found at inserts' ) raise Errors.CantBeNoneError( 'Window cant be none', 'Label window not found at inserts') except Errors.CantBeNoneError as e: Errors.Error.display_exception(e) exit() #======================================================================= # Get the size of the geometry of own window primitive #======================================================================= # We use the parent node because the insertnode has a cooked geometry # with windows inserteds. previous_node = insert_windows.inputs()[0] delete_node = previous_node.createOutputNode('delete') delete_node.parm('group').set( self.extract_parm_from_user_restrictions('label_window')) delete_node.parm('negate').set('keep') some_window = delete_node.geometry().prims()[0] window_points = [ list(p.point().position()) for p in some_window.vertices() ] window_bounding_box = GeoMath.boundingBox(window_points) window_size = [ window_bounding_box.sizevec()[0], window_bounding_box.sizevec()[1] ] return window_size
def calculate_tubes_position(self): for floor in self.floor_structure.get_floors(): center = GeoMath.centerOfPoints(floor.get_absolute_points()) # ================================================================== # Guess how many tubes for each part. We divide the floor into 4 parts # in a half in x direction and in a half in z direction. # ================================================================== boun = GeoMath.boundingBox(floor.get_absolute_points()) height_x_tubes = boun.sizevec()[2] height_z_tubes = boun.sizevec()[0] orientation_x_tubes = "z" orientation_z_tubes = "x" size_x_half_section = boun.sizevec()[0] / 2.0 put_tube_each_x = self.extract_parm_from_user_restrictions( "tube_default_put_each_x", DEFAULT_PUT_TUBE_EACH_X ) n_tubes_x_half_section = int(math.floor(size_x_half_section / put_tube_each_x)) size_z_half_section = boun.sizevec()[2] / 2.0 put_tube_each_z = self.extract_parm_from_user_restrictions( "tube_default_put_each_z", DEFAULT_PUT_TUBE_EACH_Z ) n_tubes_z_half_section = int(math.floor(size_z_half_section / put_tube_each_z)) # The first time putting tubes in x we put a tube in the middle tube_instance = tube.Tube(self.tube_params, center, height_x_tubes, orientation_x_tubes) self.tubes["x"].append(tube_instance) # To the right in x, so we will adding 'x' value to the center # point increment = [put_tube_each_x, 0, 0] tube_center = GeoMath.vecPlus(center, increment) for _ in range(n_tubes_x_half_section): tube_instance = tube.Tube(self.tube_params, tube_center, height_x_tubes, orientation_x_tubes) self.tubes["x"].append(tube_instance) tube_center = GeoMath.vecPlus(tube_center, increment) # To the left increment = [-put_tube_each_x, 0, 0] tube_center = GeoMath.vecPlus(center, increment) for _ in range(n_tubes_x_half_section): tube_instance = tube.Tube(self.tube_params, tube_center, height_x_tubes, orientation_x_tubes) self.tubes["x"].append(tube_instance) tube_center = GeoMath.vecPlus(tube_center, increment) # The first time putting tubes in z we put a tube in the middle tube_instance = tube.Tube(self.tube_params, center, height_z_tubes, orientation_z_tubes) self.tubes["z"].append(tube_instance) # To the right in x, so we will adding 'x' value to the center # point increment = [0, 0, put_tube_each_z] tube_center = GeoMath.vecPlus(center, increment) for _ in range(n_tubes_z_half_section): tube_instance = tube.Tube(self.tube_params, tube_center, height_z_tubes, orientation_z_tubes) self.tubes["z"].append(tube_instance) tube_center = GeoMath.vecPlus(tube_center, increment) # To the left increment = [0, 0, -put_tube_each_z] tube_center = GeoMath.vecPlus(center, increment) for _ in range(n_tubes_z_half_section): tube_instance = tube.Tube(self.tube_params, tube_center, height_z_tubes, orientation_z_tubes) self.tubes["z"].append(tube_instance) tube_center = GeoMath.vecPlus(tube_center, increment)
def calculate_tubes_position(self): for floor in self.floor_structure.get_floors(): center = GeoMath.centerOfPoints(floor.get_absolute_points()) #================================================================== # Guess how many tubes for each part. We divide the floor into 4 parts # in a half in x direction and in a half in z direction. #================================================================== boun = GeoMath.boundingBox(floor.get_absolute_points()) height_x_tubes = boun.sizevec()[2] height_z_tubes = boun.sizevec()[0] orientation_x_tubes = 'z' orientation_z_tubes = 'x' size_x_half_section = boun.sizevec()[0] / 2.0 put_tube_each_x = self.extract_parm_from_user_restrictions( 'tube_default_put_each_x', DEFAULT_PUT_TUBE_EACH_X) n_tubes_x_half_section = int( math.floor(size_x_half_section / put_tube_each_x)) size_z_half_section = boun.sizevec()[2] / 2.0 put_tube_each_z = self.extract_parm_from_user_restrictions( 'tube_default_put_each_z', DEFAULT_PUT_TUBE_EACH_Z) n_tubes_z_half_section = int( math.floor(size_z_half_section / put_tube_each_z)) # The first time putting tubes in x we put a tube in the middle tube_instance = tube.Tube(self.tube_params, center, height_x_tubes, orientation_x_tubes) self.tubes['x'].append(tube_instance) # To the right in x, so we will adding 'x' value to the center # point increment = [put_tube_each_x, 0, 0] tube_center = GeoMath.vecPlus(center, increment) for _ in range(n_tubes_x_half_section): tube_instance = tube.Tube(self.tube_params, tube_center, height_x_tubes, orientation_x_tubes) self.tubes['x'].append(tube_instance) tube_center = GeoMath.vecPlus(tube_center, increment) # To the left increment = [-put_tube_each_x, 0, 0] tube_center = GeoMath.vecPlus(center, increment) for _ in range(n_tubes_x_half_section): tube_instance = tube.Tube(self.tube_params, tube_center, height_x_tubes, orientation_x_tubes) self.tubes['x'].append(tube_instance) tube_center = GeoMath.vecPlus(tube_center, increment) # The first time putting tubes in z we put a tube in the middle tube_instance = tube.Tube(self.tube_params, center, height_z_tubes, orientation_z_tubes) self.tubes['z'].append(tube_instance) # To the right in x, so we will adding 'x' value to the center # point increment = [0, 0, put_tube_each_z] tube_center = GeoMath.vecPlus(center, increment) for _ in range(n_tubes_z_half_section): tube_instance = tube.Tube(self.tube_params, tube_center, height_z_tubes, orientation_z_tubes) self.tubes['z'].append(tube_instance) tube_center = GeoMath.vecPlus(tube_center, increment) # To the left increment = [0, 0, -put_tube_each_z] tube_center = GeoMath.vecPlus(center, increment) for _ in range(n_tubes_z_half_section): tube_instance = tube.Tube(self.tube_params, tube_center, height_z_tubes, orientation_z_tubes) self.tubes['z'].append(tube_instance) tube_center = GeoMath.vecPlus(tube_center, increment)