问题
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