×
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

Share catia macros
3

Share catia macros

Share catia macros

(OP)
Hello all,

I have created a macro userform for Catia with several modules underneath and calling them.
My question is that how can I share this catvba project with others, while they can run the userform but they are not able to see my code. I dont want to share my code with others but they have to run it somehow.
I tried macro protection but in that case they can only use it if they know the password, soes it is not okay.
Maybe calling the userform from another project.

Do you have any idea for that?

Thank you in advance!

RE: Share catia macros

Hi,
You need to double check that. As per my knowledge after using macro protection it does not require password to run that macro.

RE: Share catia macros

(OP)
Yeah maybe you are right, but I create a ribbon menu with an icon to run the userform from it. But there is no option to run it only the modules appaer so I can attach them for the button.

I tried to write a module which call the userform when the user run it. It is also appaer when I tried to attach it to the icon, but it doesnt work.

Am I doing it wrong, or do you mean on anything else?

RE: Share catia macros

Hi

You can call a specific module from a catvba file with a CATScript and for this CATScript you can assign an icon in a (eventually) new toolbar.

CODE --> CATSscript

Sub CATMain()

Dim param()
Dim oFilePath, oFileName, oModule As String
Dim oSystemService As Variant
Set oSystemService = CATIA.SystemService


oFilePath = "C:\Temp\"
oFileName = "Test.catvba"
oModule = "Grid"   ' module name

Dim ss as Variant
Set ss = Catia.SystemService
ss.ExecuteScript oFilePath & oFileName , catScriptLibraryTypeVBAProject , oModule , "CATMain" , param

End Sub 

Regards
Fernando

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

RE: Share catia macros

... and param is an array of the parameters you want to pass into CATMain, i.e param(0)=x, param(1)=y, param(2)=z, CATMain(x,y,z)

regards,
LWolf

RE: Share catia macros

(OP)
Hello,
Thank you for the answers.

@ferdo: Is this solution working if my catvba project is really complicated and i have at least 11 modules underneath the userform? I mean, that can i initialize the userform, or i can manage the modules umder it?

So my main goal is that i can make a button on a toolbar which initialize the userform, so i can protect my code from curious eyes... 😁

I hope you will understand my side.

Thanks for previous answers again.

RE: Share catia macros

Just move you're code to external application (.exe). Probably best way would be to use Visual Studion Express or any free IDE. This means that you would need to recreate the forms, but you should be able to convert relatively easy the code. In this way you could protect the code you make and use full power of vb.net. For the application that I do, I read the PC user and allow only desired users to use the application for a desired time.

RE: Share catia macros

(OP)
Hello,

Yes i have seen that creating the code in VB.net will be a good solution, but because of the lack of license its sadly not an option.

@Ferdo:
I tried this code, but it doesnt work for me:
Sub CATMain()

Dim param()
Dim oFilePath, oFileName, oModule As String
Dim oSystemService As Variant
Set oSystemService = CATIA.SystemService


oFilePath = "C:\Temp\"
oFileName = "Test.catvba"
oModule = "Grid" ' module name

Dim ss as Variant
Set ss = Catia.SystemService
ss.ExecuteScript oFilePath & oFileName , catScriptLibraryTypeVBAProject , oModule , "CATMain" , param

End Sub


I have an userform called Userf1.
I create underneath this userform a module called Run, which contains:
Userf1.show modeless.

I want to run this "Run" module whith a catscript, and launch it with an icon.

I passed the path and name of the code corectly, no error message appeared, but nothing happens.


Any idea what is the problem?

RE: Share catia macros

(OP)
Hello,

1. Catia V5 R19. I use win10 , x64
2. Correct
3. Correct
4. Correct

The code runs, but it didnt do anything.
I dont know what could be the problem...

RE: Share catia macros

(OP)
Yeah that was the problem.
You are all the best! Thank you!

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

Overcoming Cutting Tool Challenges in Aerospace Machining
Aerospace manufacturing has always been on the cutting edge, from materials to production techniques. However, these two aspects of aerospace machining can conflict, as manufacturers strive to maintain machining efficiency with new materials by using new methods and cutting tools. Download Now
3D Scanning in the Automotive Industry
With over 100 years of production history, the automotive industry has been at the forefront of manufacturing technology since its inception. Whether the transformative technology of the day was the assembly line, the integration of robotics into the manufacturing process, or the switch from steel to aluminum frame chasses, the automotive industry has consistently implemented advanced technology into its manufacturing and production workflow to improve manufacturing and product performance. Today, the same is true. Download Now

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