Use C# for Catia V5 Automation

我与影子孤独终老i 提交于 2020-01-01 03:44:08

问题


I want to write Macros/Programs for Catia V5 with the programming language 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.

This is how I imagine the connection/interaction between a C# Programm and Catia:

C# - .NET <-bi-directional integration-> COM <-> Catia API

Is that correct ?

Also: How do I setup everything in Visual Studio , so that I can access the Catia API (and code completion etc.)


回答1:


1) Add INFITF typelib library in reference which is interface to CATIA application

2) Define CATIA as global variable as like

   INFITF.Application 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.



来源:https://stackoverflow.com/questions/40620334/use-c-sharp-for-catia-v5-automation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!