is it possible (and if yes, is there an example available) to define ECProperty as enum type, so the only predefined values will be possible to choose from MicroStation GUI when the property is edited? I guess a relationship to some class with array of values can be the solution, but was not able to create such schema so far.
Jan Šlegr said:is it possible (and if yes, is there an example available) to define ECProperty as enum type
Hidden in MicroStation CONNECT Update 7 are Pick Lists. In that Update I don't think that they were intended to be publicly visible. Perhaps we'll see more in Update 8.
See Krister Surell's post about Picklists and C#. He obviously spotted something that I missed!
AFAIK all ECProperties (and hence Item Types) are ultimately XML data. There are structures such as ValueMaps (see the delivered EC Schemas) that could be interpreted as a C#/C++ enum, but there's no way that I know of to convert a ValueMap to an enum at run-time.
Regards, Jon Summers LA Solutions
Thanks, Jon Summers. I always appreciate your time and expertise. Unfortunately for me I'm working in SS3 and don't have experience with C#/C++ (yet?), so I'm constrained to find a solution via the XML schema and VBA if necessary.
chrisedjohn said:I'm constrained to find a solution via the XML schema and VBA
If you want to work with XML using VBA, then you need an XML parser. Microsoft's MSXML works with VBA.
It's a low-level API. You load a file (e.g. an EC Schema) into a document object model (DOM). You use low-level MSXML functions to work with the DOM: for example, to query for a value or values. To make that work you have to have a good understand of the XML query language and how that works to find one or more nodes. It's best to use a tool such as XMLSpy to understand the query syntax.
What you're attempting with MicroStation V8i SSx and VBA will be challenging.
You can avoid the hassle with XML and VBA by using C# to create a COM DLL. C# lets you create a COM DLL, which you then call from VBA. You design the interface to be implemented in the DLL: for example,
GetWidgetSize (ByVal index As Long)
I recommend this because C# has excellent XML query and construction tools available, such as Language Embedded Query (LINQ). Take a look at LINQPad, which provides some wonderful examples.
Please consider starting a new thread!