Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Macro In Catia When a Part of Product is Opened

Status
Not open for further replies.

blues1143

Computer
Nov 22, 2016
14
GB
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
 
Replies continue below

Recommended for you

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

- Romania
- EU
 
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
 
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

- Romania
- EU
 
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
 
@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
 
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
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top