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]
Exemple #2
0
 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 create_grid(self, floor_):
        global FLOOR_SIZE
        reload(HouInterface)

        points = floor_.get_absolute_points()
        center = GeoMath.centerOfPoints(points)

        vec1 = GeoMath.vecSub(points[0], points[1])
        vec2 = GeoMath.vecSub(points[2], points[1])

        if (vec1[0] != 0):
            vecx = GeoMath.vecModul(vec1)
            vecz = GeoMath.vecModul(vec2)
        else:
            vecx = GeoMath.vecModul(vec2)
            vecz = GeoMath.vecModul(vec1)
        columns = vecx / TILE_SIZE
        rows = vecz / TILE_SIZE
        gridName = self.hout.showGrid('floor', center, vecx, vecz, rows, columns)

        return gridName
    def create_grid(self, floor_):
        global FLOOR_SIZE
        reload(HouInterface)

        points = floor_.get_absolute_points()
        center = GeoMath.centerOfPoints(points)

        vec1 = GeoMath.vecSub(points[0], points[1])
        vec2 = GeoMath.vecSub(points[2], points[1])

        if (vec1[0] != 0):
            vecx = GeoMath.vecModul(vec1)
            vecz = GeoMath.vecModul(vec2)
        else:
            vecx = GeoMath.vecModul(vec2)
            vecz = GeoMath.vecModul(vec1)
        columns = vecx / TILE_SIZE
        rows = vecz / TILE_SIZE
        gridName = self.hout.showGrid('floor', center, vecx, vecz, rows,
                                      columns)

        return gridName
    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)
Exemple #6
0
    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)