Hi All,
I'm working with BRCM and using item browser to quickly extract some information about equipments in the model but in most of the cases it takes a long time due to the fact that default settings for tree manager make the item browser scan for items in all refernces and discover all item types.
So I'm wondering if there is any chance to set up this options using vba by the time the file is open so when I need to use the item browser it will load almost inmediately.
I have contacted support and they advice me to use macro recording to reproduce all the steps but the code produced is very simple and only opens the item browser but it doesn't change any options. By the way vba and basic macro recording produce almost the same code.
Here the code produced by macro recording (basic):
Sub main Dim startPoint As MbePoint Dim point As MbePoint, point2 As MbePoint ' Start a command MbeSendCommand "MDL KEYIN Bentley.ECUISupport,ECUISupport EC BROWSE" End Sub
To make it more clear, these are the options I need to change:
Thank you in advance.
Rodrigo
Hi Rodrigo,
Rodrigo Cortés said:Here the code produced by macro recording (basic):
Do not use MicroStation BASIC macro recorded! It's obsolete technology, not supported in V8i version (and maintained only fore backward compatibility, not migrated to CE).
When you need to record actions (even when it does not help in the discussed case), use MicroStation VBA and related recorder.
Rodrigo Cortés said:So I'm wondering if there is any chance to set up this options using vba
Unfortunately not, this tool has no key-ins and does not support any interaction with MicroStation VBA.
Rodrigo Cortés said:but in most of the cases it takes a long time due to the fact that default settings for tree manager make the item browser scan for items in all refernces and discover all item types.
What happens, when you change the repository setting (to not include references etc. as you requested) and press Save in Tree Manager?
The configuration should be saved to active DGN file, so when you will use this stool for the next time, the updated settings should be used.
Of course it does not solve the problem of default settings for new models, but I guess it's acceptable to open it in a slower way once, for the first time.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Thanks for your quick reply Jan,
Jan Šlegr said:Do not use MicroStation BASIC macro recorded! It's obsolete technology, not supported in V8i version (and maintained only fore backward compatibility, not migrated to CE).
It was advised by support team to do it that way, I know BASIC is old but didn't know that is was not migrated to CE, good to know.
Jan Šlegr said:Unfortunately not, this tool has no key-ins and does not support any interaction with MicroStation VBA.
Ok, so VBA is not the way to go. I will try to see if it is possible using .net, I've been porting some macros to .net so I have a little of experience. Could you point me somewhere to start? Navigating the object browser for Bentley.ECSystem.2.0.dll and Bentley.ECObjects.2.0.dll I found the Bentley.ECObjects.Standards.ItemsBrowserTreePresentation class but I have no idea on how to use it. I also found the Bentley.ECSystem.Repository.RepositoryConnection class which I think is more related to my issue because I'm dealing with a repository connection.
Jan Šlegr said:What happens, when you change the repository setting (to not include references etc. as you requested) and press Save in Tree Manager
The first time I get an error:
But then, if I press save button again the changes are saved, so I suppose that this is the "standard behavior" of the software.
As you mention it solves the problem but I wouldn't be here if I didn't believe there is a better way of achieving this.
Rodrigo Cortés said:Could you point me somewhere to start?
No, I cannot. Item browser is a tool, not API, so there is no "place, where to start". If you have plenty of time and proper knowledge, you can try to hack the application, but I do not think you can be successful.
Rodrigo Cortés said:Navigating the object browser for Bentley.ECSystem.2.0.dll and Bentley.ECObjects.2.0.dll
If I remember right (but it's long time I wrote EC code for V8i) these assemblies are used when EC API is used in MicroStation addin. In MicroStation SDK, there is EC SDK documentation available, but before it, to learn EC XML data and EC concepts is recommended. EC API can be used to access data in DGN file in the same way as Item browser (it is written on top of EC API).
Rodrigo Cortés said:The first time I get an error:
I do not recall such error in MicroStation, so maybe BRCM adds something extra to DGN file, which causes this exception.
Rodrigo Cortés said:As you mention it solves the problem
Another option you can try (but you did not tell too much what data and how you need to query) is to create own search definition (EC Query), save it and to recall it. I am not sure if there is key-in to open the search directly, without interaction with the whole Item browser, but may be they are.
With regards,