问题描述
我想用 C# 编程语言为 Catia V5 编写宏/程序.
I want to write Macros/Programs for Catia V5 with the programming language C#.
如何通过 c#(和 Visual Studio)访问 Catia 应用程序.我搜索了一下,发现 Catia 提供了一个 API,Microsoft COM Technologie 为像 c# & 之类的COM 语言"提供了 API.蟒蛇.
How is it possible to access the Catia applicataion via c#(and Visual Studio). I searched a bit and found out that Catia provides an API, which the Microsoft COM Technologie provides for 'COM-languages' like c# & python.
这就是我想象的 C# 程序和 Catia 之间的连接/交互:
This is how I imagine the connection/interaction between a C# Programm and Catia:
C# - .NET <-双向集成-> COM <-> Catia API
正确吗?
另外:如何在 Visual Studio 中设置所有内容,以便我可以访问 Catia API(和代码完成等)
Also: How do I setup everything in Visual Studio , so that I can access the Catia API (and code completion etc.)
推荐答案
1) 在引用中添加 INFITF
typelib 库,它是 CATIA 应用程序的接口
1) Add INFITF
typelib library in reference which is interface to CATIA application
2) 将 CATIA 定义为全局变量,就像
2) Define CATIA as global variable as like
INFITF.Application CATIA;
3) 将 catia 应用程序绑定到您的 CATIA
变量,如下语句
3) Bind the catia application to your CATIA
variable as below statement
CATIA = (INFITF.Application)Marshal.GetActiveObject("Catia.Application");
希望这能帮助您入门.
这篇关于将 C# 用于 Catia V5 自动化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!