Exemplo n.º 1
0
    def reinit_skeletons(self):
        self.skeletonLevels = [LevelSkeleton.createSkeletonFromLevel(level) for level in self.levels]
        self.levelsHash = dict(list(zip(self.levels, self.skeletonLevels)))
        self.skeletonLevelsHash = dict(list(zip(self.skeletonLevels, self.levels)))
        print("INFO INIT: DONE GENERATING LEVELSKELETONS FROM LEVELS")
        baseSlabHeight = 0
        for level in self.levels:
            if not len(self.levelsHash[level].getPolys()):  # or level.getHeight() <= 0:
                baseSlabHeight = level.getHeight()
            else:
                break

        for i, levelSkeleton in enumerate(self.skeletonLevels):
            prevLevels = self.skeletonLevelsHash[levelSkeleton].getRightLowerLevels()
            if not prevLevels:
                continue

            prevLevels = [self.levelsHash[level] for level in prevLevels if level.getHeight() > baseSlabHeight]
            if not len(prevLevels):
                continue
            levelSkeleton.restrictLevelUsableWalls(prevLevels)

        self.levels = [level for level in self.levels if len(self.levelsHash[level].getPolys())]
        self.skeletonLevels = [levelSkeleton for levelSkeleton in self.skeletonLevels if len(levelSkeleton.getPolys())]
        self.solutions = {}
Exemplo n.º 2
0
    def __init__(self, parent=None, wallShapes=None, slabShapes=None):
        super(Launcher, self).__init__()
        self.constraints = {
            "ecc_w": -0.5,
            "area_w": 1,
            "length_w": 1,
            "ratio": 1,
            "d": 1,
        }
        self.levels = Level.generateLevelsFromShapes(wallShapes, slabShapes)
        print("INFO INIT: DONE GENERATING LEVELS FROM SHAPES")
        self.levels.sort(key=lambda lvl: lvl.getHeight())

        self.skeletonLevels = [
            LevelSkeleton.createSkeletonFromLevel(level)
            for level in self.levels
        ]
        self.levelsHash = dict(list(zip(self.levels, self.skeletonLevels)))
        self.skeletonLevelsHash = dict(
            list(zip(self.skeletonLevels, self.levels)))
        print("INFO INIT: DONE GENERATING LEVELSKELETONS FROM LEVELS")
        baseSlabHeight = 0
        for level in self.levels:
            if not len(self.levelsHash[level].getPolys()
                       ):  # or level.getHeight() <= 0:
                baseSlabHeight = level.getHeight()
            else:
                break

        for i, levelSkeleton in enumerate(self.skeletonLevels):
            prevLevels = self.skeletonLevelsHash[
                levelSkeleton].getRightLowerLevels()
            if not prevLevels:
                continue

            prevLevels = [
                self.levelsHash[level] for level in prevLevels
                if level.getHeight() > baseSlabHeight
            ]
            if not len(prevLevels):
                continue
            levelSkeleton.restrictLevelUsableWalls(prevLevels)

        self.levels = [
            level for level in self.levels
            if len(self.levelsHash[level].getPolys())
        ]
        for level in self.levels:
            level.relatedLevels = self.levels
            level.rlowerLevels = None
        self.skeletonLevels = [
            levelSkeleton for levelSkeleton in self.skeletonLevels
            if len(levelSkeleton.getPolys())
        ]
        self.solutions = {}

        self.selectedRow = 1
        self.pend = True
Exemplo n.º 3
0
    def init_skeletons(self, ind):
        self.skeletonLevels = [
            LevelSkeleton.createSkeletonFromLevel(level)
            for level in self.levels
        ]

        self.levelsHash = dict(list(zip(self.levels, self.skeletonLevels)))
        self.skeletonLevelsHash = dict(
            list(zip(self.skeletonLevels, self.levels)))
        print(self.levels)
        print(self.skeletonLevels)
        self.levels = [
            level for level in self.levels
            if len(self.levelsHash[level].getPolys())
        ]
        for level in self.levels:
            level.relatedLevels = self.levels
        self.skeletonLevels = [
            levelSkeleton for levelSkeleton in self.skeletonLevels
            if len(levelSkeleton.getPolys())
        ]
        print("INFO INIT: DONE GENERATING LEVELSKELETONS FROM LEVELS")
        baseSlabHeight = 0
        for level in self.levels:
            if not len(self.levelsHash[level].getPolys()
                       ):  # or level.getHeight() <= 0:
                baseSlabHeight = level.getHeight()
            else:
                break

        print(baseSlabHeight)

        for i, levelSkeleton in enumerate(self.skeletonLevels):
            prevLevels = self.skeletonLevelsHash[
                levelSkeleton].getRightLowerLevels()

            if not prevLevels:
                continue

            prevLevels = [
                self.levelsHash[level] for level in prevLevels
                if level.getHeight() >= baseSlabHeight
            ]
            print(prevLevels)
            if not len(prevLevels):
                continue

            levelSkeleton.restrictLevelUsableWalls(prevLevels)

        if ind == 1:
            self.skeletonLevels = LevelSkeleton.removeUnwantedWalls(
                self.skeletonLevels, self.axesSolution, self.Columns)

        self.solutions = {}
Exemplo n.º 4
0
 def getPolygonsFromLevels(self, levels):
     polys = []
     for level in levels:
         polys += self.getPolygonsFromLevelSkeletons(
             LevelSkeleton.createSkeletonFromLevel(level))
     return polys
Exemplo n.º 5
0
    def __init__(self,
                 parent=None,
                 wallShapes=None,
                 slabShapes=None,
                 spaceShapes=None):
        super(TryApp, self).__init__(parent)
        self.constraints = {
            "ecc_w": -0.5,
            "area_w": 1,
            "length_w": 1,
            "ratio": 1,
            "d": 1,
        }
        self.setupUi(self)
        self.levels = Level.generateLevelsFromShapes(wallShapes, slabShapes)
        print("INFO INIT: DONE GENERATING LEVELS FROM SHAPES")
        self.levels.sort(key=lambda lvl: lvl.getHeight())

        self.skeletonLevels = [
            LevelSkeleton.createSkeletonFromLevel(level)
            for level in self.levels
        ]
        self.levelsHash = dict(list(zip(self.levels, self.skeletonLevels)))
        self.skeletonLevelsHash = dict(
            list(zip(self.skeletonLevels, self.levels)))
        print("INFO INIT: DONE GENERATING LEVELSKELETONS FROM LEVELS")
        baseSlabHeight = 0
        for level in self.levels:
            if not len(self.levelsHash[level].getPolys()
                       ):  # or level.getHeight() <= 0:
                baseSlabHeight = level.getHeight()
            else:
                break

        print(("getting lower levels", len(self.skeletonLevels)))
        for i, levelSkeleton in enumerate(self.skeletonLevels):
            prevLevels = self.skeletonLevelsHash[
                levelSkeleton].getRightLowerLevels()
            print(("getting for level", i))
            if not prevLevels:
                continue

            prevLevels = [
                self.levelsHash[level] for level in prevLevels
                if level.getHeight() > baseSlabHeight
            ]
            if not len(prevLevels):
                continue
            levelSkeleton.restrictLevelUsableWalls(prevLevels)

        self.storey_mode = False
        self.levels = [
            level for level in self.levels
            if len(self.levelsHash[level].getPolys())
        ]
        self.skeletonLevels = [
            levelSkeleton for levelSkeleton in self.skeletonLevels
            if len(levelSkeleton.getPolys())
        ]
        self.storeySkeletons = []
        heights = []
        for levelSkeleton in self.skeletonLevels:
            height = levelSkeleton.level.getHeight()
            if height not in heights:
                skeletons = [levelSkeleton]
                heights.append(height)
                for ls in self.skeletonLevels:
                    if ls.level.getHeight() == height:
                        skeletons.append(ls)

                self.storeySkeletons.append(StoreySkeleton(skeletons))
        self.solutions = {}

        self.selectedRow = 1
        self.initListView(self.storey_mode)
        self.listView.setModel(self.model)
        self.listView.clicked.connect(self.listViewSelected)
        self.sol1.clicked.connect(self.sol1CB)
        self.sol2.clicked.connect(self.sol2CB)
        self.merge.clicked.connect(self.mergeCB)
        self.cross.clicked.connect(self.crossCB)
        self.showLower.clicked.connect(self.showLowerFun)

        self.scrollTab = QtGui.QScrollArea()

        self.tabWidget.addTab(self.scrollTab, "upperView")

        self.addViewerTab("Walls")
        self.addViewerTab("Slabs")
        self.addViewerTab("All")
        self.addViewerTab("Selected")

        self.tabWidget.removeTab(0)
        self.tabWidget.removeTab(0)

        self.setViewerDisplay("Walls", wallShapes)
        self.setViewerDisplay("Slabs", slabShapes)
        all = wallShapes + slabShapes
        self.setViewerDisplay("All", all)
        self.pend = True
Exemplo n.º 6
0
    def __init__(self, parent=None, wallShapes=None, slabShapes=None):
        super(Launcher, self).__init__()
        self.constraints = {
            "ecc_w": -0.5,
            "area_w": 1,
            "length_w": 1,
            "ratio": 1,
            "d": 1,
        }
        self.levels = Level.generateLevelsFromShapes(wallShapes, slabShapes)
        print("INFO INIT: DONE GENERATING LEVELS FROM SHAPES")
        self.levels.sort(key=lambda lvl: lvl.getHeight())

        self.skeletonLevels = [
            LevelSkeleton.createSkeletonFromLevel(level)
            for level in self.levels
        ]
        self.levelsHash = dict(list(zip(self.levels, self.skeletonLevels)))
        self.skeletonLevelsHash = dict(
            list(zip(self.skeletonLevels, self.levels)))
        print("INFO INIT: DONE GENERATING LEVELSKELETONS FROM LEVELS")
        baseSlabHeight = 0
        for level in self.levels:
            if not len(self.levelsHash[level].getPolys()
                       ):  # or level.getHeight() <= 0:
                baseSlabHeight = level.getHeight()
            else:
                break

        for i, levelSkeleton in enumerate(self.skeletonLevels):
            prevLevels = self.skeletonLevelsHash[
                levelSkeleton].getRightLowerLevels()
            if not prevLevels:
                continue

            prevLevels = [
                self.levelsHash[level] for level in prevLevels
                if level.getHeight() > baseSlabHeight
            ]
            if not len(prevLevels):
                continue
            levelSkeleton.restrictLevelUsableWalls(prevLevels)

        self.storey_mode = False
        self.levels = [
            level for level in self.levels
            if len(self.levelsHash[level].getPolys())
        ]
        self.skeletonLevels = [
            levelSkeleton for levelSkeleton in self.skeletonLevels
            if len(levelSkeleton.getPolys())
        ]
        self.storeySkeletons = []
        heights = []
        for levelSkeleton in self.skeletonLevels:
            height = levelSkeleton.level.getHeight()
            if height not in heights:
                skeletons = [levelSkeleton]
                heights.append(height)
                for ls in self.skeletonLevels:
                    if ls.level.getHeight() == height:
                        skeletons.append(ls)

                self.storeySkeletons.append(StoreySkeleton(skeletons))
        self.solutions = {}
        self.solutions = {}

        self.selectedRow = 1
        self.pend = True

        # Vertical Loads
        Sdiv = SlabDivision(self.storeySkeletons[0])
        # Sdiv.importWalls(self.skeletonLevels[0])
        # Seg = Sdiv.createSlabSegments()
        # f2 = plt.figure(3,)
        # for segment in Sdiv.createSlabSegments():
        #     segment.End1.plotEnd()
        #     segment.End2.plotEnd()
        #     segment.PlotSeg()

        for room in Sdiv.rooms:
            # 0x7fd0cba0b9e0 >
            print(("room", room))
            fig, ax = plt.subplots()
            color = (random(), random(), random())
            color2 = (random(), random(), random())
            for segment in room.get_segments():
                e1, e2 = segment.End1.PntCoord, segment.End2.PntCoord
                pnt1 = Pnt(e1.x, e1.y)
                pnt2 = Pnt(e2.x, e2.y)
                c = color if pnt1.isInPolygon(room.slab_poly) else "r"
                segment.End1.plot(c, (fig, ax))
                c2 = color if pnt2.isInPolygon(room.slab_poly) else "r"
                segment.End2.plot(c2, (fig, ax))
                segment.plot(color, (fig, ax))
            room.plot(color2, figax=(fig, ax))
            # axes = ax.gca()
            ax.set_xlim([-10, 10])
            ax.set_ylim([-8, 8])
            plt.show()