×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

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!
  • Students Click Here

*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.

Students Click Here

Jobs

Run Macro In Catia When a Part of Product is Opened

Run Macro In Catia When a Part of Product is Opened

Run Macro In Catia When a Part of Product is Opened

(OP)
Hello,

I need a way of running a macro every time a part or product is opened. What is the best way of doing this?

Is it possible to modify the open command to do this? And if so how?

Thanks,

Will

RE: Run Macro In Catia When a Part of Product is Opened

(OP)
Hi Ferdo,

The Macro needs to check the Rev Number the part that is being opened was created in.

EG. V5R18 or V5R24.

Any ideas?

Thanks,

Will

RE: Run Macro In Catia When a Part of Product is Opened

So, in fact you need to know in which release the file was done. This can be done in many ways, depending on how you work.
For example, do you have CATIA (lets say R18) already opened or not? Do you want to open CATIA (specific release and environment) when you open the file?
A program to check what release is your part can be done in any language you want and after checking the release can "intercept" CATIA and open the file inside CATIA.
Basically, if you want to check (manually) what release is the file, you can open it in any text editor and search for word release (you can find some other info if you wish, depending on your search criteria). For a better understanding I suggest you to do this with a small CATIA file and read what is inside.
Generally speaking, when you give a job to a developer is good to tell him all your procedure, conditions, constrains or what ever you think it will help him to give you a better solution.
That being said, you can search also forum or on Internet for such solutions, I know there are some applications which will tell you in what release are parts done or you can develop something starting with what I already wrote.

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: Run Macro In Catia When a Part of Product is Opened

(OP)
Hi Ferdo,

The file will be opened from either double clicking or from file > open in CATIA.

I need a message to know when I have opened a R18 file in R24. Do you know any way of doing this? Any links to application coding for it?

Will I need to do this outside of CATIA or can it be done inside?

This needs to be automated when a part is opened.

Thanks

RE: Run Macro In Catia When a Part of Product is Opened

When you have two or more releases installed on your pc with double click the file will be opened automatically in last releases registered in Windows registry even if you have other CATIA release opened already. I don't think this is what are you looking for.

You can see also this link, you will get more idea about this problem. GELFS application looks interesting if I'm not wrong, maybe he will give you more details.

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: Run Macro In Catia When a Part of Product is Opened

with VB I have the feeling you should be able to monitor all catia session and check all open documents, then get documents path and report version, then either message user or launch catia script... this app could also monitor which catia is active (windows focus on) and change registry so double click on file will come to the catia version... not sure what would happen if you have two windows of same catia level... maybe if would be wiser to change windows so double click or RMB.open would not do anything, leaving only drag and drop or catia open to get file in catia

Eric N.
indocti discant et ament meminisse periti

RE: Run Macro In Catia When a Part of Product is Opened

@blues1143
I'm not 100% sure if it can be done with a reaction, but it's worth a shot. You'll have to grab the KWA license and play around with the different available events: Instantiation, Update, FileContentModification, DragAndDrop, BeforeUpdate. When the reaction window comes up just hit F1 to bring up the CATIA help.

Drew Mumaw
www.textsketcher.com
www.drewmumaw.com

RE: Run Macro In Catia When a Part of Product is Opened

Hello,

@blues1143
I truly think this is close to impossible without the proper API access. You need a BeforeOpen event triggering your code and VBA/VB6/VB.NET can't help you there. The closest you can get is by monitoring CATIA windows and intercept any attempt of opening a file (as itsmyjob suggested already)

About KWA: that doesn't work either. You might "leave" the Part level and go to "Document" level with KWA but, again, you'll have to have the access to the proper event.

Perhaps you need a different architectural approach: e.g. monitor your folders with some FileSystemWatcher and don't allow any Save if it comes from the wrong CATIA level. Just an idea :(

cilici

RE: Run Macro In Catia When a Part of Product is Opened

Couldn't you just create a "Safe Open" script that will call a FileOpenDialog and then check the information you require before initiating the CATIA.Documents.Open() operation? The main downside to this is you would need to convince the user community that this is the only way they should open files moving forward as you cannot hide the default CATIA menu commands.

--Doug

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!


Resources