Hi i am trying to link graphical elements to the database using odbc connection.
Everything works fine in terms of text, but i need the level or colour of a specific element to go accross to the database and should change dynamically if i change a colour or level in the design.
Is this possible or not?
If so please explain
I am running microstation select series 2 on my pc
from technical point of view I think it is possible to develop such solution, but in MDL/C++ and not in VBA. You have to track all changes that will be written to a design file and to write selected events into your database. My feeling is such solution will be fragile and possibly slow.
Can you describe what you want to achieve as your request is a bit unusual? May be another solution or workflow exists already.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
What I am trying to achieve is to have 4 different colours as circles for example in the design file. That must be written to a database and can be changed dynamically. Do you have any example files of writing levels or element colours to the database?
No, I have no such example. As I wrote, it is a bit unusual request.
In general it is not recommended to store any information in two places - in your case the color will be stored as an element property in DGN and a database. You can track if the element color will change in DGN (a user will change it and the change will be saved) and you can subsequently change the information in the database. But what will happen if the database will be not connected. And what if the color information will be changed in the database directly? In such case you have no chance to replicate such change back into DGN.
BTW What you wrote is what you want to achive from technical point of view. But what is the value and reason of such functionality? It sounds similar to GIS approach when features (elements) are stored completely in the database and they are extracted to DGN and if changed, posted back to the database.
[Added] If you want to learn more about how to hook design file changes, I recommend to check MDL and C++ API documentation.
We want to use that functionallity to check whether certain elements in a mine shaft are correct or not.
You say that its similar to the GIS approach. What do you mean by that and how do i go about using it because it does not matter what application i use, as long as it opens a dgn file?
If it is about checking element, have you tried Standard Checker? It can be easily extended with VBA or MDL and also can be used in batch mode, so it is can be utilized to check more files in the same time.
I have to say I see no connection between checking element and a dynamic linkage to a database. Can you describe step-by-step how you want to check your designs? Usually it is done per-file and there is plenty of options based on what condition the elements are checked. Do you use Element templates?
I think i confused you abit. I meant that the users will place the different graphic element colours(circle) on the design file where they see a problem. this should be written to a database. If there are any changes in the element colour it should change on the database as well. Is it easier to this via the GIS way that you mentioned?If so how do i go about doing it?
OK, now it is clear and much more simple :-)
I will try to repeat howyour application should look like:
Something like this can be simple or pretty complex and sophisticated application. In the simple form it can be developed in VBA in MicroStation, PowerDraft (or may be even in Bentley Navigator, but not quite sure about that :-).
There are plent of questions and issues crossing my mind related to such application, probably the most important is how to establish the connection between the particular circle mark and the database. You can use MicroStation DB linkage or you can design your system and to establish your connection, both have pros and cons. WIll be there more "marked design" connected to the database or only one design file will server as basic map for marking?
Thank you for the quick response
I tried using the microstation db linkage but had no luck linking the level of the circle to the database.
If i could link the level to the database that would be great because i can change the level using the "verify linkage tool" in microstation and process the selected rows.
Can you help me with a detailed explanation on how do i go about doing this?
DB linkage (consisting from AE and mslink) is an optional feature of graphics elements. It means you cannot link a particular attribute of the element to the database, but only the element itself. The mslink points to the database row, table is defined by AE and mscatalog table. What you will store in the database is completely up to you, the only mandatory column is mslink.
So it is not possible to send the level through. What i have done is placed an orange circle and created a level called orange. I want that level or the colour to go across to the database.
It is still not quite clear what you want to do :-(
OK, you create an circle element (in fact an elipse looking like circle :-), that belongs to some level and has some color. You also create the level called "orange". Does the elipse belongs to this level? And the orange color is set as element color or the level color (so the circle color is set "by level")?
If you want to store the color of the circle, you can create DB record with the table with column "color". It is up to you / your application, that the element color will be read from element and filled in the DB row in the column "color".
If you want to store the color of the level, you has to do it by your own, it means to read this information from level definition and to store it in your database.
yes thats correct. I created the level called orange and set colour "bylevel" and then made the circle belong to the orange level. I want to write the level name to the database and dont have a clue how to. Do you have any example file that you could post to help me link up levels to the database?