def displayLoad(preprocessor, setToDisplay=None, loadCaseNm='', unitsScale=1.0, vectorScale=1.0, multByElemArea=False, viewNm="XYZPos", hCamFct=1.0, caption='', fileName=None, defFScale=0.0): '''vector field display of the loads applied to the chosen set of elements in the load case passed as parameter :param setToDisplay: set of elements to be displayed (defaults to total set) :param loadCaseNm: name of the load case to be depicted :param unitsScale: factor to apply to the results if we want to change the unit system. :param vectorScale: factor to apply to the vectors length in the representation :param multByElemArea: boolean value that must be `True` if we want to represent the total load on each element (=load multiplied by element area) and `False` if we are going to depict the value of the uniform load per unit area :param viewNm: name of the view that contains the renderer :param hCamFct: factor that applies to the height of the camera position :param fileName: full name of the graphic file to generate. Defaults to ` None`, in this case it returns a console output graphic. :param caption: text to display in the graphic :param defFScale: factor to apply to current displacement of nodes so that the display position of each node equals to the initial position plus its displacement multiplied by this factor. (Defaults to 0.0, i.e. display of initial/undeformed shape) ''' if (setToDisplay == None): setToDisplay = preprocessor.getSets.getSet('total') setToDisplay.fillDownwards() lmsg.warning('set to display not defined; using total set.') LrefModSize = setToDisplay.getBnd(1.0).diagonal.getModulo( ) #representative length of set size (to auto-scale) vectorScale *= LrefModSize / 10. if setToDisplay.color.Norm() == 0: setToDisplay.color = xc.Vector([rd.random(), rd.random(), rd.random()]) defDisplay = vtk_FE_graphic.RecordDefDisplayEF() defDisplay.setupGrid(setToDisplay) vField = lvf.LoadVectorField(loadCaseNm, unitsScale, vectorScale) vField.multiplyByElementArea = multByElemArea vField.dumpLoads(preprocessor, defFScale) defDisplay.viewName = viewNm defDisplay.hCamFct = hCamFct defDisplay.defineMeshScene(None, defFScale, color=setToDisplay.color) vField.addToDisplay(defDisplay) defDisplay.displayScene(caption, fileName) return defDisplay
def displayLoad(self, setToDisplay=None, loadCaseNm='', unitsScale=1.0, vectorScale=1.0, multByElemArea=False, viewNm="XYZPos", hCamFct=1.0, caption='', fileName=None, defFScale=0.0): '''vector field display of the loads applied to the chosen set of elements in the load case passed as parameter :param setToDisplay: set of elements to be displayed (defaults to total set) :param loadCaseNm: name of the load case to be depicted :param unitsScale: factor to apply to the results if we want to change the units. :param vectorScale: factor to apply to the vectors length in the representation :param multByElemArea: boolean value that must be `True` if we want to represent the total load on each element (=load multiplied by element area) and `False` if we are going to depict the value of the uniform load per unit area :param viewNm: name of the view that contains the renderer (possible options: `XYZPos`, `XYZNeg`,`XPos`, `XNeg`,`YPos`, `YNeg`, `ZPos`, `ZNeg`) :param hCamFct: factor that applies to the height of the camera position in order to change perspective of isometric views (defaults to 1). Usual values 0.1 to 10 :param fileName: full name of the graphic file to generate. Defaults to ` None`, in this case it returns a console output graphic. :param caption: text to display in the graphic :param defFScale: factor to apply to current displacement of nodes so that the display position of each node equals to the initial position plus its displacement multiplied by this factor. (Defaults to 0.0, i.e. display of initial/undeformed shape) ''' if (setToDisplay == None): setToDisplay = self.getPreprocessor().getSets.getSet('total') setToDisplay.fillDownwards() lmsg.warning('set to display not defined; using total set.') defDisplay = vtk_FE_graphic.RecordDefDisplayEF() defDisplay.setupGrid(setToDisplay) vField = lvf.LoadVectorField(loadCaseNm, unitsScale, vectorScale) vField.multiplyByElementArea = multByElemArea vField.dumpLoads(self.getPreprocessor(), defFScale) defDisplay.viewName = viewNm defDisplay.hCamFct = hCamFct defDisplay.defineMeshScene(None, defFScale) vField.addToDisplay(defDisplay) defDisplay.displayScene(caption, fileName) return defDisplay
def display_load(preprocessor, setToDisplay=None, loadCaseNm='', unitsScale=1.0, vectorScale=1.0, multByElemArea=False, viewDef=vtk_graphic_base.CameraParameters("XYZPos", 1.0), caption='', fileName=None, defFScale=0.0): '''vector field display of the loads applied to the chosen set of elements in the load case passed as parameter :param setToDisplay: set of elements to be displayed (defaults to total set) :param loadCaseNm: name of the load case to be depicted :param unitsScale: factor to apply to the results if we want to change the unit system. :param vectorScale: factor to apply to the vectors length in the representation :param multByElemArea: boolean value that must be `True` if we want to represent the total load on each element (=load multiplied by element area) and `False` if we are going to depict the value of the uniform load per unit area :param viewDef: camera parameters. :param fileName: full name of the graphic file to generate. Defaults to ` None`, in this case it returns a console output graphic. :param caption: text to display in the graphic :param defFScale: factor to apply to current displacement of nodes so that the display position of each node equals to the initial position plus its displacement multiplied by this factor. (Defaults to 0.0, i.e. display of initial/undeformed shape) ''' setToDisplay = checkSetToDisp(preprocessor, setToDisplay) LrefModSize = setToDisplay.getBnd(1.0).diagonal.getModulus( ) #representative length of set size (to auto-scale) vectorScale *= LrefModSize / 10. vField = lvf.LoadVectorField(loadCaseNm, unitsScale, vectorScale) vField.multiplyByElementArea = multByElemArea display_vector_field(preprocessor, vField, setToDisplay, viewDef, caption, fileName, defFScale)
def displayLoad(self,setToDisplay=None,loadCaseNm='',unitsScale=1.0,vectorScale=1.0,multByElemArea=False,viewDef= vtk_graphic_base.CameraParameters('XYZPos'),caption= '',fileName=None,defFScale=0.0): '''vector field display of the loads applied to the chosen set of elements in the load case passed as parameter :param setToDisplay: set of elements to be displayed (defaults to total set) :param loadCaseNm: name of the load case to be depicted :param unitsScale: factor to apply to the results if we want to change the units. :param vectorScale: factor to apply to the vectors length in the representation :param multByElemArea: boolean value that must be `True` if we want to represent the total load on each element (=load multiplied by element area) and `False` if we are going to depict the value of the uniform load per unit area :param viewDef: parameters that define the view to use predefined view names: 'XYZPos','XNeg','XPos','YNeg','YPos', 'ZNeg','ZPos' :param fileName: full name of the graphic file to generate. Defaults to ` None`, in this case it returns a console output graphic. :param caption: text to display in the graphic :param defFScale: factor to apply to current displacement of nodes so that the display position of each node equals to the initial position plus its displacement multiplied by this factor. (Defaults to 0.0, i.e. display of initial/undeformed shape) ''' if(setToDisplay == None): setToDisplay=self.getPreprocessor().getSets.getSet('total') setToDisplay.fillDownwards() lmsg.warning('set to display not defined; using total set.') defDisplay= vtk_FE_graphic.RecordDefDisplayEF() defDisplay.setupGrid(setToDisplay) if setToDisplay.color.Norm()==0: setToDisplay.color=xc.Vector([rd.random(),rd.random(),rd.random()]) vField=lvf.LoadVectorField(loadCaseNm,unitsScale,vectorScale) vField.multiplyByElementArea=multByElemArea vField.dumpLoads(self.getPreprocessor(),defFScale) defDisplay.cameraParameters= viewDef defDisplay.defineMeshScene(None,defFScale) vField.addToDisplay(defDisplay) defDisplay.displayScene(caption,fileName,color=setToDisplay.color) return defDisplay
def dispLoadCaseBeamEl(self, loadCaseName='', setToDisplay=None, fUnitConv=1.0, elLoadComp='transComponent', elLoadScaleF=1.0, nodLoadScaleF=1.0, viewDef=vtk_graphic_base.CameraParameters('XYZPos'), caption='', fileName=None, defFScale=0.0): '''Display the loads applied on beam elements and nodes for a given load case :param setToDisplay: set of beam elements to be represented :param fUnitConv: factor of conversion to be applied to the results (defaults to 1) :param elLoadComp: component of the loads on elements to be depicted [possible components: 'axialComponent', 'transComponent', 'transYComponent', 'transZComponent'] :param elLoadScaleF: factor of scale to apply to the diagram display of element loads (defaults to 1) :param nodLoadScaleF: factor of scale to apply to the vector display of nodal loads (defaults to 1) :param vwDef: camera parameters. :param caption: caption for the graphic :param fileName: name of the file to plot the graphic. Defaults to None, in that case an screen display is generated :param defFScale: factor to apply to current displacement of nodes so that the display position of each node equals to the initial position plus its displacement multiplied by this factor. (Defaults to 0.0, i.e. display of initial/undeformed shape) ''' if (setToDisplay): self.xcSet = setToDisplay if self.xcSet.color.Norm() == 0: self.xcSet.color = xc.Vector( [rd.random(), rd.random(), rd.random()]) else: lmsg.warning( 'QuickGraphics::dispLoadCaseBeamEl; set to display not defined; using previously defined set (total if None).' ) preprocessor = self.feProblem.getPreprocessor loadPatterns = preprocessor.getLoadHandler.getLoadPatterns loadPatterns.addToDomain(loadCaseName) defDisplay = self.getDisplay(viewDef) grid = defDisplay.setupGrid(self.xcSet) defDisplay.defineMeshScene(None, defFScale, color=self.xcSet.color) orNodalLBar = 'H' #default orientation of scale bar for nodal loads # auto-scaling parameters LrefModSize = setToDisplay.getBnd(1.0).diagonal.getModulo( ) #representative length of set size (to auto-scale) diagAux = lld.LinearLoadDiagram(scale=elLoadScaleF, fUnitConv=fUnitConv, loadPatternName=loadCaseName, component=elLoadComp) maxAbs = diagAux.getMaxAbsComp(preprocessor) if maxAbs > 0: elLoadScaleF *= LrefModSize / maxAbs * 100 # diagram = lld.LinearLoadDiagram(scale=elLoadScaleF, fUnitConv=fUnitConv, loadPatternName=loadCaseName, component=elLoadComp) diagram.addDiagram(preprocessor) if diagram.isValid(): defDisplay.appendDiagram(diagram) orNodalLBar = 'V' # nodal loads vField = lvf.LoadVectorField(loadPatternName=loadCaseName, fUnitConv=fUnitConv, scaleFactor=nodLoadScaleF, showPushing=True) # loadPatterns= preprocessor.getLoadHandler.getLoadPatterns lPattern = loadPatterns[loadCaseName] count = 0 if (lPattern): count = vField.dumpNodalLoads(preprocessor, defFScale=defFScale) else: lmsg.error('load pattern: ' + loadCaseName + ' not found.') if count > 0: vField.addToDisplay(defDisplay, orientation=orNodalLBar) defDisplay.displayScene(caption=caption, fName=fileName)
execfile('model_data.py') execfile('loadStateData.py') #ordered list of load cases (from those defined in ../loadStateData.py #or redefined lately) to be displayed: #loadCasesToDisplay=[G1,G2,G3,QA,QB,T,Snow,EQ] loadCasesToDisplay=[QA,QB] #End data for lc in loadCasesToDisplay: for st in lc.setsToDispLoads: # capt=lc.loadCaseDescr + ', ' + st.genDescr + ', ' + lc.unitsLoads capt=lc.loadCaseDescr + ', ' + lc.unitsLoads # model.displayLoad(setToDisplay=st.elSet,loadCaseNm=lc.loadCaseName,unitsScale=lc.unitsScaleLoads,vectorScale=lc.vectorScaleLoads, multByElemArea=lc.multByElemAreaLoads,viewNm=lc.viewName,caption= capt) defDisplay= vtk_FE_graphic.RecordDefDisplayEF() defDisplay.setupGrid(st) vField=lvf.LoadVectorField(lc.loadCaseName,lc.unitsScaleLoads,lc.vectorScaleLoads) vField.multiplyByElementArea=lc.multByElemAreaLoads vField.dumpLoads(preprocessor) defDisplay.viewName= lc.viewName #defDisplay.hCamFct=1.0 defDisplay.defineMeshScene(None) vField.addToDisplay(defDisplay) defDisplay.displayScene(caption=capt)
def dispLoadCaseBeamEl(self,loadCaseName='',setToDisplay=None,fUnitConv=1.0,elLoadComp='transComponent',elLoadScaleF=1.0,nodLoadScaleF=1.0,viewName='XYZPos',hCamFct=1.0,caption='',fileName=None,defFScale=0.0): '''Display the loads applied on beam elements and nodes for a given load case :param setToDisplay: set of beam elements to be represented :param fUnitConv: factor of conversion to be applied to the results (defaults to 1) :param elLoadComp: component of the loads on elements to be depicted [possible components: 'axialComponent', 'transComponent', 'transYComponent', 'transZComponent'] :param elLoadScaleF: factor of scale to apply to the diagram display of element loads (defaults to 1) :param nodLoadScaleF: factor of scale to apply to the vector display of nodal loads (defaults to 1) :param viewName: name of the view that contains the renderer (possible options: "XYZPos", "XPos", "XNeg","YPos", "YNeg", "ZPos", "ZNeg") (defaults to "XYZPos") :param hCamFct: factor that applies to the height of the camera position in order to change perspective of isometric views (defaults to 1). Usual values 0.1 to 10 :param caption: caption for the graphic :param fileName: name of the file to plot the graphic. Defaults to None, in that case an screen display is generated :param defFScale: factor to apply to current displacement of nodes so that the display position of each node equals to the initial position plus its displacement multiplied by this factor. (Defaults to 0.0, i.e. display of initial/undeformed shape) ''' if(setToDisplay): self.xcSet= setToDisplay else: lmsg.warning('QuickGraphics::displayLoadCaseBeamEl; set to display not defined; using previously defined set (total if None).') print 'xcSet', self.xcSet.name preprocessor= self.feProblem.getPreprocessor loadPatterns= preprocessor.getLoadHandler.getLoadPatterns loadPatterns.addToDomain(loadCaseName) defDisplay= self.getDisplay(vwName=viewName,hCamF= hCamFct) grid= defDisplay.setupGrid(self.xcSet) defDisplay.defineMeshScene(None,defFScale) orNodalLBar='H' #default orientation of scale bar for nodal loads # element loads print 'scale=',elLoadScaleF,'fUnitConv=',fUnitConv,'loadPatternName=',loadCaseName,'component=',elLoadComp diagram= lld.LinearLoadDiagram(scale=elLoadScaleF,fUnitConv=fUnitConv,loadPatternName=loadCaseName,component=elLoadComp) diagram.addDiagram(preprocessor) if (diagram.valMax > -1e+99) or (diagram.valMin<1e+99): defDisplay.appendDiagram(diagram) orNodalLBar='V' # nodal loads vField=lvf.LoadVectorField(loadPatternName=loadCaseName,fUnitConv=fUnitConv,scaleFactor=nodLoadScaleF,showPushing= True) # loadPatterns= preprocessor.getLoadHandler.getLoadPatterns lPattern= loadPatterns[loadCaseName] count= 0 if(lPattern): count=vField.dumpNodalLoads(preprocessor,lp=loadPatterns[loadCaseName],defFScale=defFScale) else: lmsg.error('load pattern: '+ loadCaseName + ' not found.') if count >0: vField.setupActor() defDisplay.renderer.AddActor(vField.actor) vField.creaColorScaleBar(orientation=orNodalLBar) defDisplay.renderer.AddActor2D(vField.scalarBar) defDisplay.displayScene(caption=caption,fName=fileName)