Search code examples
c#visual-studioapicomcatia

Use C# for Catia V5 Automation


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.)


Solution

  • 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.