我想利用abaqus的RSG编写一个运行脚本的小插件,先在abaqus GUI界面操作,运行脚本,从.rpy文件中复制代码,编入Kernel函数,如下:
# -*- coding: mbcs -*-
#
# Abaqus/CAE Release 2017 replay file
# Internal Version: 2016_09_28-05.54.59 126836
# Run by DELL on Fri Nov 26 10:17:26 2021
#
# from driverUtils import executeOnCaeGraphicsStartup
# executeOnCaeGraphicsStartup()
#: Executing "onCaeGraphicsStartup()" in the site directory ...
from abaqus import *
from abaqusConstants import *
session.Viewport(name='Viewport: 1', origin=(0.0, 0.0), width=199.546875,
height=132.252319335938)
session.viewports['Viewport: 1'].makeCurrent()
session.viewports['Viewport: 1'].maximize()
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
referenceRepresentation=ON)
execfile('F:/F DELL Downloads/abaqus/Crack-Propagation-master/main.py',
__main__.__dict__)
我自己定义一个函数,def auto_scaling(filename):,代码如下:
from abaqus import *
from abaqusConstants import *
def auto_scaling(filename):
# -*- coding: mbcs -*-
#
# Abaqus/CAE Release 2017 replay file
# Internal Version: 2016_09_28-05.54.59 126836
# Run by DELL on Wed Nov 24 20:18:25 2021
#
# from driverUtils import executeOnCaeGraphicsStartup
# executeOnCaeGraphicsStartup()
#: Executing "onCaeGraphicsStartup()" in the site directory ...
session.Viewport(name='Viewport: 1', origin=(0.0, 0.0), width=199.546875, height=132.252319335938)
session.viewports['Viewport: 1'].makeCurrent()
session.viewports['Viewport: 1'].maximize()
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
referenceRepresentation=ON)
execfile(filename,
__main__.__dict__)
然后下面是RSG操作:
出现了name 'main' is not defined的错误,为什么啊?求解答