简体   繁体   English

参考Abaqus C ++ API静态库来读取ODB文件

[英]Reference Abaqus C++ API static libraries to read ODB files

I have Abaqus CAE, Visual Studio 2017, Visual C++ compiler installed in my computer. 我在我的计算机上安装了Abaqus CAE,Visual Studio 2017,Visual C ++编译器。 I'm trying to reference Abaqus CAE's static libraries in my Visual Studio C++ project to read my ODB file. 我正在尝试在Visual Studio C ++项目中引用Abaqus CAE的静态库来读取我的ODB文件。

This is the code file that I'm trying to compile & execute : 这是我正在尝试编译和执行的代码文件:

```

#include "pch.h"
#include <iostream>
#include <odb_API.h>
#include <odb_String.h>
#include <odb_Repository.h>

using namespace std;
int main()
{
    cout << "Initializing API"<<endl;
    odb_initializeAPI();
    odb_String odbFilePath = "C:\\Users\\Dularish\\Desktop\\Temp_Toclear\\Job-1.odb";

    try
    {
        odb_Odb& odb = openOdb(odbFilePath);

        odb.close();
    }
    catch (odb_BaseException& ex) 
    {
        cout << "Exception message : " << ex.UserReport().CStr() << endl;
    }
    catch (const std::exception& ex)
    {
        cout << "Default Exception message : " << ex.what() << endl;
    }

    cout << "Hello World!\n"; 

    odb_finalizeAPI();

    return 0;
}

```

Visual Studio Project Settings : Visual Studio项目设置:

Platform : X64 (I'll not be able to compile with X86) 平台:X64(我无法用X86编译)

Configuration Properties > VC ++ Directories > Include Directories : C:\\SIMULIA\\Abaqus\\6.14-3\\code\\include;$(IncludePath) 配置属性> VC ++目录>包含目录:C:\\ SIMULIA \\ Abaqus \\ 6.14-3 \\ code \\ include; $(IncludePath)

Configuration Properties > VC ++ Directories > Library Directories : C:\\SIMULIA\\Abaqus\\6.14-3\\code\\lib;$(LibraryPath) 配置属性> VC ++目录>库目录:C:\\ SIMULIA \\ Abaqus \\ 6.14-3 \\ code \\ lib; $(LibraryPath)

Configuration Properties > Linker > Input > Additional Dependencies : 配置属性>链接器>输入>附加依赖项:

ABQDMP_Core.lib; ABQDMP_Core.lib; ABQSMAAbuBasicUtils.lib .... and all the rest of the files present in the directory "C:\\SIMULIA\\Abaqus\\6.14-3\\code\\lib". ABQSMAAbuBasicUtils.lib ....以及目录“C:\\ SIMULIA \\ Abaqus \\ _ 6.14-3 \\ code \\ lib”中存在的所有其他文件。

With these settings, I'm able to compile it without any errors, but on execution of exe application, 通过这些设置,我可以编译它而没有任何错误,但是在执行exe应用程序时,

I'm getting the below error : 我收到以下错误:

"The procedure entry point ?openOdb@@YAAEAVodb_Odb@@AEBVodb_String@@_N1VSMABasStringMode@@@Z could not be located in the dynamic link library ABQSMAOdbApi.dll" “程序入口点?openOdb @@ YAAEAVodb_Odb @@ AEBVodb_String @@ _ N1VSMABasStringMode @@@ Z无法找到动态链接库ABQSMAOdbApi.dll”

Error Screenshot 错误截图

Does it mean that I'm missing a static library containing openOdb method? 这是否意味着我缺少一个包含openOdb方法的静态库?

I'm trying to connect with people who are already familiar with Abaqus ODB C++ API who could help me on this. 我正在尝试与已经熟悉Abaqus ODB C ++ API的人联系,他们可以帮助我。

Thanks. 谢谢。

Edit 1 : I don't want to use abaqus make utility because I want to build my own postprocessing application based on .NET platform. 编辑1:我不想使用abaqus make实用程序,因为我想构建自己的基于.NET平台的后处理应用程序。 The lines "odb_initializeAPI();" 行“odb_initializeAPI();” and "odb_finalizeAPI();" 和“odb_finalizeAPI();” are the lines which should be used if I want to access Abaqus ODB API outside Abaqus CAE. 如果我想在Abaqus CAE之外访问Abaqus ODB API,应该使用哪些行。 I'm actually following this page from the scripting documentation " http://130.149.89.49:2080/v2016/books/cmd/default.htm?startat=pt05ch10s07.html " 我实际上是从脚本文档“ http://130.149.89.49:2080/v2016/books/cmd/default.htm?startat=pt05ch10s07.html ”关注此页面

The other resource that guided me to use this approach : " https://www.reddit.com/r/fea/comments/8oqx5x/setting_up_abaqus_c_interface/ " 引导我使用这种方法的另一个资源:“ https://www.reddit.com/r/fea/comments/8oqx5x/setting_up_abaqus_c_interface/

There are at least two issues with your solution and approach: 您的解决方案和方法至少存在两个问题:

  1. The program you write must not contain a C++ main routine, aka the function main . 您编写的程序不能包含C ++主程序,也就是函数main Instead, the entry point for the program must be a function named ABQmain , having the same signature as the regular function main . 相反,程序的入口点必须是名为ABQmain的函数,具有与常规函数main相同的签名。
  2. You must compile your Abaqus C++ code using the Abaqus make utility. 您必须使用Abaqus make实用程序编译Abaqus C ++代码。 Once you have finished writing your code and would like to compile it, the correct command to use is: 一旦编写完代码并想编译它,正确的命令就是:

    abaqus make job=your_code.cpp abaqus make job = your_code.cpp

If you have Abaqus on your machine, then you should also have the documentation. 如果你的机器上有Abaqus,那么你也应该有文档。 The section "Abaqus Scripting User's Guide" contains a section "Using C++ to access an output database." “Abaqus Scripting用户指南”部分包含“使用C ++访问输出数据库”部分。 There you can find some examples and the details I've pointed out here. 在那里你可以找到一些例子和我在这里指出的细节。 It should be a good starting point for your work. 这应该是你工作的一个很好的起点。

EDIT: After pointing out that you wish to use the Visual Studio for development and compilation, make sure to check the system requirements for the Abaqus version you are using. 编辑:在指出您希望使用Visual Studio进行开发和编译之后,请务必检查您正在使用的Abaqus版本的系统要求。 Try to use the same Visual Studio C++ compiler as the one used for compiling Abaqus. 尝试使用与编译Abaqus相同的Visual Studio C ++编译器。 Simulia is most probably using an older version of the Visual Studio C++ compiler than you are. Simulia很可能使用的是旧版Visual Studio C ++编译器。

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

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