本文介绍了将C#用于Catia V5自动化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用编程语言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提供了该API用于 COM语言,例如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

C# - .NET <-bi-directional integration-> 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自动化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 02:46