예제 #1
0
파일: main.py 프로젝트: ressay/ArchToCE
 def columnSearch(self):
     self.potentialColumns, self.haxes, self.vaxes = WallSkeleton.Columns(
         self.skeletonLevels, 0)
     axes = [self.haxes, self.vaxes]
     nlvls = len(self.skeletonLevels)
     self.axesSolution = tabu_search(self.potentialColumns,
                                     axes,
                                     self.skeletonLevels[nlvls -
                                                         1].slabSkeleton,
                                     limit=20)
     print("Haxis solution:")
     for axis in self.axesSolution.axes[0]:
         print(axis.bounds)
     print("Vaxis solution:")
     for axis in self.axesSolution.axes[1]:
         print(axis.bounds)
     Columns = []
     for Haxis in self.axesSolution.axes[0]:
         for Vaxis in self.axesSolution.axes[1]:
             column = linestring.BaseGeometry.intersection(Haxis, Vaxis)
             if column not in Columns: Columns.append(column)
     Distances = WallSkeleton.ColumnDistances(Columns)
     for i in range(len(Columns)):
         print("Distance of the column", i, "(", Columns[i].x, Columns[i].y,
               ")", Distances[0][i], Distances[1][i])
     print("Total Height here:", self.totalHeight)
     self.Columns, self.ColumnsLength = LevelSkeleton.CreateColumnShapes(
         Distances, self.totalHeight, Columns)
     for Column in self.Columns:
         # VDim = round(Column.poly.MaxCoords().y()-Column.poly.MinCoods().y())
         # Hdim = round(Column.poly.MaxCoords().x()-Column.poly.MinCoods().x())
         print("Column:", Column.centroid, "Vdim:", Column.bounds)
예제 #2
0
파일: main.py 프로젝트: ressay/ArchToCE
    def showLowerFun(self):
        if self.selectedRow is not None:
            from matplotlib import pyplot as plt
            levelSkeleton = self.skeletonLevels[self.selectedRow]
            if levelSkeleton in self.solutions:
                levelSkeleton = self.solutions[levelSkeleton].levelSkeleton
            polys, colors = self.getPolygonsFromLevelSkeletons(levelSkeleton)
            colors = [[c.red() / 255.,
                       c.green() / 255.,
                       c.blue() / 255., 0.8] for c in colors]
            c = colors[-1]
            # Plotter.plotPolys(polys, self.selectedRow, "plan", colors)
            # plt.savefig('try1.png', bbox_inches='tight')
            polys = [poly.poly for poly in polys]
            alphas = [1 for poly in polys]
            c1 = levelSkeleton.getCenterFromSlab()
            c2 = levelSkeleton.getCenterFromShear()
            polys += [
                Point(c1.x(), c1.y()).buffer(0.1),
                Point(c2.x(), c2.y()).buffer(0.1)
            ]
            colors += [[0, 1, 0], [1, 0, 0]]
            alphas += [1, 1]
            # Plotter.plotShapely(polys, colors, alphas, 30, title="plan")
            boxes = [
                voileSkeleton.getSurrondingBox(self.constraints['d'])
                for wallSkeleton in levelSkeleton.wallSkeletons
                for voileSkeleton in wallSkeleton.getAllVoiles()
            ]

            polys += boxes
            alphas += [0.2 for poly in boxes]

            PotentialColumns, haxes, vaxes = WallSkeleton.Columns(
                self.skeletonLevels, self.selectedRow)
            for PotentialColumn in PotentialColumns:
                polys += [
                    Point(PotentialColumn.x, PotentialColumn.y).buffer(0.1)
                ]
                colors += [[1, 0, 0]]
                alphas += [1, 1]
            axes = haxes + vaxes

            for column in self.Columns:
                polys += [column]
                colors += [[1, 0, 0]]
                alphas += [1, 1]
            Plotter.plotShapely(polys, colors, alphas, 20)
            for axe in axes:
                plt.plot(*axe.xy, color='red', linestyle='dashed', linewidth=1)
            plt.show()