Is it possible to define ECProperty as enum type?


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.

With regards,


Parents Reply
  • 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.

    A Better Approach

    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,

    • GetWidgetSizeCount returns the number of widget sizes from Paul's ValueMap
    • GetWidgetSize (ByVal index As Long) returns the value of widget size at the specified index

    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.

    Regards, Jon Summers
    LA Solutions

No Data