Thursday, February 6, 2014

Visual Basic API for PTC's CREO - Setup

In order to use this API (Application Programming Interface) it is necessary first to install this capability and do the proper setup in both Windows and the programming tool. MS Visual Studio can be used for programming and accessing the COM object but also Excel or other COM enabled tool.


Installing VB API


When Installing CREO Parametric be sure you select the VB API as is shown in the next picture:



If all installation process is done successfully then in the installation folder of CREO you´ll find a folder named "[Creo Path]\Common Files\M010\vbapi" [Creo Path] is the path you selected for installing CREO.



Is in this folder where most files related to VB API are located. There are many files inside but one that will be very useful with this API is the "vbug.pdf".


This document is very important and shows most of the contents for this API. Most of the procedures we are to see now are documented there but ours is a practical experiment you can follow.

Connecting MSExcel with CREO via VBAPI

In order to connect any application with CREO Parametric by means of this API, it is necessary to:

1- Set the PRO_COMM_MSG_EXE enviroment variable to the full path of the executable file pro_comm_msg.exe. which is located in:
 <creo_loadpoint>\Common Files\<datecode>\<machine type>\obj\pro_comm_msg.exe, where machine type is i486_nt for 32-bit Windows and x86e_win64 for 64-bit Windows installations.

For doing this, look in MSWindows for the Control Panel, then select System, then Advanced tab, then Environment variables an Add a new one PRO_COMM_MSG_EXE With the path explained before as the contents of the Value text box.

2- Register the COM Server. For doing this just run the "vb_api_register.bat" file located at <creo_loadpoint>/Parametric/bin.

Now each time an application tries to call Creo with the commands of this API, the server will automatically start.

3- Now on the side of the Excel Application, set project references for the VB API, Just select Tools and then References and Check the box for Creo Parametric VB API Type Library for Creo Parametric as shown in the following figure.


4- For Visual Basic .NET Environment, Click Project Properties Add Reference COM. and then, select Creo Parametric VB API Type Library for Creo Parametric as shown in the following figure.



More information on this can be found in the vbug.pdf or in the interactive help whose use is also shown in the vbug.pdf manual.

With this done we are ready for creating our first application.





12 comments:

  1. Perfectly correct procedure. Shall I get VBAPI application for creo assembly projects

    ReplyDelete
  2. how do I assembly for different assembly components through VBAPI application in creo

    ReplyDelete
  3. Hi William

    Have you tried using other API besides VB. I believe you will like others API as they can do much more.

    ReplyDelete
  4. I cannot find "Creo Parametric VB API Type Library for Creo Parametric" in my tool references. Please help me with this.

    ReplyDelete
    Replies
    1. Go to Tools > References > Browse..
      C:\ENGapps\PTCCreo\2017_M060\Creo_4.0\M060\Common_Files\x86e_win64\obj\pfclscom.exe

      Delete
  5. I have followed the above steps..but it did not happen for me. I could not find VB API Library reference both in VBA or VB.net 2017..creo version is 3.0
    Even I tried to add pfclscom.exe path but it shows error message.
    Can someone please help me how to proceed

    ReplyDelete
  6. .Net technology. This post gives me detailed information about the .net technology. I am working as trainer in leading IT training academy offering Dot Net Training in Chennai and i use your guide to educate my students.



    Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery



    ReplyDelete
  7. Thank you for sharing the post, keep blogging, otherwise anyone can want to learn CREO course so contact here- +91-9311002620 or visit website- https://www.htsindia.com/Courses/cad-cam-cae/creo-for-industrial-designers-training-course

    ReplyDelete
  8. Great Post! Thanks for sharing. Keep sharing such information.

    Join Online Creo Training and Certification Course in Gurgaon

    Want to be a CREO expert? CREO is 3D modeling software and is widely used in the design industry these days. If you learn CREO by industry expert then join our world’s best Online Creo Training and certification classes in Gurgaon. At Ducat, we offer advanced Creo Training and helps the students to shape their carrier with certification, and 100% job placement in top organizations. So join today India’s most recommended institute for Creo Training. For more information, you can call us on 70-70-90-50-90

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete