Catia macro connection with database
Introduction
If you want to make CATIA Macro connection with a database you need some basic info. So this paragraph will be just simple introduction to the database. In the beginning it is important to say that this post has been written without a lot of knowledge about databases. The definition of a database on Wikipedia is: A database is an organized collection of data, generally stored and accessed electronically from a computer system. You can read more about the database on Wikipedia. There are a lot of resources for it.
Considering that, we started to think about how to integrate it into our CATIA macro application. Can you make CATIA macro connection with the database?
Database integration ideas
In the beginning we want to say that our application is written in Visual Basic. So we started searching for more info about free online databases. We found the database from Google called Firebase. Firebase is a mobile and web application development platform developed by Firebase, Inc. in 2011, then acquired by Google in 2014. It was very hard to found some VB code to connect with the Firebase. After a while, we found one Italian blog.
Users
The goal was to create users for macro applications with user names and passwords. We found this post about that.
It was little bit hard to understand but at the end the goal was achieved.
The end result will be the previous picture that has two fields, one with a username and another with a password. The user name, in this case, is PC name. We manually created profiles with usernames and passwords. Profile pictures for users are stored locally but you can also store it online. Therefore, in this case, the user needs to get a password so they can log in to the application. After entering a password user will click on the login button. Consequently, the application will connect to the database and check the password for the user.
Also, you can make Sign Up part so users can make a profile with username and password.
Data collection
Now with created users, we want to collect some data from every user and store it to the database. Our CATIA macro application has a lot of macros inside, so we want to know the usage of the macros. Aim is to help our users to make macros better. So if someone doesn’t use a lot of macros you should speak about it. The problem can be in understanding or in the macro itself, and those two must be differentiated.
So how this works? Every user has own profile with counters for every macro. Also, there is a global counter for all users. For example, when a user runs one macro, it will connect to the database and increase the value of that user and increase global value for one number. The diagram is made to read those global values, but also it can be made for every user.
Chat
One more example of database integration is chat. We just make simple chat, in this case, for a small number of users. So, for example, you can write about the current project and so on. You can check code for it on this blog post.
This was a simple implementation of the database, although of course there are a lot of other possibilities. All of this was achieved just by using that blog post. We hope that we helped you a little bit, to open your eyes.
If you have any issues feel free to contact us.
Read my other post, CATIA tips and tricks are very useful for example.