Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


CATIA VBA macro for comparing 2 CATParts

CATIA VBA macro for comparing 2 CATParts


I wanted to write a catia macro for comparing 2 CATParts using SPA Analysis compare method.

1: Macro should ask user to select 2 part.
2: Areas where both matches, should be in yellow color.

There are some sample code in documentation, but they are not working in CATIA V5R25. Will *.3DMap file work in R25? if not, what are the alternatives?

Dim var11(0)
var11(0) = "C:\Comparison\AddedMaterial" & myDate & ".3dmap"
products1.AddComponentsFromFiles var11, "*"


RE: CATIA VBA macro for comparing 2 CATParts

Will be useful. I believe licence will be required for that.

Jenia Ladkov

RE: CATIA VBA macro for comparing 2 CATParts

Hello Jenia,

Yes, SPA license may be required.


RE: CATIA VBA macro for comparing 2 CATParts

did you try compare product function?

if you're missing CATIA API, you can always use Win API to interact with the function.

Eric N.
indocti discant et ament meminisse periti

RE: CATIA VBA macro for comparing 2 CATParts

Thank you Fernando and Eric,

Very good information from both of you.

I was trying to figure out if there is any CATIA API to do visual comparison to avoid WIN API. Also there are annotation captures in both the versions of part. I need to compare solid along with annotation, take a grab and put into ppt.

So even if I go with WIN API, I am not sure if each capture can be compared along with solid differences.

Currently I am following few steps
1. Add both parts in product
2. change 1st part color to green
3. change 2nd part color to red
4. display capture one by one
5. take a screen shot.

But if there is not difference in annotations, color is only red. So brings the question if any text is removed in new version , is it hidden and not known?

If I move one of the part by .1,.1,.1, then I cannot compare solid correctly?

Please suggest


RE: CATIA VBA macro for comparing 2 CATParts

Hello All,

I tried using WinAPI to compare the products. Facing below issue. Please help

1. Able to get the handle for window "Compare Products"
2. Able to get the handle for listbox "Selector003"
3. But could not able to assign product1 in listbox selection. Tried with Objselection.add Product1. But didn't work. Incase if I go with mouse click event. How do I find the cursor position of product1 in spec tree?

I need help to find out how to assign the product1 and product2 selection in Selector003 and Selector006 boxes.

Thanks in Advance

RE: CATIA VBA macro for comparing 2 CATParts

you select it then call center graph function?

did you try to add the instance name to the listbox then make it the selected item?

Eric N.
indocti discant et ament meminisse periti

RE: CATIA VBA macro for comparing 2 CATParts

Thank you

I tried to add instance name in listbox using LB_ADDSTRING and LB_SELECTSTRING functions,

- Instance name added to listbox and also selected
- Comboxbox appears in listbox and could see 2 items, Selected Instance name and "No Selection"
- But Preview button is not enabled.

Any suggestions would help,


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close