Ejemplo n.º 1
0
    def exportBlockTopology(self, name):
        retval= bte.BlockData()
        retval.name= name

        counter= 0
        for p in self.kPoints:
            key= self.kPointsNames[counter]
            retval.appendPoint(id= counter,x= p[0],y= p[1],z= p[2], labels= self.labelDict[key])
            counter+= 1

        counter= 0
        for key in self.lines:
            line= self.lines[key]
            block= bte.BlockRecord(counter,'line',line,self.labelDict[key])
            retval.appendBlock(block)
            counter+= 1
            
        for name in self.layersToImport:
            fg= self.facesByLayer[name]
            for key in fg:
                face= fg[key]
                block= bte.BlockRecord(counter,'face',face,self.labelDict[key])
                retval.appendBlock(block)
                counter+= 1
        return retval
Ejemplo n.º 2
0
def getBoltedPointBlocks(gussetPlateBlocks, boltedPlateBlocks,
                         distBetweenPlates):
    ''' Return the points linked by bolts between the two pieces.

    :param gussetPlateBlocks: blocks of the gusset plate.
    :param boltedPlateBlocks: plate bolted to the gusset plate.
    :param distBetweenPlates: distance between plates.
    '''
    retval = bte.BlockData()
    gussetPlateBoltCenters = list()
    for key in gussetPlateBlocks.points:
        p = gussetPlateBlocks.points[key]
        if (p.getAttribute('objType') == 'hole_center'):
            gussetPlateBoltCenters.append(p)
    boltedPlateBoltCenters = list()
    for key in boltedPlateBlocks.points:
        p = boltedPlateBlocks.points[key]
        if (p.getAttribute('objType') == 'hole_center'):
            boltedPlateBoltCenters.append(p)
    tol = distBetweenPlates / 100.0
    for pA in gussetPlateBoltCenters:
        for pB in boltedPlateBoltCenters:
            dist = math.sqrt((pA.coords[0] - pB.coords[0])**2 +
                             (pA.coords[1] - pB.coords[1])**2 +
                             (pA.coords[2] - pB.coords[2])**2)
            if (abs(dist - distBetweenPlates) < tol):
                boltBlk = bte.BlockRecord(id=-1,
                                          typ='line',
                                          kPoints=[pA.id, pB.id])
                id = retval.appendBlock(boltBlk)
    return retval
Ejemplo n.º 3
0
    def getBasePlateBlocks(self, columnShapeBlocks, blockProperties=None):
        ''' Create the blocks corresponding to the baseplate.

        :param columnShapeBlocks: blocks of the column welded to the baseplate.
        :param blockProperties: labels and attributes to assign to the newly created blocks.
        '''
        properties = bte.BlockProperties.copyFrom(blockProperties)
        retval = bte.BlockData()
        retval.extend(self.basePlate.getBlocks(blockProperties=properties))
        flangeLegSize = math.floor(
            self.basePlate.getFlangeWeldLegSize(0.3) *
            1e3) / 1e3  # Arbitrary factor: temporary solution. LP 29/09/2020
        webLegSize = math.floor(
            self.basePlate.getWebWeldLegSize() *
            1e3) / 1e3  # Default factor: temporary solution. LP 29/09/2020
        columnBasePlateWeldBlocks = self.getColumnBaseplateWeldBlocks(
            flangeLegSize, webLegSize, properties)
        for face, weld in zip(columnShapeBlocks.faceBlocks,
                              columnBasePlateWeldBlocks.weldBlocks):
            weldProperties = bte.BlockProperties.copyFrom(properties)
            weldProperties.appendAttribute('ownerId', 'f' +
                                           str(face.id))  # owner identifier.
            weld.blockProperties += (weldProperties)
        retval.extend(columnBasePlateWeldBlocks)
        return retval
Ejemplo n.º 4
0
    def getBlocks(self, blockProperties=None):
        ''' Creates the block data for later meshing.

        :param blockProperties: labels and attributes to assign to the newly created blocks.
        '''
        originNodeTag = str(self.originNode.tag)
        properties = bte.BlockProperties.copyFrom(blockProperties)
        properties.appendAttribute('jointId', originNodeTag)
        retval = bte.BlockData()
        # Column blocks.
        columnShapeBlocks = self.getColumnShapeBlocks(
            self.columnLengthFactor, blockProperties=properties)
        retval.extend(columnShapeBlocks)
        # Beam blocks.
        beamShapeBlocks = self.getBeamShapeBlocks(self.beamLengthFactor,
                                                  blockProperties=properties)
        retval.extend(beamShapeBlocks)
        # Diagonal blocks.
        for e in self.diagonals:
            retval.extend(
                self.getGussetBlocksForDiagonal(e, blockProperties=properties))
        if (hasattr(self, 'basePlate')):
            retval.extend(
                self.getBasePlateBlocks(columnShapeBlocks,
                                        blockProperties=properties))
        else:
            lmsg.warning('base plate not found.')
        return retval
Ejemplo n.º 5
0
 def getBlocks(self):
     ''' Creates the block data for meshing.'''
     retval = bte.BlockData()
     retval.name = self.name + '_blocks'
     for c in self.connections:
         retval.extend(c.getBlocks())
     return retval
Ejemplo n.º 6
0
    def exportBlockTopology(self, name):
        retval= bte.BlockData()
        retval.name= name
        retval.fileName= self.fileName
        retval.logMessage= '# imported from file: '+self.fileName+' on '
        retval.logMessage+= str(datetime.datetime.now())

        counter= 0
        if(self.kPoints):
            for p in self.kPoints:
                key= self.kPointsNames[counter]
                bp= bte.BlockProperties(labels= self.labelDict[key])
                retval.appendPoint(id= counter,x= p[0],y= p[1],z= p[2], pointProperties= bp)
                counter+= 1

            counter= 0
            for key in self.lines:
                line= self.lines[key]
                bp= bte.BlockProperties(labels= self.labelDict[key])
                block= bte.BlockRecord(counter,'line',line, blockProperties= bp)
                retval.appendBlock(block)
                counter+= 1

            for name in self.getNamesToImport():
                fg= self.facesTree[name]
                for key in fg:
                    face= fg[key]
                    bp= bte.BlockProperties(labels= self.labelDict[key])
                    block= bte.BlockRecord(counter,'face',face, blockProperties= bp)
                    retval.appendBlock(block)
                    counter+= 1
        else:
            lmsg.warning('Nothing to export.')
        return retval
Ejemplo n.º 7
0
    def getBeamShapeBlocks(self, factor, blockProperties=None):
        ''' Return the faces of the beams.

        :param factor: factor multiplies the unary direction vector
                       of the member to define its extrusion 
                       direction and lenght.
        :param blockProperties: labels and attributes to assign to the newly created blocks.
        '''
        retval = bte.BlockData()
        beamShapeProperties = bte.BlockProperties.copyFrom(blockProperties)
        beamShapeProperties.appendAttribute('objType', 'beam')
        for b in self.beams:
            webPlane = self.getColumnWebMidPlane()
            angleWithWeb = webPlane.getAngleWithVector3d(b.iVector)
            columnShape = self.getColumnShape()
            columnHalfB = columnShape.getFlangeWidth() / 2.0
            columnHalfH = columnShape.h() / 2.0
            origin = self.getOrigin()
            beamOrientation = b.getOrientation(origin)
            if (abs(angleWithWeb) <
                    1e-3):  # beam parallel to web => flange beam.
                beam_label = 'flange_beam'
                b.connectedTo = 'flange'
                tf = columnShape.getFlangeThickness()
                offset = (25e-3 + columnHalfH - tf / 2.0) * beamOrientation
            else:  # beam normal to web  => web beam
                beam_label = 'web_beam'
                b.connectedTo = 'web'
                offset = (20e-3 + columnHalfB) * beamOrientation
            beamShapeProperties.appendAttribute('beamLabel', beam_label)
            beamOrigin = origin + offset * b.iVector  # beam direction
            retval.extend(
                b.getMemberBlocks(origin, beamOrigin, factor,
                                  beamShapeProperties))
        return retval
Ejemplo n.º 8
0
    def getBlocks(self, blockProperties=None):
        ''' Return the block decomposition of the base plate.

        :param blockProperties: labels and attributes to assign to the newly created blocks.
        '''
        retval = bte.BlockData()
        contour = self.getContour().getVertexList()
        plateProperties = bte.BlockProperties.copyFrom(blockProperties)
        plateProperties.appendAttribute('objType', 'baseplate')
        points = list()
        for p2d in contour:
            points.append(geom.Pos3d(p2d.x, p2d.y, 0.0))
        blk = retval.blockFromPoints(points,
                                     plateProperties,
                                     thickness=self.t,
                                     matId=self.steel.name)
        ownerId = 'f' + str(blk.id)  # Hole owner.
        boltGroup = 'joint_' + plateProperties.getAttribute(
            'jointId')  # Joint id.
        boltGroup += '_' + plateProperties.getAttribute('objType')
        holeProperties = bte.BlockProperties.copyFrom(plateProperties)
        holeProperties.appendAttribute('boltGroup', boltGroup)
        blk.holes = self.anchorGroup.getHoleBlocks(
            self.getLocalRefSys(),
            blockProperties=holeProperties,
            ownerId=ownerId)
        retval.extend(blk.holes)
        return retval
Ejemplo n.º 9
0
    def getGussetBlocks(self,
                        verticalWeldLegSize,
                        horizontalWeldLegSize,
                        blockProperties=None):
        ''' Return the blocks that define the gusset.

        :param verticalWeldLegSize: leg size for the vertical welds.
        :param horizontalWeldLegSize: leg size for the horizontal welds.
        :param blockProperties: labels and attributes to assign to the newly created blocks.
        '''
        retval = bte.BlockData()
        gussetPlateProperties = bte.BlockProperties.copyFrom(blockProperties)
        blk = retval.blockFromPoints(
            self.contour,
            blockProperties=gussetPlateProperties,
            thickness=self.boltedPlateTemplate.thickness,
            matId=self.boltedPlateTemplate.steelType.name)
        holeProperties = bte.BlockProperties.copyFrom(blockProperties)
        ownerId = 'f' + str(blk.id)
        holeProperties.appendAttribute('ownerId', ownerId)  # Hole owner id.
        blk.holes = self.getHoleBlocks(
            ownerId, blockProperties=holeProperties
        )  # Get the hole blocks for the new plate
        retval.extend(blk.holes)
        kPointIds = blk.getKPointIds()
        blk.weldBlocks = self.getWeldBlocks(
            ownerId, kPointIds, verticalWeldLegSize, horizontalWeldLegSize,
            blockProperties)  # Get the weld blocks for the new plate
        retval.extend(blk.weldBlocks)
        return retval
Ejemplo n.º 10
0
    def getWeldBlocks(self,
                      ownerId,
                      kPointIds,
                      verticalWeldLegSize,
                      horizontalWeldLegSize,
                      blockProperties=None):
        ''' Return the blocks representing the welds.

        :param ownerId: identifier of the face with the welds.
        :param kPointIds: identifiers of the points at weld ends.
        :param verticalWeldLegSize: leg size for the vertical welds.
        :param horizontalWeldLegSize: leg size for the horizontal welds.
        :param blockProperties: labels and attributes to assign to the newly created blocks.
        '''
        retval = bte.BlockData()
        weldProperties = bte.BlockProperties.copyFrom(blockProperties)
        weldProperties.appendAttribute('objType', 'weld')
        weldProperties.appendAttribute('ownerId', ownerId)  # Weld owner id.
        weldLinesIndexes = self.getWeldLinesIndexes(verticalWeldLegSize,
                                                    horizontalWeldLegSize)
        for l in weldLinesIndexes:
            pA = kPointIds[l[0]]
            pB = kPointIds[l[1]]
            weldLegSize = l[2]
            weldProperties.appendAttribute('legSize', weldLegSize)
            weldBlk = bte.BlockRecord(id=-1,
                                      typ='line',
                                      kPoints=[pA, pB],
                                      blockProperties=weldProperties,
                                      thk=None)
            retval.appendBlock(weldBlk)
        return retval
Ejemplo n.º 11
0
    def getBeamShapeBlocks(self, factor, blockProperties=None):
        ''' Return the faces of the beams.

        :param factor: factor multiplies the unary direction vector
                       of the member to define its extrusion 
                       direction and lenght.
        :param blockProperties: labels and attributes to assign to the newly created blocks.
        '''
        retval = bte.BlockData()
        beamBlocks = super(Connection, self).getBeamShapeBlocks(factor)
        retval.extend(beamBlocks)
        plateProperties = bte.BlockProperties.copyFrom(blockProperties)
        plateProperties.appendAttribute('objType', 'flange_plate')
        # Flange plates.
        for b in self.beams:
            flangePlate = b.getFlangeBoltedPlate(self.boltSteel)
            origin = self.getOrigin()
            print('origin: ', origin, ' beam origin: ', b.memberOrigin)
            baseVectors = b.getDirection(origin)
            halfH = (b.shape.h() + b.shape.getFlangeThickness() +
                     flangePlate.thickness) / 2.0
            halfD = flangePlate.length / 2.0
            print('half H:', halfH * 1e3, 'mm')
            print('half D:', halfD * 1e3, 'mm')
            # Top plate
            topPlateCenter = b.memberOrigin + halfH * baseVectors[
                1] + halfD * baseVectors[0]
            topPlateRefSys = geom.Ref3d3d(topPlateCenter, baseVectors[0],
                                          baseVectors[2])
            topPlateBlocks = flangePlate.getBlocks(
                refSys=topPlateRefSys, blockProperties=plateProperties)
            retval.extend(topPlateBlocks)
            # Holes in top flange
            print('has holes: ', topPlateBlocks.hasHoles())
            holesList = topPlateBlocks.getHoles()
            for holes in holesList:
                for key in holes.points:
                    p = holes.points[key]
                    objType = p.getAttribute('objType')
                    if (objType == 'hole_center'):
                        pos = geom.Pos3d(p.getX(), p.getY(), p.getZ())
                        diameter = p.getAttribute('diameter')
                        nearestFace = beamBlocks.getNearest(pos)
                        posInFlange = nearestFace.getGeomObject(
                            beamBlocks.points).getPlane().getPos3dProjection(
                                pos)
                        dist = posInFlange.dist(pos)
                        print(pos, objType, diameter, nearestFace.id, dist)
                        XXX
            quit()
            # Bottom plate
            bottomPlateCenter = b.memberOrigin - halfH * baseVectors[
                1] + halfD * baseVectors[0]
            bottomPlateRefSys = geom.Ref3d3d(bottomPlateCenter, baseVectors[0],
                                             baseVectors[2])
            bottomPlateBlocks = flangePlate.getBlocks(
                refSys=bottomPlateRefSys, blockProperties=plateProperties)
            retval.extend(bottomPlateBlocks)
        return retval
Ejemplo n.º 12
0
    def getBlocks(self, blockProperties):
        ''' Return the block decomposition of the base plates.

        :param blockProperties: labels and attributes to assign to the newly created blocks.
        '''
        retval = bte.BlockData()
        for key in self.basePlates:
            basePlate = self.basePlates[key]
            retval.extend(basePlate.getBlocks(blockProperties))
        return retval
Ejemplo n.º 13
0
Archivo: bolts.py Proyecto: smohaorg/xc
    def getAnchorBlock(self, refSys= geom.Ref3d3d(), blockProperties= None):
        ''' Return the hole contour and hole center as block topology entities.

        :param refSys: coordinate reference system.
        :param blockProperties: labels and attributes to assign to the newly created blocks.
        '''
        retval= bte.BlockData()
        blk= super(AnchorBase, self).getBoltBlock(refSys, blockProperties)
        retval.extend(blk)
        # Anchor point.
        anchorPointProperties= self.getAnchorPointBlockProperties(blockProperties)
        pA= blk.topPoint
        center3d= geom.Pos3d(pA.coords[0], pA.coords[1], pA.coords[2])
        pB= retval.appendPoint(-1, center3d.x, center3d.y, center3d.z-1*self.diameter, pointProperties= anchorPointProperties)
        boltBlk= bte.BlockRecord(id= -1, typ= 'line', kPoints= [pA.id, pB])
        id= retval.appendBlock(boltBlk)
        return retval
Ejemplo n.º 14
0
Archivo: bolts.py Proyecto: smohaorg/xc
    def getBoltBlock(self, refSys= geom.Ref3d3d(), blockProperties= None):
        ''' Return the hole contour and hole center as block topology entities.

        :param refSys: coordinate reference system.
        :param blockProperties: labels and attributes to assign to the newly created blocks.
        '''
        retval= bte.BlockData()
        # Hole vertices.
        holeProperties= bte.BlockProperties.copyFrom(blockProperties)
        holeProperties.appendAttribute('objType', 'hole')
        octagon= self.getHoleAsPolygon(refSys, nSides= 8).getVertexList()
        blk= retval.blockFromPoints(octagon, holeProperties)
        # Hole center.
        centerProperties= self.getHoleCenterBlockProperties(blockProperties, blk.id)
        center3d= refSys.getPosGlobal(self.pos3d)
        pA= retval.appendPoint(-1, center3d.x, center3d.y, center3d.z, pointProperties= centerProperties)
        retval.topPoint= retval.points[pA]
        return retval
Ejemplo n.º 15
0
def createHolesOnMemberBlocks(templateHoles, memberBlocks, boltProperties,
                              materialsModuleName):
    ''' Projects the holes in the argument onto the surfaces
        of the member blocks to create the holes in those
        surfaces.

    :param templateHoles: holes that will be projected on the
                          member surfaces, typically from a bolted
                          plate that will be attached to the
                          member.
    :param memberBlocks: surfaces corresponding to the member plates:
                          flanges, web, etc. Those surfaces will receive
                          the new holes into them.
    :param blockProperties: labels and attributes to assign to the newly created blocks.
    :param materialsModuleName: name of the module that contains the material for the new bolts.
    '''
    retval = bte.BlockData()
    # Import the materials module
    matModule = importlib.import_module(materialsModuleName)
    for holes in templateHoles:
        for key in holes.points:
            p = holes.points[key]
            objType = p.getAttribute('objType')
            if (objType == 'hole_center'):
                pos = geom.Pos3d(p.getX(), p.getY(), p.getZ())
                boltDiameter = p.getAttribute('diameter')
                boltMaterialId = p.getAttribute('boltMaterial')
                boltMaterial = getattr(matModule, boltMaterialId)
                nearestFace = memberBlocks.getNearest(pos)
                boltProperties.appendAttribute(
                    'ownerId', 'f' + str(nearestFace.id))  # Hole owner
                nearestFacePlane = nearestFace.getGeomObject(
                    memberBlocks.points).getPlane()
                posInFlange = nearestFacePlane.getPos3dProjection(pos)
                refSys = geom.Ref3d3d(posInFlange, nearestFacePlane.getBase1(),
                                      nearestFacePlane.getBase2())
                bolt = matModule.BoltFastener(diameter=boltDiameter,
                                              steelType=boltMaterial,
                                              pos3d=geom.Pos3d(0, 0, 0))
                boltBlk = bolt.getBoltBlock(refSys, boltProperties)
                retval.extend(boltBlk)
    return retval
Ejemplo n.º 16
0
    def getBlocks(self,
                  refSys=geom.Ref3d3d(),
                  blockProperties=None,
                  loadTag=None,
                  loadDirI=None,
                  loadDirJ=None,
                  loadDirK=None):
        ''' Return the blocks that define the plate for the
            diagonal argument.

        :param blockProperties: labels and attributes to assign to the newly created blocks.
        :param loadTag: tag of the applied loads in the internal forces file.
        :param loadDirI: I vector of the original element. Vector that 
                         points to the loaded side of the plate.
        :param loadDirJ: J vector of the of the original element.
        :param loadDirK: K vector of the of the original element.
        '''
        retval = bte.BlockData()
        plateProperties = bte.BlockProperties.copyFrom(blockProperties)
        plateProperties.appendAttribute('objType', 'bolted_plate')
        if (loadTag):
            plateProperties.appendAttribute('loadTag', loadTag)
            plateProperties.appendAttribute(
                'loadDirI', [loadDirI.x, loadDirI.y, loadDirI.z])
            plateProperties.appendAttribute(
                'loadDirJ', [loadDirJ.x, loadDirJ.y, loadDirJ.z])
            plateProperties.appendAttribute(
                'loadDirK', [loadDirK.x, loadDirK.y, loadDirK.z])
        # Get the plate contour
        contourVertices = self.getContour(refSys)
        blk = retval.blockFromPoints(contourVertices,
                                     plateProperties,
                                     thickness=self.thickness,
                                     matId=self.steelType.name)
        # Get the hole blocks for the new plate
        holeProperties = bte.BlockProperties.copyFrom(blockProperties)
        holeProperties.appendAttribute('objType', 'hole')
        holeProperties.appendAttribute('ownerId', 'f' + str(blk.id))
        blk.holes = self.boltArray.getHoleBlocks(refSys, holeProperties)
        retval.extend(blk.holes)
        return retval
Ejemplo n.º 17
0
    def getBlocks(self, verticalWeldLegSize, horizontalWeldLegSize,
                  boltedPlate, diagonal, origin, blockProperties):
        ''' Return the blocks corresponding to the gusset plate connection
            and the single or double plates bolted to it.


        :param verticalWeldLegSize: leg size for the vertical welds.
        :param horizontalWeldLegSize: leg size for the horizontal welds.
        :param boltedPlate: bolted plate that will be attached 
                            to this one.
        :param diagonal: element that provide the internal forces in the
                         bolted plate edge.
        :param blockProperties: labels and attributes to assign to the newly created blocks.

        :return: return the blocks corresponding to the connection.
        '''
        retval = bte.BlockData()
        gussetPlateBlocks = self.getGussetBlocks(verticalWeldLegSize,
                                                 horizontalWeldLegSize,
                                                 blockProperties)
        retval.extend(gussetPlateBlocks)
        distBetweenPlates1, attachedPlateBlocks1 = self.getBoltedPlateBlocks(
            boltedPlate, diagonal, origin, blockProperties,
            side=1)  # bolted plate at positive side.
        retval.extend(attachedPlateBlocks1)
        boltBlocks1 = bolted_plate.getBoltedPointBlocks(
            gussetPlateBlocks, attachedPlateBlocks1,
            abs(distBetweenPlates1))  # points linked by bolts.
        retval.extend(boltBlocks1)
        if (self.boltedPlateTemplate.doublePlate):
            distBetweenPlates2, attachedPlateBlocks2 = self.getBoltedPlateBlocks(
                boltedPlate, diagonal, origin, blockProperties,
                side=-1)  # bolted plate at negative side.
            retval.extend(attachedPlateBlocks2)
            boltBlocks2 = bolted_plate.getBoltedPointBlocks(
                gussetPlateBlocks, attachedPlateBlocks2,
                abs(distBetweenPlates2))  # points linked by bolts.
            retval.extend(boltBlocks2)
        return retval
Ejemplo n.º 18
0
    def getHoleBlocks(self, refSys=geom.Ref3d3d(), blockProperties=None):
        ''' Return octagons inscribed in the holes.

        :param refSys: coordinate reference system used to compute
                       the geometry of the holes.
        :param blockProperties: labels and attributes of the holes.
        '''
        localPos = self.getLocalPositions()
        holes = list()
        for pLocal in localPos:
            circle = geom.Circle2d(pLocal,
                                   self.bolt.getNominalHoleDiameter() / 2.0)
            octagon = circle.getInscribedPolygon(8, 0.0).getVertexList()
            holes.append((pLocal, octagon))
        retval = bte.BlockData()
        # Base points (A)
        for h in holes:
            # Hole vertices.
            holeVertices = list()
            for v in h[1]:
                p3d = geom.Pos3d(v.x, v.y, 0.0)
                holeVertices.append(refSys.getPosGlobal(p3d))
            blk = retval.blockFromPoints(holeVertices, blockProperties)
            # Hole center.
            centerProperties = bte.BlockProperties.copyFrom(blockProperties)
            centerProperties.appendAttribute('objType', 'hole_center')
            centerProperties.appendAttribute('ownerId', 'f' +
                                             str(blk.id))  # Hole center owner.
            centerProperties.appendAttribute('diameter', self.bolt.diameter)
            centerProperties.appendAttribute('boltMaterial',
                                             self.bolt.steelType.name)
            center = h[0]
            center3d = refSys.getPosGlobal(geom.Pos3d(center.x, center.y, 0.0))
            retval.appendPoint(-1,
                               center3d.x,
                               center3d.y,
                               center3d.z,
                               pointProperties=centerProperties)
        return retval
Ejemplo n.º 19
0
#  1 +--------------------+ 2
#

points= preprocessor.getMultiBlockTopology.getPoints
CooMax= 10.0
pt1= points.newPntFromPos3d(geom.Pos3d(0.0,0.0,0.0))
pt2= points.newPntFromPos3d(geom.Pos3d(CooMax,0.0,0.0))
pt3= points.newPntFromPos3d(geom.Pos3d(CooMax,CooMax,0.0))
pt4= points.newPntFromPos3d(geom.Pos3d(0.0,CooMax,0.0))

surfaces= preprocessor.getMultiBlockTopology.getSurfaces
s= surfaces.newQuadSurfacePts(pt1.tag,pt2.tag,pt3.tag,pt4.tag)

xcTotalSet= modelSpace.getTotalSet()
import ezdxf
bdTotal= bte.BlockData(verbosity= 0)
numEntitiesRead= bdTotal.readFromXCSet(xcTotalSet)
ok1= (abs(numEntitiesRead-8)==0)
# Avoid info messages
logging.getLogger(ezdxf.__name__).setLevel(logging.ERROR)
bdTotal.writeDxfFile(outputFileName)
import os
fileSize= os.path.getsize(outputFileName)
ok2= (fileSize>3000) and (fileSize<20000) # file exists and has a size that
                                          # seems reasonable.

'''
print(numEntitiesRead)
print(fileSize)
'''
Ejemplo n.º 20
0
    def getGussetBlocksForDiagonal(self, diagonal, blockProperties=None):
        ''' Return the blocks that define the gusset for the
            diagonal argument.

        :param diagonal: diagonal to get the gusset for.
        :param blockProperties: labels and attributes to assign to the newly created blocks.
        '''
        def getHalfChamferVector(diagonal):
            ''' Return a vector normal to the diagonal contained in
                a vertical plane.'''
            iVector = diagonal.iVector
            # Horizontal vector perpendicular to the projection
            # of iVector on the horizontal plane.
            perpHoriz = geom.Vector3d(-iVector.y, iVector.x, 0.0)
            return iVector.cross(perpHoriz).normalized()

        retval = bte.BlockData()
        origin = self.getOrigin()
        baseVectors = diagonal.getDirection(origin)
        extrusionLength = self.columnLengthFactor
        p1 = origin + extrusionLength * baseVectors[0]
        webPlane = self.getColumnWebMidPlane()
        angleWithWeb = webPlane.getAngleWithVector3d(baseVectors[0])
        dgSegment = geom.Segment3d(origin, p1)
        gussetLength = self.gussetLengthFactor * self.boltedPlateTemplate.length
        halfChamferVector = getHalfChamferVector(diagonal)
        halfChamfer = self.boltedPlateTemplate.width / 2.0 * halfChamferVector
        verticalWeldLegSize = 0.0  # leg size for the vertical welds.
        horizontalWeldLegSize = math.floor(
            self.getHorizontalWeldLegSize() *
            1e3) / 1e3  # leg size for the horizontal welds.
        if (abs(angleWithWeb) <
                1e-3):  # diagonal parallel to web => flange gusset.
            verticalWeldLegSize = math.floor(
                self.getFlangeLegSize() * 1e3) / 1e3
            objType = 'flange_gusset'
            gussetPlate = self.getFlangeGussetPlate(
                baseVectors=baseVectors,
                diagSegment=dgSegment,
                gussetLength=gussetLength,
                halfChamfer=halfChamfer,
                slope=self.flangeGussetLegsSlope)
        else:  # diagonal normal to web  => web gusset
            verticalWeldLegSize = math.floor(self.getWebLegSize() * 1e3) / 1e3
            objType = 'web_gusset'
            gussetPlate = self.getWebGussetPlate(
                baseVectors=baseVectors,
                diagSegment=dgSegment,
                gussetLength=gussetLength,
                halfChamfer=halfChamfer,
                bottomLegSlope=self.webGussetBottomLegSlope)
        # Attached plate.
        boltedPlate = self.getBoltedPlateTemplate()
        gussetPlateProperties = bte.BlockProperties.copyFrom(blockProperties)
        gussetPlateProperties.appendAttribute('objType', objType)

        gussetPlateBlocks = gussetPlate.getBlocks(
            verticalWeldLegSize,
            horizontalWeldLegSize,
            boltedPlate,
            diagonal,
            self.getOrigin(),
            blockProperties=gussetPlateProperties)
        retval.extend(gussetPlateBlocks)
        return retval
Ejemplo n.º 21
0
        v = np.cross(v1, v2)
        print key, vertices, v


deckOrientationVectors = [np.array([0, 1, 0]), np.array([0, 0, 1])]  #[X,Z]
deckFaces = checkFacesOrientation(deckFaces, deckOrientationVectors)
#printFaces(deckFaces)
dockOrientationVectors = [np.array([0, 1, 0]), np.array([-1, 0, 0])]  #[X,Z]
dockFaces = checkFacesOrientation(dockFaces, dockOrientationVectors)
#printFaces(dockFaces)
parapetOrientationVectors = [np.array([0, 1, 0]), np.array([1, 0, 0])]  #[X,Z]
parapetFaces = checkFacesOrientation(parapetFaces, parapetOrientationVectors)
#printFaces(parapetFaces)

#Block topology
blocks = bte.BlockData()
blocks.name = 'Gilamont_dock'

counter = 0
for p in kPoints:
    blocks.appendPoint(id=counter, x=p[0], y=p[1], z=p[2])
    counter += 1
faceGroups = [deckFaces, dockFaces, parapetFaces]

counter = 0
for key in lines:
    line = lines[key]
    block = bte.BlockRecord(counter, 'line', line, [key])
    blocks.appendBlock(block)
    counter += 1