简体   繁体   English

在Abaqus中创建“ writeFieldReport”时出错

[英]Error creating “writeFieldReport” results in Abaqus

I am new to the forum. 我是新来的论坛。 I am not an expert programmer but I am facing the need to scripting in python in order to run Finite Element simulation with Abaqus without a GUI. 我不是专业程序员,但是我面临使用python编写脚本的需求,以便在没有GUI的情况下使用Abaqus运行有限元仿真。 The simulation runs fine but when I try to generate a text file containing the results I got the following error prompt 模拟运行正常,但是当我尝试生成包含结果的文本文件时,出现以下错误提示

File "C:/...my_scrypt.py, line 208, in INTEGRATION_POINT),)) There are no active entities. No report has been generated 文件“ C:/ ... my_scrypt.py,第208行,在INTEGRATION_POINT中),))没有活动的实体。未生成任何报告

Here is the script: 这是脚本:

(197)    from odbAccess import *
(198)    from abaqusConstants import *
(199)    from odbMaterial import *
(200)    from odbSection import *
(201)    
(202)    o1 = session.openOdb(name='C:/Temp/Job-1.odb')
(203)    odb = session.odbs['C:/Temp/Job-1.odb'].steps['apply_load']
(204)    session.writeFieldReport(fileName='C:/Temp/abaqus.rpt', append=ON, 
(205)        sortItem='Element Label', odb=odb, step=0, frame=1, 
(206)        outputPosition=INTEGRATION_POINT, variable=(('PEMAG', 
(207)        INTEGRATION_POINT), ('PRESSONLY', INTEGRATION_POINT), ('S', 
(208)        INTEGRATION_POINT), ))

Thanks for any help 谢谢你的帮助

Thanks a lot for the help guys. 非常感谢您的帮助。 Here is the working code: 这是工作代码:

from odbAccess import *
from abaqusConstants import *
from odbMaterial import *
from odbSection import *

o1 = session.openOdb(name='C:/Temp/Job-1.odb')
session.viewports['Viewport: 1'].setValues(displayedObject=o1)
session.viewports['Viewport: 1'].odbDisplay.setFrame(step=0, frame=1)
odb = session.odbs['C:/Temp/Job-1.odb']
session.fieldReportOptions.setValues(columnLayout=SEPARATE_TABLES)
session.writeFieldReport(fileName='C:/Temp/abaqus.rpt', append=OFF, 
    sortItem='Element Label', odb=odb, step=0, frame=1, 
    outputPosition=INTEGRATION_POINT, variable=(('PEMAG', 
    INTEGRATION_POINT), ('PRESSONLY', INTEGRATION_POINT), ('S', 
    INTEGRATION_POINT), ))

When I started programming with Python this was one of my first lines of code as well, which worked fine. 当我开始使用Python进行编程时,这也是我的第一行代码,效果很好。 However, now that I am expanding my code and such I started to get the same error as you described: "There are no active entities. No report has been generated". 但是,现在我正在扩展代码,因此开始出现与您所描述的错误相同的错误:“没有活动实体。未生成报告”。

In your case, you are using an existing viewport, called 'Viewport: 1', however, when creating a new viewport you have to make that viewport current. 在您的情况下,您正在使用一个称为“视口:1”的现有视口,但是,在创建新视口时,必须将该视口设为当前视口。 This is the following code that I use to create myViewport: 这是我用来创建myViewport的以下代码:

myViewport = session.Viewport(name=ViewportName, origin=(0, -100),width=250, height=150)
myViewport.odbDisplay.commonOptions.setValues(visibleEdges=FREE,deformationScaling=UNIFORM,uniformScaleFactor=(1))

# Open the output database and associate it with the viewport.
# Then set the plot state to CONTOURS_ON_DEF

try: myOdb = visualization.openOdb(path=odbNames)
except (AbaqusException), value:  print ('Error:', value)

myViewport.setValues(displayedObject=myOdb)
myViewport.odbDisplay.display.setValues(plotState=(CONTOURS_ON_DEF,))

myViewport.viewportAnnotationOptions.setValues(triad=OFF,title=OFF,state=OFF,compass=OFF, legendDecimalPlaces=2,legendNumberFormat=FIXED)
myViewport.odbDisplay.basicOptions.setValues(coordSystemDisplay=OFF, renderBeamProfiles=ON)

myViewport.view.rotate(xAngle=90,yAngle=90,zAngle=0)
myViewport.view.rotate(xAngle=90,yAngle=90,zAngle=0)
myViewport.view.rotate(xAngle=0, yAngle=0, zAngle=180)
#        myViewport.view.rotate(mode=TOTAL)
myViewport.view.pan(xFraction=0.1) # yFraction for vertical panning
myViewport.view.setValues(projection=PARALLEL)
myViewport.makeCurrent() #This makes the viewport current

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM