CATIA macro and Excel

CATIA macro and Excel

“Your connections to all the things around you literally define who you are” Aron D. O’Connell

Microsoft Excel Logo

Introduction

Excel and CATIA are one of the most used programs in the world, so a combination of these two pushes boundaries even more.  CATIA software engineers made a lot of connections with the excel possible. Some examples of these implementations are Part parameterization (excel table is used to store info about part variants), Export stock lists in Excel table, control design, etc. 

Absolutely when we talk about CATIA macros and automation, Excel is also very important. Previously we mentioned stock lists. The only logical way to get data from model and store in Excel file in order to fill those stock lists is to use CATIA macro. 

Having this in mind we decided to write this post and help you overcome unknown about this subject. 

There are a lot of questions about this subject, such as http://www.coe.org/p/fo/et/thread=27860

https://www.eng-tips.com/viewthread.cfm?qid=367762

https://www.eng-tips.com/viewthread.cfm?qid=438183

In addition, we think that you will be able to overcome the problems described in this forum posts, after reading this post. 

Examples of CATIA macro and Excel connection

Furthermore there a lot of options when we talk about communication between CATIA macro and Excel. So we will try to show you the most common. 

Before that, we need to start an Excel application and set some basic things. 

Now we can go furthermore and do some action too. So one of the most common actions is to write in an Excel cell. It’s one very simple line however in general, it will certainly do everything, depending on how you use it. You can put in any kind of loop in addition to get a lot. Of course you just need to specify in which cell you want to write. 

Indeed a loop is basic stuff in any kind of code. Let’s make a simple combination of the previous line and for loop to write numbers from 1 to 10. 

Also, we can write in both directions using two for loops. 

Those were options for writing into an Excel cell. You can also retrieve info from cells. We used a MsgBox command to do it. Of course, you can pass this info anywhere you want. 

Almost all infos from CATIA are stored in some sort of table. Here are just basic info about cell width and color, of course, there are a lot of options to set about the cell.

Finally, we will use all of these information mentioned before in order to create a little bit more advanced macro. There a lot of questions about exporting points coordinates from CATIA to Excel. So there are a few steps. Firstly, we need from user to select points. After that use for loop to control data extraction from selection and also to export all info we need in Excel table. 

Also if you want to read more about multiple selections please visit this CATIA macro selection

Full code

Here is the full code of this macro. Using these simple methods we showed that it can absolutely achieve a lot in automation.  

15 thoughts on “CATIA macro and Excel

  • February 10, 2021 at 9:15 am
    Permalink

    Good morning
    I need to create a macro to assign a value to a specific parameter present in all parts of a product.
    There will be many parts in the product
    Is it possible to have this service?
    I can pay the price of the job
    Alberto

    Reply
    • February 10, 2021 at 9:36 am
      Permalink

      Hello, I sent answer to your mail.

      Reply
  • August 31, 2021 at 4:41 am
    Permalink

    CATIA MACRO FOR CLASH REPORT GENERATION IN YOU TUBE. NEED EXACT MACRO FOR EM AND WILLING TO BUY

    Reply
    • August 31, 2021 at 8:41 pm
      Permalink

      We sent you mail

      Reply
  • May 17, 2022 at 10:00 am
    Permalink

    Hello, is it possible to read data from bill of meterial in catia, then writes it in excell?

    Reply
    • May 17, 2022 at 10:06 am
      Permalink

      Hello, yes ofc. You can read data from the properties of the parts, i guess that you have created properties for Bill of material.

      Reply
  • June 29, 2022 at 5:44 am
    Permalink

    hello ,your Macro isn’t work 🙁
    Do I need to do anything to get started? I just opened the Drawing that has the table

    Reply
  • August 16, 2022 at 1:15 pm
    Permalink

    Hello, i need to export a measure from catia to exel and i don’t know how to get the measure parameter, is it possible ?

    Reply
  • August 25, 2022 at 8:47 am
    Permalink

    Hi,
    I want a macro for renaming the bodies in .CATPart.
    please let me know about it..
    Also let me know is there any trainings provided for CATIA V5 Macros
    Thanks & Regards,
    Kamal.
    mail id : medakamalakar312@gmail.com
    Watsapp # +91 9985445511

    Reply
  • September 23, 2022 at 3:08 pm
    Permalink

    Hi Harun,

    I use “GSD_PointSplineFromExcel” file in the main Catia folder and add my points to this file. But when I run the macro for create points in Catia, coordinates becomes smaller. For instance, my first point is (0,-90,10) but it reads as (0,-9,1). It seems a wrong decimal. Could you advice anything?

    Reply
  • January 5, 2023 at 6:53 am
    Permalink

    Hi,
    Can we export stock size as length, width and height of parts according to their part numbers from a product into an excel?
    Is it possible?

    Reply
    • January 5, 2023 at 9:07 am
      Permalink

      Hello,
      Yes it is. You need to loop through the CATIA tree and get it.

      Also take in count if you more instances.

      Reply
  • July 6, 2023 at 12:56 pm
    Permalink

    Hello,
    I need to Exact a point present in the geometrical set and export it to csv file

    Reply
  • November 20, 2023 at 10:10 am
    Permalink

    Hello,

    I have a catia BOM macro and I would like to find the last row of the excel sheet to then fill in a summary.
    Is that possible?

    Cheers,
    L.

    Reply
    • November 21, 2023 at 5:17 am
      Permalink

      Hello,
      Yes it is, I forgot how to do it.
      But I did it more times, maybe you can track number of rows and then just go to the next one.

      Also I think you can make one loop that will go through the cells and check is it empty, and set counter, so when it is that’s the cell and just go to the next xt one. I hope this help.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *