예제 #1
0
    def getHighestPoint(self):
        maxZ = None
        polygons = ShapeToPoly.getPolygonesFromShape(self.shape)
        for poly in polygons:
            for pnt in poly.points:
                if not maxZ or pnt.z > maxZ.z:
                    maxZ = pnt

        return maxZ
예제 #2
0
    def drawPolygons(self, shapes):
        from Geometry import ShapeToPoly
        polygons = ShapeToPoly.getShapesBasePolygons(shapes)
        if not len(polygons):
            return

        from UI.DrawUtils import Window
        self.scrollTab.setWidget(
            Window(polygons, rect=self.scrollTab.geometry()))
예제 #3
0
    def getLowestPoint(self):
        minZ = None
        polygons = ShapeToPoly.getPolygonesFromShape(self.shape)
        for poly in polygons:
            # if poly.isInPlaneXY():
            for pnt in poly.points:
                if not minZ or pnt.z < minZ.z:
                    minZ = pnt

        return minZ
예제 #4
0
    def createSkeletonsFromWall(wall, minZ=None, maxZ=None):
        e = 0.2
        pols = ShapeToPoly.getPolygonesFromShape(wall.shape)
        if maxZ is not None:
            maxZ = min(
                [maxZ,
                 max([pnt.z for poly in pols for pnt in poly.points])]) - e
        if minZ is not None: minZ = minZ + e
        allPolygons = wall.getXYPlanePolygons(minZ, maxZ)

        # print('maxZ: ',maxZ,' maxZ2: ',maxZ2)
        polygons = wall.getBasePolygons()
        result = []
        i = 1
        # from matplotlib import pyplot as plt
        for poly2 in allPolygons:
            for poly in polygons:
                if not poly.intersects(poly2):
                    result.append(poly)
                    continue
                inters = poly.intersection(poly2)
                if inters:
                    result += poly.subtractPoly(inters)
                else:
                    result.append(poly)
            polygons = result
            # Plotter.plotPolys(polygons,i)
            # plt.show()
            i += 1
            result = []

        wallSkeletons = []

        for polygon in polygons:
            try:
                wallSkeleton = WallSkeleton(polygon)
            except NotBoxError:
                print("not box error")
                continue
            wallSkeletons.append(wallSkeleton)

        return wallSkeletons
예제 #5
0
        # qp.scale(30,30)
        for c in self.cells:
            c.drawPolygone(qp)


from Ifc import IfcUtils

if __name__ == '__main__':

    wall_shapes = IfcUtils.getWallShapesFromIfc("IFCFiles/projet.ifc")
    # wall_shapes = IfcUtils.getSlabShapesFromIfc("IFCFiles/projet.ifc")
    shapes = []
    for wall, shape in wall_shapes:
        shapes.append(shape)

    polygons = ShapeToPoly.getShapesBasePolygons(shapes)
    lx = min([
        pnt.x()
        for pnt in [pt for polygon in polygons for pt in polygon.points]
    ])
    ly = min([
        pnt.y()
        for pnt in [pt for polygon in polygons for pt in polygon.points]
    ])

    for polygon in polygons:
        polygon.move(-lx + 10, -ly + 10)
        # print ("polygon is: ")
        # for pnt in polygon.points:
        #     print("point is: (%.2f, %.2f) " % (pnt.x, pnt.y))
예제 #6
0
 def getPolygons(self):
     return ShapeToPoly.getPolygonesFromShape(self.shape)
예제 #7
0
 def getXYPlanePolygons(self, minZ=None, maxZ=None):
     return ShapeToPoly.getShapeXYPlanePolygons(self.shape, minZ, maxZ)
예제 #8
0
 def getBasePolygons(self):
     return ShapeToPoly.getShapeBasePolygons(self.shape)