We are using connect edition of Microstation on windows 10 OSI wanted the properties of the elements(see attached image) to be written to a text file or excel sheet. Any help is appreciated. I wanted to see this happen using mVBA.
RAMESH P K said:I wanted to see this happen using mVBA
What's special about VBA? If you're using MicroStation CONNECT, then what about using a Report? No programming required!
You should provide more clues to enable us to help more:
Regards, Jon Summers LA Solutions
Hi Ramesh,
RAMESH P K said:We are using connect edition of Microstation
Please respect the best practices and specify the used product including its exact version. There have been released more than 20 version of MicroStation CE.
RAMESH P K said:I wanted to see this happen using mVBA.
It is not how (professional) software development works ;-)
When there is a goal or requirement, always available tools must be checked, whether they can be used and whether they allow to solve the requirement. MicroStation VBA is very limited, simple "hobby tool", with two main problems: The language + environment itself, and limited API in MicroStation (comparing to C++ and NET APIs).
It is very simple to reach VBA limits, when more complex data structures are accessed.
RAMESH P K said:I wanted the properties of the elements(see attached image)
They are not element properties.
In MicroStation terminology, the element properties are level, color etc. What is on your picture, looks like EC data, which are data external to an element (there is a reference between original element and the data).
RAMESH P K said:I have marked in color showing Link and Xattributes field. Hope this helps.
User data (links) are binary data, attached together with the element (in the element structure). Without further analysis (e.g. to use "analyze element" key-in) it cannot be told what data it holds. VBA can access it (search for "linkages" in VBA help), but because they are binary, with unknown structure (defined by the data author), applications should never access the linkages data, other than created by the application itself.
XAttributes are not accessible directly by VBA (there is no such API). They are there, because EC data is stored as XAttributes elements.
RAMESH P K said:iModeller generates i.DGN files of which I have taken snaps of properties in plain Microstation connect edition.
Data, attached to elements, is in i-model stored as EC data, and in MicroStation GUI displayed as is on your screenshot.
The only way, how to access them from VBA, is to use PropertyHandler. See VBA help for description and examples, but be aware this approach is limited and it does not allow to access the data fully, only values. Plus there are some other limitations, so in some situations, VBA can be enough, but some other, depending on data structure and conditions, NET or C++ code must be used.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
RAMESH P K said:I am novice both to Microstation and programming
In that case a Report is your best approach.
RAMESH P K said: could you let me know how we can get it as a report
Without seeing sample data, we can't confirm that it is possible to write a Report.
RAMESH P K said:I am a little wary of sending data in public domain
There is no request to share complete model, where sharing is of course arguable. But to share e.g. one component (valve, pipe...) should not be a problem.
RAMESH P K said:Can I send it across to you? Could you provide me your ID.
Please read and respect community best practices! The communication is based on public sharing of ideas, not requesting direct response. When you want anybody solves your problem (in other than shared voluntary public way), ask and negotiate commercial service.
RAMESH P K said:I want to see how far I can go, to get at the root of EC data items.
In VBA, PropertyHandler is the only (but limited) way. When there is a request beyond VBA capability, you have to learn EC data concept and EC API (regardless C++ or NET is used).
RAMESH P K said:If reports are best, I can stay with that for now.
See MicroStation documentation how to create report and try it. No further advice can be provided without testing real data: What is represented in MicroStation GUI as data, available for an element, can be internally converted from many formats (because MicroStation historically offers several different ways how to store custom data with elements), and different tools (e.g. reports) and APIs (VBA, C++, NET) may offer different level of functionality.
Regards,
RAMESH P K said:I tried to delete components and make a small piece. But the message returned was “It is a read only file”
If the original file is i-model, it is read-only and cannot be edited. Try to reference it to empty file and copy the selected element(s) from reference to the active model. MicroStation should ensure all necessary data is copied automatically at background (but be aware i-model can be generated to do not allow copying).