cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Creo Toolkit using C#

ms-6
6-Contributor

Creo Toolkit using C#

Hi all,

I have some basic idea on creating application using VB API, now I am trying to create a application using C#. Can somebody help me regarding procedure to start with like adding reference in visual studio, and connecting to the active creo session. I have gone through tkuse but I am no where.

Regards

Manjunath.S

ACCEPTED SOLUTION

Accepted Solutions

Yes, of course. You can even combine VB.NET and C# ...

View solution in original post

7 REPLIES 7

Hello Manjunath S

Creo API does not directly support C# but you can do by using dynamic libraries. You need to create your own dynamic library using Native language.

If you want to create a Creo Toolkit library, you need to create dll in C Program and import at runtime with your C# Project.

See this thread, how to import C++ dll in C# program

https://stackoverflow.com/questions/7232259/c-sharp-importing-c-dll

Parthiban Kannan

href="https://www.linkedin.com/in/parthiban-kannan/" target="_blank"
ms-6
6-Contributor
(To:PARTHIBAN_K)

Parthiban Kannan‌ how to add reference in Visual studio while using a c program. Also I need to have develop an application with user interface. Please provide if training material if available, except TKUSE.

Hello Manjunath S,

  You cannot add reference like C# or Vb.net program. You've to use interop services & refer the dll at runtime

Parthiban Kannan

href="https://www.linkedin.com/in/parthiban-kannan/" target="_blank"

There is no need for creating C program. VB API is COM library, not .NET assembly, but you can use it as a reference in .NET application.

You have to follow the first steps described in the documentation:

Common Files\vbapi\vbapidoc\index.html, User's guide > Overview of the VB API > Visual Basic .NET Applications

You have register VB api by vb_api_register.bat and then you have to add the reference in Visual Studio. For C#, right click the References in Solution Explorer > your solution > your project and in the dialog that appear switch to COM tab - you will find there the library mentioned in the user's guide

You have to add then:

using pfcls;

and this is an example method for making connect to Creo:

public static void Connect(bool synchronous)

{

    try

    {

         m_Connection = new CCpfcAsyncConnection().Connect(null, null, null, null);

         m_Connected = true;

    }

    catch (Exception ex)

    {

         CheckReturnCode(-1, ProErrors.CONNECT);

    }

}

Back in 2015, I used VBAPI with Vb.Net. Can we use C# for VBAPI as well?

Yes, of course. You can even combine VB.NET and C# ...

Hello PARHTIBAN_K

 

i know the link to stackoverflow, but i think the problem is that Manjunath_S and i need not only the call to a c function. If i create a menue and want to call a c# function from their. I think that is the main problem (for me).

 

Do you think we can create a small visual studio project that shows the using?

I think that all others were happy to have a little example.

 

Thanks 😉

Announcements


Top Tags