weixin_57972756 2021-11-26 10:30 采纳率: 50%
浏览 117
已结题

利用abaqus RSG制作运行脚本的小插件

我想利用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操作:

img

img

img

img


出现了name 'main' is not defined的错误,为什么啊?求解答

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 12月4日
    • 创建了问题 11月26日

    悬赏问题

    • ¥20 校园二手交易小程序搭建
    • ¥15 请问在ubuntu用conda创建环境报错怎么能解决
    • ¥15 STM32CubeMX/proteus按键控制指示灯颜色切换
    • ¥20 python,计算区位熵和扩张指数
    • ¥15 Python环境配置
    • ¥15 大四学生的困惑,有偿提问!
    • ¥15 解决页面无法编入索引:被“noindex”标签排除的问题?
    • ¥15 arduino测量电阻
    • ¥15 快手uid转快手号谁能解决 需要开发
    • ¥15 iis部署Django时css不生效,来个真人,ai不好使