我们可以使用.bat文件直接提示runscript而不需要进入abaqus>file>runscript吗?

2024-09-29 21:57:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试创建一个.bat文件,该文件可以检查abaqus会话是否已打开,如果已打开,则打开其运行脚本提示符。为此,我使用以下代码:

@echo off
if exist c:\SIMULIA\Abaqus\6.14-3\code\bin\abq6143.exe goto openscript
else exit
:openscript
echo "file exist"   
abaqus cae noGUi=D:\Saurabh\example\macro1.py
pause

一个命令窗口显示“file exist”,然后出现以下错误

Abaqus许可证管理器已签出以下许可证: Flexnet服务器myshec184706d的“cae”6.14版 <;130个许可证中有13个仍然可用>;

命令窗口突然消失了。 “macro1”实际上是用宏管理器录制的,当我从“文件”>;“runscript”运行时,它可以正常工作。
我真正想要的是在已经打开的abaqus应用程序中从这个.bat文件中提示“runscript”。此.bat文件用于跟踪目的,即脚本被使用的次数。 有人能帮我解决这个问题吗?在

提前谢谢!在


Tags: 文件命令echogt脚本管理器fileexist
1条回答
网友
1楼 · 发布于 2024-09-29 21:57:34

据我所知,不可能更新已经打开供读/写的模型数据库。但是,如果只想从打开的会话中读取或复制数据,可以尝试使用辅助Mdb访问数据。例如:

try:
    openMdb(filename)
except AbaqusException, Msg:
    sys.__stdout__.write("File may be in use by another CAE session.\n")
    sys.__stdout__.write("Error Msg: {0}\n".format(Msg))
    sys.__stdout__.write("Now opening file in a temporary auxiliary mdb.\n")
    mdb = Mdb()
    mdb.openAuxMdb(filename)
# The auxMdb object has a few methods documented in the scripting user's manual
# Otherwise, copy a model from the auxMdb and then you'll have full access.
# Don't forget to save your work, if you made changes to the Mdb. Note that saving
# will result in a new on-disk cae file in the current work directory.

打开cae文件后,您可以访问Mdb或上面所示的Mdb副本,然后可以1)直接在Python脚本中使用宏函数,或者2)使用以下命令调用宏脚本:

^{pr2}$

相关问题 更多 >

    热门问题