简体   繁体   English

是否可以使用脚本从 Abaqus CAE 中的材料库中导入材料?

[英]Is it possible to import material from material library in Abaqus CAE using scripts?

I'm working on Abaqus 6.14 plugin that would help me in my Engineer's Thesis, which I'm writing in Python.我正在开发 Abaqus 6.14 插件,它可以帮助我完成我正在用 Python 编写的工程师论文。 According to Abaqus scripting reference guide it is possible to import materials from Output Databases (*.odb files) by calling:根据Abaqus 脚本参考指南,可以通过调用从输出数据库(*.odb 文件)导入材料:

from abaqus import mdb
mdb.models[name].materialsFromOdb(filename)

However, as Abaqus allows user to export/import materials to/from relatively lightweight Material Libraries (*.lib files) and share them between models I would like to import the materials from these rather than from, often bulky, *.odb files.然而,由于 Abaqus 允许用户向/从相对轻量级的材料库(*.lib 文件)导出/导入材料并在模型之间共享它们,我想从这些文件而不是从通常庞大的 *.odb 文件导入材料。

Of course this can be done manually with ease, although I want to reduce amount of repetitive job with my plugin, as I need to run dozens of simulations on pretty similiar models but with varying materials and some other parameters.当然,这可以轻松地手动完成,尽管我想用我的插件减少重复性工作的数量,因为我需要在非常相似的模型上运行数十次模拟,但具有不同的材料和其他一些参数。 I am aware I could also provide necessary materials in template *.cae file too, although this could be quite inconvenient if I had to manually import new material(s) to dozens of models or I had to update existing material's properties.我知道我也可以在模板 *.cae 文件中提供必要的材料,尽管如果我必须手动将新材料导入几十个模型或者我必须更新现有材料的属性,这可能会非常不方便。

What am I looking for is a workaround allowing to import materials from material libraries to Abaqus mdb models with Python scripts, but avoiding implementing custom *.lib files parser, if only such workaround exists.我正在寻找的是一种解决方法,允许使用 Python 脚本将材料从材料库导入 Abaqus mdb 模型,但避免实现自定义 *.lib 文件解析器,如果仅存在此类解决方法。

The first thing you need to know is that Abaqus material library is just a pickled file.您首先需要知道的是,Abaqus 材料库只是一个腌制文件。 No special parser is needed to work with it.不需要特殊的解析器来使用它。 You can just use the standard Python libraries pickle or cPickle .您可以只使用标准 Python 库picklecPickle Of course, you need to figure out the exact structure of the objects inside.当然,你需要弄清楚里面对象的确切结构。 This is not difficult as you'll see it's a just list of simple tuples.这并不难,因为您会看到它只是简单元组的列表。

However, if you have an existing material library and you want to import a material in your Abaqus CAE database, there is an existing method to do it.但是,如果您有一个现有的材料库,并且想要在您的 Abaqus CAE 数据库中导入材料,则可以使用现有的方法来执行此操作。

There is a method in Abaqus which uses a material string from a material database and creates a material object from that. Abaqus 中有一种方法可以使用材料数据库中的材料字符串并从中创建材料对象。 I can't remember the exact name, but if you import one material manually and look into abaqus.rpy file, you will see it inside.我不记得确切的名称,但是如果您手动导入一种材料并查看abaqus.rpy文件,您会在里面看到它。

One tricky thing here is that in order to use this method, you need to have a material string from the material library.这里有一个棘手的事情是,为了使用这种方法,您需要从材料库中获得一个材料字符串。 This can be done by reading the material database file.这可以通过读取材料数据库文件来完成。 As already mentioned, this is in pickle format.如前所述,这是泡菜格式。

As you know, Abaqus already has a way of reading data from the material library and importing it into a CAE model.如您所知,Abaqus 已经有一种从材料库中读取数据并将其导入 CAE 模型的方法。 They have a Python module which you could use, but it can only be used inside a GUI process, not the kernel one.他们有一个您可以使用的 Python 模块,但它只能在 GUI 进程中使用,而不能在内核进程中使用。 If you want to spend some time, you can figure out which module does that.如果你想花一些时间,你可以弄清楚哪个模块可以做到这一点。 Inside Abaqus installation folder, you will find some .pyc files.在 Abaqus 安装文件夹中,您会找到一些.pyc文件。 If you use a Python decompiler, you can obtain source code for those modules.如果您使用 Python 反编译器,则可以获得这些模块的源代码。 Look for those beginning with mat .寻找那些以mat开头的。

暂无
暂无

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

相关问题 来自Abaqus / CAE的Python多处理 - Python multiprocessing from Abaqus/CAE 从命令行界面运行abaqus cae命令时出错 - Error in Running abaqus cae command from command line interface 无法将 Abaqus PDE 连接到 Abaqus/CAE - Can't connect Abaqus PDE to Abaqus/CAE 是否可以在Abaqus / CAE中使用用户元素定义网格并使用Python指定其属性,而无需编辑输入文件? - Is it possible to define a mesh with User-Elements and specify their properties with Python in Abaqus/CAE without editing the input file? 如何使用 Python 脚本知道 ABAQUS odb 文件(不是 MDB 文件)中 PID 的材料名称? - How to know a material name of a PID in ABAQUS odb file(not MDB file) using Python scripting? canvasObjects; 找到PartInstance,期望在Abaqus / CAE中有元组 - canvasObjects; found PartInstance, expecting tuple in Abaqus/CAE 如何创建显示材料属性的Abaqus RSG GUI生成器 - How create Abaqus RSG gui builder that shows material property 如何使用Python脚本通过访问ABAQUS odb文件(而非MDB文件)中的INSTANCE来知道某个零件的材料名称? - How to know a material name of a certain part by accessing its INSTANCE in ABAQUS odb file(not MDB file) using Python scripting? 如何在abaqus / cae和abaqus / viewer模式下使用abaqus python脚本查询零件的体积信息? - How do i query the parts' volume information with abaqus python script in abaqus/cae and abaqus/viewer mode? “从abaqus导入*”包含什么? - What does “from abaqus import *” contain?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM