def check(self, elements, nmbComb): ''' Check the shear strength of the RC section. Transverse reinforcement is not taken into account yet. ''' lmsg.log("Postprocesing combination: " + nmbComb) # XXX torsional deformation ingnored. for e in elements: e.getResistingForce() scc = e.getSection() idSection = e.getProp("idSection") section = scc.getProp('sectionData') self.setSection(section) NTmp = scc.getStressResultantComponent("N") VuTmp = self.calcVu(NTmp) VyTmp = scc.getStressResultantComponent("Vy") VzTmp = scc.getStressResultantComponent("Vz") VTmp = math.sqrt((VyTmp)**2 + (VzTmp)**2) if (VuTmp != 0.0): FCtmp = abs(VTmp) / VuTmp else: FCtmp = 10 if (FCtmp >= e.getProp(self.limitStateLabel).CF): MyTmp = scc.getStressResultantComponent("My") MzTmp = scc.getStressResultantComponent("Mz") Mu = 0.0 # Not used in ACI-318 theta = None # Not used in ACI-318 e.setProp(self.limitStateLabel, cv.RCShearControlVars(idSection, nmbComb, FCtmp, NTmp, MyTmp, MzTmp, Mu, VyTmp, VzTmp, theta, self.Vc, self.Vsu, VuTmp)) # Worst cas
def getCSVString(self): '''returns a comma separated values string that represents the internal forces.''' lmsg.log('DEPRECATED') retval = str(self.N) + ", " + str(self.Vy) + ", " + str(self.Vz) + ", " retval += str(self.T) + ", " + str(self.My) + ", " + str(self.Mz) return retval
def getCSVString(self): '''returns a comma separated values string that represents the internal forces.''' lmsg.log('DEPRECATED') retval= str(self.n1)+", "+str(self.n2)+", "+str(self.n12)+", " retval+= str(self.m1)+", "+str(self.m2)+", "+str(self.m12)+", " retval+= str(self.q13)+", "+str(self.q23) return retval
def importFaces(self): ''' Import 3D faces from DXF.''' self.facesTree= {} for name in self.layersToImport: self.facesTree[name]= dict() for obj in self.dxfFile.entities: dxfType= obj.dxftype() layerName= obj.dxf.layer if(layerName in self.layersToImport): facesDict= self.facesTree[layerName] if(dxfType == '3DFACE'): vertices= list() objPoints= [obj.dxf.vtx0, obj.dxf.vtx1, obj.dxf.vtx2, obj.dxf.vtx3] for pt in objPoints: p= self.getRelativeCoo(pt) idx= self.getIndexNearestPoint(p) vertices.append(idx) self.propertyDict[obj.dxf.handle]= bte.BlockProperties(labels= [layerName]) facesDict[obj.dxf.handle]= vertices elif(dxfType == 'POLYFACE'): count= 0 for q in self.polyfaceQuads[obj.dxf.handle]: vertices= list() for pt in q: p= self.getRelativeCoo(pt) idx= self.getIndexNearestPoint(p) if not idx in vertices: vertices.append(idx) else: lmsg.error('Point p: '+str(p)+' idx: '+str(idx)+' repeated in '+str(q)+' vertices: '+str(vertices)) count+= 1 id= obj.dxf.handle+'_'+str(count) self.propertyDict[id]= bte.BlockProperties(labels= [layerName]) facesDict[id]= vertices elif((dxfType == 'POLYLINE') or (dxfType == 'LWPOLYLINE')): count= 0 if(self.polylinesAsSurfaces): # Import as surfaces for q in self.polylineQuads[obj.dxf.handle]: vertices= list() for pt in q: p= self.getRelativeCoo(pt) idx= self.getIndexNearestPoint(p) if not idx in vertices: vertices.append(idx) else: lmsg.error('Point p: '+str(p)+' idx: '+str(idx)+' repeated in '+str(q)+' vertices: '+str(vertices)) count+= 1 id= obj.dxf.handle+'_'+str(count) self.propertyDict[id]= bte.BlockProperties(labels= [layerName]) facesDict[id]= vertices elif(dxfType in ['LINE', 'POINT']): count= 0 # Nothing to do with those. else: lmsg.log('Entity of type: '+dxfType+' ignored.')
def importFaces(self): ''' Import 3D faces from DXF.''' self.facesByLayer= {} for name in self.layersToImport: self.facesByLayer[name]= dict() for obj in self.dxfFile.entities: type= obj.dxftype layerName= obj.layer if(layerName in self.layersToImport): facesDict= self.facesByLayer[layerName] if(type == '3DFACE'): vertices= list() for pt in obj.points: p= self.getRelativeCoo(pt) idx= self.getIndexNearestPoint(p) vertices.append(idx) self.labelDict[obj.handle]= [layerName] facesDict[obj.handle]= vertices elif(type == 'POLYFACE'): count= 0 for q in self.polyfaceQuads[obj.handle]: vertices= list() for pt in q: p= self.getRelativeCoo(pt) idx= self.getIndexNearestPoint(p) if not idx in vertices: vertices.append(idx) else: lmsg.error('Point p: '+str(p)+' idx: '+str(idx)+' repeated in '+str(q)+' vertices: '+str(vertices)) count+= 1 id= obj.handle+'_'+str(count) self.labelDict[id]= [layerName] facesDict[id]= vertices elif((type == 'POLYLINE') or (type == 'LWPOLYLINE')): count= 0 if(self.polylinesAsSurfaces): # Import as surfaces for q in self.polylineQuads[obj.handle]: vertices= list() for pt in q: p= self.getRelativeCoo(pt) idx= self.getIndexNearestPoint(p) if not idx in vertices: vertices.append(idx) else: lmsg.error('Point p: '+str(p)+' idx: '+str(idx)+' repeated in '+str(q)+' vertices: '+str(vertices)) count+= 1 id= obj.handle+'_'+str(count) self.labelDict[id]= [layerName] facesDict[id]= vertices elif(type == 'LINE'): count= 0 # Nothing to do with lines for the moment. else: lmsg.log('Entity of type: '+type+' ignored.')
def readFromXCSet(self, xcSet): '''Read points and surfaces from an XC set.''' self.name = xcSet.name retval = self.points.readFromXCSet(xcSet) if (self.verbosity > 0): lmsg.log(str(len(self.points)) + ' points read.') retval += self.blocks.readFromXCSet(xcSet) if (self.verbosity > 0): lmsg.log(str(len(self.blocks)) + ' blocks read.') retval += self.pointSupports.readFromXCSet(xcSet, self.points) return retval
def getLengthsName(self): '''Return a suitable name for the vtkDoubleArray object that contains the vector lengths.''' retval = self.name if (len(retval) >= 70): retval = str(uuid.uuid1()) if (len(retval) >= 70): lmsg.log( 'lengthsName string truncated to avoid buffer overflow.') retval = retval[:70] retval += 'Lengths' return retval
def setupMapper(self): self.setupGlyph() self.mapper = vtk.vtkPolyDataMapper() self.mapper.SetInputConnection(self.glyph.GetOutputPort()) self.mapper.SetScalarModeToUsePointFieldData() self.mapper.SetColorModeToMapScalars() self.mapper.ScalarVisibilityOn() self.mapper.SetScalarRange(self.lengths.GetRange()) if(len(self.lenghtsName)>80): self.lenghtsName= zlib.compress(self.lenghtsName) lmsg.log('lengthsName string compressed to avoid buffer overflow.') self.mapper.SelectColorArray(self.lenghtsName) self.mapper.SetLookupTable(self.lookupTable) return self.mapper
def import_shape(shape, faceName, labelName): ''' Import simple shape.''' shapeType= shape.ShapeType if(shapeType=='Face'): import_face(shape, faceName, labelName) elif(shapeType=='Shell'): for s in shape.SubShapes: import_shape(s, faceName, labelName) elif(shapeType=='Compound'): cCount= 0 for ss in obj.Shape.SubShapes: ssType= ss.ShapeType ssName= faceName+'.'+str(cCount) import_shape(ss, ssName, labelName) cCount+= 1 elif(shapeType in ['Wire']): count= 0 # Nothing to do with those. else: lmsg.log('Entity with shape of type: '+shapeType+' ignored.')
def import_shape(shape, objName, labelName): ''' Import simple shape.''' shapeType = shape.ShapeType if (shapeType == 'Face'): import_face(shape, objName, labelName) elif (shapeType == 'Shell'): for s in shape.SubShapes: import_shape(s, objName, labelName) elif (shapeType == 'Compound'): for cCount, ss in enumerate(shape.SubShapes): ssType = ss.ShapeType ssName = f'{objName}.{cCount}' import_shape(ss, ssName, labelName) elif (shapeType == 'Vertex'): count = 0 # Nothing to do with those here. elif (shapeType in ['Wire']): count = 0 # Nothing to do with those. else: lmsg.log('Entity with shape of type: ' + shapeType + ' ignored.')
def check(self, elements, nmbComb): ''' Parameters: elements: elements to check ''' if (self.verbose): lmsg.log("Postprocessing combination: " + nmbComb) for e in elements: e.getResistingForce() TagTmp = e.tag scc = e.getSection() idSection = e.getProp("idSection") Ntmp = scc.getStressResultantComponent("N") MyTmp = scc.getStressResultantComponent("My") posEsf = geom.Pos2d(Ntmp, MyTmp) diagInt = e.getProp("diagInt") CFtmp = diagInt.getCapacityFactor(posEsf) if (CFtmp > e.getProp(self.limitStateLabel).CF): e.setProp(self.limitStateLabel, cv.BiaxialBendingControlVars(idSection, nmbComb, CFtmp, Ntmp, MyTmp)) # Worst case.
def check(self, elements, combName): ''' Check the normal stresses :param elements: elements to check :param combName: name of the load combination being treated. ''' if (self.verbose): lmsg.log("Postprocessing combination: " + combName) for e in elements: e.getResistingForce() TagTmp = e.tag scc = e.getSection() idSection = e.getProp("idSection") Ntmp = scc.getStressResultantComponent("N") MyTmp = scc.getStressResultantComponent("My") posEsf = geom.Pos2d(Ntmp, MyTmp) diagInt = e.getProp("diagInt") CFtmp = diagInt.getCapacityFactor(posEsf) if (CFtmp > e.getProp(self.limitStateLabel).CF): e.setProp(self.limitStateLabel, cv.BiaxialBendingControlVars(idSection, combName, CFtmp, Ntmp, MyTmp)) # Worst case.
from scipy.spatial.distance import cdist from misc_utils import log_messages as lmsg from import_export import block_topology_entities as bte # path to FreeCAD.so FREECADPATH = '/usr/lib/freecad-daily-python2/lib/' if (sys.version_info.major == 3): FREECADPATH = '/usr/lib/freecad-daily-python3/lib/' sys.path.append(FREECADPATH) # import FreeCAD try: import FreeCAD except ModuleNotFoundError as err: # Error handling lmsg.log(err) quit() ifcStringAttributes = [ 'IfcType', 'PredefinedType', 'IfcProperties', 'SteelGrade' ] ifcLengthAttributes = [ 'Thickness', 'LongitudinalBarNominalDiameter', 'LongitudinalBarSpacing', 'TransverseBarNominalDiameter', 'TransverseBarSpacing' ] ifcAreaAttributes = [ 'LongitudinalBarCrossSectionArea', 'TransverseBarCrossSectionArea' ]
def check(self, elements, nmbComb): ''' For each element in the set 'elememts' passed as first parameter and the resulting internal forces for the load combination 'nmbComb' passed as second parameter, this method calculates all the variables involved in the crack-SLS checking and obtains the crack width. In the case that the calculated crack width is greater than the biggest obtained for the element in previous load combinations, this value is saved in the element results record. Elements processed are those belonging to the phantom model, that is to say, of type xc.ZeroLengthSection. As we have defined the variable fakeSection as False, a reinfoced concrete fiber section is generated for each of these elements. ''' if (self.verbose): lmsg.log("Postprocessing combination: " + nmbComb) for e in elements: Aceff = 0 #init. value R = e.getResistingForce() sct = e.getSection() sctCrkProp = lscb.fibSectLSProperties(sct) sctCrkProp.setupStrghCrackDist() hceff = self.EC2_hceff(sctCrkProp.h, sctCrkProp.d, sctCrkProp.x) Acgross = sct.getGrossEffectiveConcreteArea(hceff) Aceff = sct.getNetEffectiveConcreteArea(hceff, "tensSetFb", 15.0) concrete = EC2_materials.concrOfName[sctCrkProp.concrName] rfSteel = EC2_materials.steelOfName[sctCrkProp.rsteelName] k2 = self.EC2_k2(sctCrkProp.eps1, sctCrkProp.eps2) # print('elem= ',e.tag, ' Aceff= ',Aceff) if Aceff <= 0: s_rmax = 0 else: ro_s_eff = sctCrkProp.As / Aceff #effective ratio of reinforcement s_rmax = self.k3 * sctCrkProp.cover + self.k1 * k2 * self.k4 * sctCrkProp.fiEqu / ro_s_eff #Parameters for tension stiffening of concrete paramTS = concrete_base.paramTensStiffness(concrMat=concrete, reinfMat=rfSteel, reinfRatio=ro_s_eff, diagType='K') concrete.tensionStiffparam = paramTS #parameters for tension #stiffening are assigned to concrete ftdiag = concrete.tensionStiffparam.pointOnsetCracking( )['ft'] #stress at the adopted point for concrete onset cracking Etsdiag = abs(concrete.tensionStiffparam.regresLine()['slope']) fiber_sets.redefTensStiffConcr( setOfTenStffConcrFibSect=sctCrkProp.setsRC.concrFibers, ft=ftdiag, Ets=Etsdiag) e.setProp('ResF', R) #vector resisting force e.setProp('s_rmax', s_rmax) #maximum crack distance self.preprocessor.getDomain.revertToStart() predefined_solutions.solveComb(self.preprocessor, nmbComb, self.analysis, 1) for e in elements: sct = e.getSection() rfset = sct.getFiberSets()["reinfSetFb"] eps_sm = rfset.getStrainMax() srmax = e.getProp("s_rmax") # eps_cm=concrete.fctm()/2.0/concrete.E0() # wk=srmax*(eps_sm-eps_cm) wk = srmax * eps_sm # print(' eps_sm= ',eps_sm, ' srmax= ', srmax, ' wk= ',wk) # print('e.getProp(self.limitStateLabel).wk', e.getProp(self.limitStateLabel).wk) if (wk > e.getProp(self.limitStateLabel).wk): R = e.getProp('ResF') e.setProp( self.limitStateLabel, cv.RCCrackStraightControlVars( idSection=e.getProp("idSection"), combName=nmbComb, N=-R[0], My=-R[4], Mz=-R[5], s_rmax=srmax, eps_sm=eps_sm, wk=wk))