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
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.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
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?
Because you don't want to link elements to DB but only store you information into to, the problem is not related to MicroStation in fact. You should use standard VBA classes to connect to your DB and to store the informations. I am pretty sure if you will search Internet for "VBA connect SQL" you will receive plenty of examples.
VBA is a bit mean in terms of DB connection, but it can be done and the data can be stored/retrieved with standard SQL commands.
I wrote such macro in the past but unfortunately I am not able to find it (probably deleted after it was accepted by my customer :-).
ok thank you for the response.
Any idea how i can pickup the "level" from microstation and send throught to the database using vba connect sql?
Well ... I have ... find the appropriate level object, take the information you are interested in and store them in the table you will create in the database.
To be honest and open - I think it is time you should to decide if you know MicroStation VBA object model, VBA itself and database world enough (or you are willing to spend enough time and to learn it) or if it is easier to pay for the development.
Read this article about
MicroStation and databases.
It mentions the Microsoft Data Access Components (MDAC),
which are Microsoft COM libraries.
Use MDAC to communicate between VBA and an external DB.
Download MDAC and install on your computer.
In VBA, make a reference to MDAC so you can use the library in your code.
You will find plenty of information and examples of MDAC both in the documentation available from Microsoft and on the web.
If you read the above article you will know that the DatabaseLink attached to an element is minimal.
It matches the element with a row in a table using the MSLink (row ID) and Entity Number (table ID).
If you want to store other information in the database then you must write the appropriate SQL statements,
fill the parameters with the right values, and update your DB via MDAC.
For example, the pseudo-code for adding an element's level to the DB would be something like this …
Regards, Jon Summers
Regards, Jon Summers LA Solutions
Bentley Map's GeoSpatial Administrator provides the capability you describe in its Property Based Symbology. Changes to the database are dynamically represented in the Design File. Additions and changes to the Design File are automatically updated in the database. You can use ODBC or any of the other supported databases. You can include your custom made MDL or VBA routines as-necessary.
Bentley Map GSA Features
Manages the XFM framework through one interface
Runs outside MicroStation
Defines and maintains XFM project files
Schema contains comprehensive definition of geographic objects (features)
User interface definition – dynamically loaded at run-time
Inclusion of custom made VBA or MDL routines
User specific definition of features, operations, methods – using workspaces
Automatically generates MicroStation workspaces and map metadata files
You could hop over to SELECTservices, download a 30-day eval and give it a try.
Wouldn't this be a lot easier with tags, tagged cells , and tag reports and excel or even one of LA solutions products like flexitable or similar .. some of their freeware may even be able to be adapted...
The tag cell can be one for every colour and you could have different fields for things you want to populate at the user level that can be sent to tag reports.. this can work even for output to report even if all the files a refernced into single empty file and the report run on the tags there are loads of attributes etc that can be sent to the report...
there is an excellent tutorial on just this use of tags at eat your cad web site.
Currently Using V8iss10 (8.11.09.919)
and dabbling in CE update 16 (10.16.00.80)
Pwise Administrator ( yeah I passed the training course!)
MicroStation user since 1990 Melbourne Australia.click link to PM me
Lorys said:Wouldn't this be a lot easier with tags ... ?
There are good reasons for using a relational database (DB) to store information. Not least, relational data are easy to query using a formally-defined language (SQL). There is a wealth of reporting tools that can extract and filter data from a DB and present it in a number of ways.
Contrast that with MicroStation tags' complete absense of query tools. For example, suppose you have a set of door cells tagged with data about size: there's no way to ask MicroStation to tell you, say, how many doors you have in a DGN model that are 1.8m high. The MicroStation tag reporting tools are poor: all you can do is export a flat file from one tag set as CSV or XML. There's no way to produce even a summary table of tag data in MicroStation (but you are right, FlexiTable™ does provide a solution for that).
Regards, Jon Summers LA Solutions