问题描述
我想用编程语言 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# &蟒蛇.
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");
希望这可以帮助您入门.
Hope this would helps you to get started.
这篇关于使用 C# 实现 Catia V5 自动化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!