Exemple #1
0
def get_candidate_2Dquads(sisRef, points, tol):
    '''Return candidate quads in 2D.'''
    # Compute relative coordinates.
    x_i= FloatList(tol)
    y_i= FloatList(tol)
    for p in points:
        pRel= sisRef.getPosLocal(geom.Pos3d(p[0],p[1],p[2]))
        x_i.append(pRel[0])
        y_i.append(pRel[1])
    x_i.sort()
    nx= len(x_i)
    y_i.sort()
    ny= len(y_i)
    # Create candidate surfaces.
    candidates= list()
    for i in range(0,nx-1):
        for j in range(0, ny-1):
            x= x_i[i]; y= y_i[j]
            p1= geom.Pos2d(x,y)
            x= x_i[i+1]; y= y_i[j]
            p2= geom.Pos2d(x,y)
            x= x_i[i+1]; y= y_i[j+1]
            p3= geom.Pos2d(x,y)
            x= x_i[i]; y= y_i[j+1]
            p4= geom.Pos2d(x,y)
            face= geom.Polygon2d()
            face.appendVertex(p1)
            face.appendVertex(p2)
            face.appendVertex(p3)
            face.appendVertex(p4)
            candidates.append(face)
    return candidates
Exemple #2
0
def polygon(xCent, yCent, Lx, Ly):
    pol = geom.Polygon2d()
    pol.appendVertex(geom.Pos2d(xCent - Lx / 2.0, yCent - Ly / 2.0))
    pol.appendVertex(geom.Pos2d(xCent - Lx / 2.0, yCent + Ly / 2.0))
    pol.appendVertex(geom.Pos2d(xCent + Lx / 2.0, yCent + Ly / 2.0))
    pol.appendVertex(geom.Pos2d(xCent + Lx / 2.0, yCent - Ly / 2.0))
    return pol
Exemple #3
0
def decompose_polyface(polyface, tol= .01):
    '''Return the quadrilateral surfaces that
       compose the polyface.
    '''
    # Compute the reference axis.
    points= geom.polyPos3d()
    for face in polyface:
        for pt in face:
            points.append(geom.Pos3d(pt[0],pt[1],pt[2]))
    sisRef= get_polyface_points_axis(points)

    # Create candidate surfaces.
    candidates= get_candidate_2Dquads(sisRef,points, tol)

    # Create polygons in local coordinates.
    polyfaces2d= list()
    for face in polyface:
        polygon= geom.Polygon2d()
        for pt in face:
            ptLocal= sisRef.getPosLocal(geom.Pos3d(pt[0],pt[1],pt[2]))
            polygon.appendVertex(geom.Pos2d(ptLocal.x,ptLocal.y))
        polyfaces2d.append(polygon)
    # Select surfaces inside polyface.
    selected= list()
    for face in candidates:
        c= face.getCenterOfMass()
        for polyface in polyfaces2d:
            if(polyface.In(c,tol/5.0)):
                selected.append(face)
                break
    return quads2d_to_global_coordinates(sisRef, selected)
Exemple #4
0
def decompose_polyline(polyline, tol= .01):
    '''Return the quadrilateral surfaces that
       compose the polyline.
    '''
    retval= list()
    if((len(polyline.points)>2) and polyline.is_closed):
        # Compute the local axis.
        points= list()
        for pt in polyline.points:
            points.append([pt[0],pt[1],pt[2]])            
        sisRef= get_polygon_axis(points,tol)

        # Create candidate surfaces.
        candidates= get_candidate_2Dquads(sisRef, points, tol)

        # Create polygon in local coordinates.
        polygon= geom.Polygon2d()
        for pt in polyline:
            ptLocal= sisRef.getPosLocal(geom.Pos3d(pt[0],pt[1],pt[2]))
            polygon.appendVertex(geom.Pos2d(ptLocal.x,ptLocal.y))

        # Select surfaces inside polygon.
        selected= list()
        for face in candidates:
            c= face.getCenterOfMass()
            if(polygon.In(c,tol/5.0)):
                selected.append(face)
        retval= quads2d_to_global_coordinates(sisRef, selected)

    return retval
Exemple #5
0
 def getVehicleBoundary(self):
     '''Return the boundary of the vehicle.'''
     retval= geom.Polygon2d()
     tmp= self.getVehicleBoundaryPositions()
     for p in tmp:
         retval.appendVertex(geom.Pos2d(p.x,p.y))
     return retval
Exemple #6
0
    def getMinimumCover(self):
        ''' Return the minimum of the distances between the centers
            of the holes and the plate contour.

        :param loadDirection: direction of the load.
        '''
        contour = geom.Polygon2d(self.getContour2d())
        return self.boltArray.getMinimumCover(contour)
Exemple #7
0
 def getCenteredVehicleBoundary(self):
     '''Return the boundary of the vehicle with respect to
        the load centroid.'''
     retval= geom.Polygon2d()
     tmp= self.getVehicleBoundaryRelativePositions()
     for p in tmp:
         retval.appendVertex(p)
     return retval
Exemple #8
0
    def getMinimumCoverInDir(self, direction):
        ''' Return the minimum of the distances between the centers
            of the holes and the intersection of the ray from that
            point in the direction argument with the plate contour.

        :param direction: direction of the rays.
        '''
        contour = geom.Polygon2d(self.getContour2d())
        return self.boltArray.getMinimumCoverInDir(contour, direction)
Exemple #9
0
def rect2DPolygon(xCent,yCent,Lx,Ly):
    '''Rectangular polygon
    '''
    pol=geom.Polygon2d()
    pol.appendVertex(geom.Pos2d(xCent-Lx/2.0,yCent-Ly/2.0))
    pol.appendVertex(geom.Pos2d(xCent-Lx/2.0,yCent+Ly/2.0))
    pol.appendVertex(geom.Pos2d(xCent+Lx/2.0,yCent+Ly/2.0))
    pol.appendVertex(geom.Pos2d(xCent+Lx/2.0,yCent-Ly/2.0))
    return pol
Exemple #10
0
    def getClearDistances(self, loadDirection):
        ''' Return the clear distance between the edge of the hole and
            the edge of the adjacent hole or edge of the material.

        :param loadDirection: direction of the load.
        '''
        retval = list()
        contour = geom.Polygon2d(self.getContour2d())
        retval = self.boltArray.getClearDistances(contour, loadDirection)
        return retval
Exemple #11
0
 def getContour(self):
     ''' Return the base plate contour. '''
     retval= geom.Polygon2d()
     deltaX= self.B/2.0
     deltaY= self.N/2.0
     origin2d= geom.Pos2d(self.origin.x, self.origin.y)
     retval.appendVertex(origin2d+geom.Vector2d(deltaX+self.offsetB,deltaY+self.offsetN))
     retval.appendVertex(origin2d+geom.Vector2d(-deltaX+self.offsetB,deltaY+self.offsetN))
     retval.appendVertex(origin2d+geom.Vector2d(-deltaX+self.offsetB,-deltaY+self.offsetN))
     retval.appendVertex(origin2d+geom.Vector2d(deltaX+self.offsetB,-deltaY+self.offsetN))
     return retval
Exemple #12
0
def getA0cN(anchorPosition, hEf):
    '''
    Polígono que representa el influence area of an individual anchor according to clause 5.2.2.4 b) (figura 5.4a) of EOTA TR029.

    :param anchorPosition: anchor position.
    :param hEf: effective anchorage depth (m).
    '''
    halfSideA0cN= getScrN(hEf)/2
    retval= geom.Polygon2d()
    retval.appendVertex(geom.Pos2d(anchorPosition.x-halfSideA0cN,anchorPosition.y-halfSideA0cN))
    retval.appendVertex(geom.Pos2d(anchorPosition.x+halfSideA0cN,anchorPosition.y-halfSideA0cN))
    retval.appendVertex(geom.Pos2d(anchorPosition.x+halfSideA0cN,anchorPosition.y+halfSideA0cN))
    retval.appendVertex(geom.Pos2d(anchorPosition.x-halfSideA0cN,anchorPosition.y+halfSideA0cN))
    return retval
Exemple #13
0
def getA0pN(d,anchorPosition, hEf, tauRkUcr):
    '''
     Polígono que representa el influence area of an individual anchor according to clause 5.2.2.3 b) (figura 5.1) of EOTA TR029.

     :param d: anchor diameter (m).
     :param anchorPosition: Posición del del perno.
     :param hEf: effective anchorage depth (m).
     :param tauRkUcr: Characteristic bond resistance for non-cracked concrete (must be taken from relevant ETA) (Pa).
    '''   
    halfSideA0pN= getCcrNp(d,hEf,tauRkUcr)
    retval= geom.Polygon2d()
    retval.appendVertex(geom.Pos2d(anchorPosition.x-halfSideA0pN,anchorPosition.y-halfSideA0pN))
    retval.appendVertex(geom.Pos2d(anchorPosition.x+halfSideA0pN,anchorPosition.y-halfSideA0pN))
    retval.appendVertex(geom.Pos2d(anchorPosition.x+halfSideA0pN,anchorPosition.y+halfSideA0pN))
    retval.appendVertex(geom.Pos2d(anchorPosition.x-halfSideA0pN,anchorPosition.y+halfSideA0pN))
    return retval
Exemple #14
0
def getA0spN(anchorPosition, CcrSp):
    '''
    Polygon that represents the influence area of an individual anchor
    according to clause 5.2.2.6 b) of EOTA TR029.

    :param anchorPosition: anchor position.
    :param CcrSp: edge distance for ensuring the transmission of the
                  characteristic tensile resistance of a single
                  anchor without spacing and edge effects in case of 
                  splitting failure (m).
    '''
    retval= geom.Polygon2d()
    retval.appendVertex(geom.Pos2d(anchorPosition.x-CcrSp,anchorPosition.y-CcrSp))
    retval.appendVertex(geom.Pos2d(anchorPosition.x+CcrSp,anchorPosition.y-CcrSp))
    retval.appendVertex(geom.Pos2d(anchorPosition.x+CcrSp,anchorPosition.y+CcrSp))
    retval.appendVertex(geom.Pos2d(anchorPosition.x-CcrSp,anchorPosition.y+CcrSp))
    return retval
Exemple #15
0
x= list()
results5_16= list()
Fv= 0.0 #Friction.
for i in range(0,11):
  stepHeight= H/10.0
  z= i*stepHeight
  k= earth_pressure.k_janssen(k0,delta,B,z)
  sigma_h= k*gammaSoil*z
  fv= sigma_h*math.tan(delta)*stepHeight
  Fv+= fv
  x.append(z)r
  results5_16.append(sigma_h)

totalEarthPressure= scipy.integrate.simps(results5_16,x)

earthPressurePolygon=geom.Polygon2d()

for cx,cy in zip(x,results5_16):
  earthPressurePolygon.appendVertex(geom.Pos2d(cx,cy))

earthPressurePolygon.appendVertex(geom.Pos2d(x[-1],0.0))
earthPressurePolygon.appendVertex(geom.Pos2d(0,0))
earthPressurePolygonCentroid= earthPressurePolygon.getCenterOfMass()
earthPressureVector= geom.Vector2d(-totalEarthPressure,-Fv)
earthPressureTail= geom.Pos2d(foundationWidth,H-earthPressurePolygonCentroid.x)
earthPressureSVS= geom.SlidingVectorsSystem2d(geom.SlidingVector2d(earthPressureTail,earthPressureVector))
print 'earthPressureSVS: ', earthPressureSVS

'''
print 'B/H= 0.1', results5_16
'''
Exemple #16
0
pierConcr = SIA262_materials.c55_67
pierMat = pierConcr.defElasticMembranePlateSection(preprocessor, "pierMat",
                                                   pierThickness)
#pierMat.E/=6.0 # Analysis of displacements.

beamConcr = SIA262_materials.c60_75
polT4 = geom.Polygon2d([
    geom.Pos2d(0.23, 0.0),
    geom.Pos2d(0.23, 0.1),
    geom.Pos2d(0.06, 0.14),
    geom.Pos2d(0.06, 0.52),
    geom.Pos2d(0.35, 0.55),
    geom.Pos2d(0.35, 0.65),
    geom.Pos2d(-0.645, 0.65),
    geom.Pos2d(-0.645, 0.59),
    geom.Pos2d(-0.06, 0.52),
    geom.Pos2d(-0.06, 0.14),
    geom.Pos2d(-0.23, 0.1),
    geom.Pos2d(-0.23, 0.0),
    geom.Pos2d(-0.025, 0.0),
    geom.Pos2d(-0.025, 0.03),
    geom.Pos2d(0.025, 0.03),
    geom.Pos2d(0.025, 0.0),
    geom.Pos2d(0.23, 0.0)
])
polT5 = geom.Polygon2d([
    geom.Pos2d(0.23, 0.0),
    geom.Pos2d(0.23, 0.1),
    geom.Pos2d(0.06, 0.14),
    geom.Pos2d(0.06, 0.52),
    geom.Pos2d(0.645, 0.59),
Exemple #17
0
__author__= "Luis C. Pérez Tato (LCPT)"
__copyright__= "Copyright 2019, LCPT"
__license__= "GPL"
__version__= "3.0"
__email__= "*****@*****.**"

# Data
gammaMs= 1.4 # Partial safety factor for steel.
gammaMc= 2.1 # Partial safety factor for concrete.
boltDiameter= 12e-3 # Bar diameter in meters.
boltArea= math.pi*(boltDiameter/2.0)**2 # Bar area in square meters.
h= 100e-3 # Concrete element thickness.
hef= 70e-3 # Effective anchor depth.
anchorPosition=  geom.Pos2d(.100,0) # Anchor position
baseMaterialContour=  geom.Polygon2d() # Contour of concrete element.
baseMaterialContour.appendVertex(geom.Pos2d(0,-1))
baseMaterialContour.appendVertex(geom.Pos2d(1,-1))
baseMaterialContour.appendVertex(geom.Pos2d(1,1))
baseMaterialContour.appendVertex(geom.Pos2d(0,1))
spacing= 150e-3


fuk= 550e6 # Characteristic steel ultimate tensile strength (Pa).
tauRk= 1.09*15e6 # Characteristic bond strength for non-cracked concrete (taken from ETA-07/0260 table 11).
k1= 10.1 # 7.2 for cracked concrete and 10.1 for non-cracked concrete.
fckCube= 50e6 # Caracteristic concrete compression strength measured on cubes with a side length of 150 mm.

# Strength of the anchor itself.
NRds= 28e3
Exemple #18
0
# -*- coding: utf-8 -*-
''' Test of cover calculations of a point inside a polygon.'''
from __future__ import print_function
from __future__ import division

import math
import xc_base
import geom

plg = geom.Polygon2d()

#        +--------+
#        |        |
#        |        |
#        |        |
#        |        |
#        +--------+

plg.appendVertex(geom.Pos2d(0, 0))
plg.appendVertex(geom.Pos2d(1, 0))
plg.appendVertex(geom.Pos2d(1, 1))
plg.appendVertex(geom.Pos2d(0, 1))
area = plg.getArea()

p = geom.Pos2d(0.5, 0.5)
cover = plg.getCover(p)
cover2 = plg.getCover(p, geom.Vector2d(0.0, -1.0))
cover3 = plg.getCover(p, geom.Vector2d(1.0, -1.0))
cover3ref = math.sqrt(2) / 2.0

ratio1 = abs(area - 1)
Exemple #19
0
#     xcSet:  set that contains the lines
#     loadVector: xc.Vector with the six components of the load:
#                 xc.Vector([Fx,Fy,Fz,Mx,My,Mz]).

deadLoadKerb = loads.UniformLoadOnLines(name='deadLoadKerb',
                                        xcSet=kerbs,
                                        loadVector=xc.Vector(
                                            [0, 0, -linKerb, 0, 0, 0]))
deadLoadBarr = loads.UniformLoadOnLines(name='deadLoadKerb',
                                        xcSet=barrs,
                                        loadVector=xc.Vector(
                                            [0, 0, -linBarrier, 0, 0, 0]))

# *Traffic loads
# Sets definition
poly_lane_Bern = geom.Polygon2d()
poly_lane_Bern.appendVertex(geom.Pos2d(xList_deck[1], 0))
poly_lane_Bern.appendVertex(geom.Pos2d(xList_deck[1], yList_deck[lastYpos]))
poly_lane_Bern.appendVertex(geom.Pos2d(xList_deck[1] + 3,
                                       yList_deck[lastYpos]))
poly_lane_Bern.appendVertex(geom.Pos2d(xList_deck[1] + 3, 0))
lane_Bern = sets.set_included_in_orthoPrism(preprocessor=prep,
                                            setInit=deck,
                                            prismBase=poly_lane_Bern,
                                            prismAxis='Z',
                                            setName='lane_Bern')

poly_lane_Lausanne = geom.Polygon2d()
poly_lane_Lausanne.appendVertex(geom.Pos2d(xList_deck[1] + 3, 0))
poly_lane_Lausanne.appendVertex(
    geom.Pos2d(xList_deck[1] + 3, yList_deck[lastYpos]))
Exemple #20
0
__email__ = "*****@*****.**"


def sqr(a):
    return a * a


# Datos
gammaMs = 1.4  # Partial safety factor for steel.
gammaMc = 2.1  # Partial safety factor for concrete.
diamBarra = 25e-3  # Bar diameter in meters.
areaBarra = math.pi * sqr(diamBarra / 2.0)  # Bar area in square meters.
h = 274e-3  # Concrete element thickness.
hef = 210e-3  # Effective anchor depth.
posAnc = geom.Pos2d(.135, 0)  # Anchor position
contornoPiezaSoporte = geom.Polygon2d()  # Contour of concrete element.
contornoPiezaSoporte.appendVertex(geom.Pos2d(0, -1))
contornoPiezaSoporte.appendVertex(geom.Pos2d(1, -1))
contornoPiezaSoporte.appendVertex(geom.Pos2d(1, 1))
contornoPiezaSoporte.appendVertex(geom.Pos2d(0, 1))

fuk = 550e6  # Characteristic steel ultimate tensile strength (Pa).
tauRk = 7.5e6  # Characteristic bond strength (taken from ETA-05/0051 table 11).
tauRkUcr = 7.5e6  # Characteristic bond strength for non-cracked concrete.
k1 = 10.1  # 7.2 for cracked concrete and 10.1 for non-cracked concrete.
fckCube = 25e6  # Caracteristic concrete compression strength measured on cubes with a side length of 150 mm.
# Strength of the anchor itself.
NRds = EOTA_TR029_limit_state_checking.axialResistanceSteelFailure(
    areaBarra, fuk) / gammaMs

# Edge distance influence
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division

import xc_base
import geom
import matplotlib.pyplot as plt

pol = geom.Polygon2d()

#        +----+
#        |    |
#        |    |
#   +----+    +----+
#   |              |
#   |              |
#   +----+    +----+
#        |    |
#        |    |
#        +----+

pol.appendVertex(geom.Pos2d(1, 0))
pol.appendVertex(geom.Pos2d(2, 0))
pol.appendVertex(geom.Pos2d(2, 1))
pol.appendVertex(geom.Pos2d(3, 1))
pol.appendVertex(geom.Pos2d(3, 2))
pol.appendVertex(geom.Pos2d(2, 2))
pol.appendVertex(geom.Pos2d(2, 3))
pol.appendVertex(geom.Pos2d(1, 3))
pol.appendVertex(geom.Pos2d(1, 2))
pol.appendVertex(geom.Pos2d(0, 2))
Exemple #22
0
print 'K= ', K
x = list()
earth_pressure = list()
Fv = 0.0  #Friction.
for i in range(0, 11):
    stepHeight = H / 10.0
    z = i * stepHeight
    sigma_h = K * gammaSoil * z
    fv = sigma_h * math.tan(delta) * stepHeight
    Fv += fv
    x.append(z)
    earth_pressure.append(sigma_h)

totalEarthPressure = scipy.integrate.simps(earth_pressure, x)

earthPressurePolygon = geom.Polygon2d()

for cx, cy in zip(x, earth_pressure):
    earthPressurePolygon.appendVertex(geom.Pos2d(cx, cy))

earthPressurePolygon.appendVertex(geom.Pos2d(x[-1], 0.0))
earthPressurePolygon.appendVertex(geom.Pos2d(0, 0))
earthPressurePolygonCentroid = earthPressurePolygon.getCenterOfMass()
earthPressureVector = geom.Vector2d(-totalEarthPressure, -Fv)
earthPressureTail = geom.Pos2d(B, H - earthPressurePolygonCentroid.x)
earthPressureSVS = geom.SlidingVectorsSystem2d(
    geom.SlidingVector2d(earthPressureTail, earthPressureVector))
print 'earthPressureSVS: ', earthPressureSVS

# Gravity wall.
foundationCenter = geom.Pos2d(B / 2.0, 0.0)
Exemple #23
0
def getPolygon(e):
    retval= geom.Polygon2d()
    with e.points('xyseb') as points:
        for p in points:
            retval.appendVertex(geom.Pos2d(p[0], p[1]))
    return retval
Exemple #24
0
# -*- coding: utf-8 -*-
from __future__ import print_function
import xc_base
import geom
pol1 = geom.Polygon2d()
pol1.appendVertex(geom.Pos2d(0, 0))
pol1.appendVertex(geom.Pos2d(1, 0))
pol1.appendVertex(geom.Pos2d(1, 1))
pol1.appendVertex(geom.Pos2d(0, 1))

perimPol1 = pol1.getPerimeter()

pol2 = pol1.offset(-0.25)
perimPol2 = pol2.getPerimeter()

ratio1 = (perimPol1 - 4) / 4.
ratio2 = (perimPol2 - 2) / 2.

import os
fname = os.path.basename(__file__)
if abs(ratio1) < 1e-10 and abs(ratio2) < 1e-10:
    print("test ", fname, ": ok.")
else:
    print("test ", fname, ": ERROR.")
# -*- coding: utf-8 -*-
import xc_base
import geom

pol1 = geom.Polygon2d()
pol1.appendVertex(geom.Pos2d(0, 0))
pol1.appendVertex(geom.Pos2d(1, 0))
pol1.appendVertex(geom.Pos2d(1, 1))
pol1.appendVertex(geom.Pos2d(0, 1))

pol2 = geom.Polygon2d()
pol2.appendVertex(geom.Pos2d(0.25, 0))
pol2.appendVertex(geom.Pos2d(1, 0))
pol2.appendVertex(geom.Pos2d(1, 1))
pol2.appendVertex(geom.Pos2d(0.25, 1))

pol3 = geom.Polygon2d()
pol3.unePolygon2d(pol1)
pol3.unePolygon2d(pol2)

areaPol = pol3.getArea()
polygonPerimeter = pol3.getPerimeter()
polygonCenterOfMass = pol3.getCenterOfMass()
polygonCenterOfMassX = polygonCenterOfMass.x
polygonCenterOfMassY = polygonCenterOfMass.y
IxPol = pol3.getIx()
IyPol = pol3.getIy()
PxyPol = pol3.getPxy()

ratio1 = (areaPol - 1)
ratio2 = (polygonPerimeter - 4) / 4.
Exemple #26
0
# -*- coding: utf-8 -*-
from __future__ import print_function
import xc_base
import geom

pts= [geom.Pos2d(0,0), geom.Pos2d(1,0), geom.Pos2d(0.5,1)]
ref_plg= geom.Polygon2d(pts)
pts.extend([geom.Pos2d(0.5,0.5), geom.Pos2d(0.5,0.75)])

points= geom.PolyPos2d()
for p in pts:
  points.append(p)

plg= geom.get_basic_alpha_shape2d(points)

areaPlg= plg.getArea()
areaRef= ref_plg.getArea()
ratio1= abs(areaPlg-areaRef)/areaRef

'''
print('areaPlg= ', areaPlg, areaRef)
print('ratio1= ', ratio1)
'''
import os
fname= os.path.basename(__file__)
if abs(ratio1)<1e-5:
  print("test ",fname,": ok.")
else:
  print("test ",fname,": ERROR.")