当前位置: 首页>>代码示例>>Python>>正文


Python GeoMath.boundingBox方法代码示例

本文整理汇总了Python中lib.GeoMath.boundingBox方法的典型用法代码示例。如果您正苦于以下问题:Python GeoMath.boundingBox方法的具体用法?Python GeoMath.boundingBox怎么用?Python GeoMath.boundingBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.GeoMath的用法示例。


在下文中一共展示了GeoMath.boundingBox方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: calculate_windows_size

# 需要导入模块: from lib import GeoMath [as 别名]
# 或者: from lib.GeoMath import boundingBox [as 别名]
    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
开发者ID:csoriano89,项目名称:BuildingDestruction,代码行数:37,代码来源:buildingstructure.py

示例2: display_on

# 需要导入模块: from lib import GeoMath [as 别名]
# 或者: from lib.GeoMath import boundingBox [as 别名]
 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]
开发者ID:csoriano89,项目名称:BuildingDestruction,代码行数:13,代码来源:floor.py

示例3: calculate_tubes_position

# 需要导入模块: from lib import GeoMath [as 别名]
# 或者: from lib.GeoMath import boundingBox [as 别名]
    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)
开发者ID:csoriano89,项目名称:BuildingDestruction,代码行数:68,代码来源:metallicstructure.py


注:本文中的lib.GeoMath.boundingBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。