Hi,
in MicroStation V8i (SELECTseries 4), using C# and EC SDK, I am creating EC schema "on the fly" as necessary based on external data source and save it to file (so the schema is not created externally using Bentley Class Editor).
I am able to create the schema, add classes and it seems there are also no problems with attributes like Units or ECCalculatedProperty.
I have a problem with Category attribute I'd like to attach to different classes to control how they will be displayed in Element Information dialog. I know the attribute definition is stored in EditorCustomAttributes supplemental schema, but I have not found a way how to reference this schema with my schema.
I know I can access different standard schemas using StandardSchemas class, but it does not contain EditorCustomAttributes.
What is the right solution, when there are ECSchema and ECClass instances available, to reference the supplement schema (as far as I know there is no xml file for EditorCustomAttributes available in V8i installation) using C# code?
With regards,
Jan
Hi Jan,
I am not aware of V8i code. But, I can give you CE code snipp. May be, you can give a try in V8i.
#Create Category: ECPropertyPane.CreateCategory(...)
/// <param name="name">The non-localized name of the category.</param>
/// <param name="displayLabel">The localized name of the category that will be displayed to users.</param>
/// <param name="description">The description of the category.</param>
/// <param name="sortPriority">The default sort priority for the category.</param>
/// <param name="defaultExpand">True if category should be expanded by default.</param>
For sort priority somthig like ECPropertyPane. PropertySortPriorityVeryLow should work.
So, CreateCategory will give you category custom attribute instance. You need to apply it to ECProperty.
For e.g.
IECProperty p = new ECProperty (name, dataType); //or get existing property
if (null != categoryCustomAttribute)
p.SetCustomAttribute (categoryCustomAttribute);
Please try this and let me know if you have any problems.
Answer Verified By: Jan Šlegr
Hi Mangesh,
thanks for your answer (and sorry for my delay, I was on vacation). Unfortunately the discussed code has to be written for V8i, but will be probably ported to CE later, so your answer will halp anyway.
I will try to check V8i API whether something similar is available.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
a short update: Quite the same code seems to work fine also in V8i! :-)
In fact I was quite close when I tried to find the solution before I wrote this question, but I did not concentrated to Bentley.UI assembly and ECPropertyPane too much, because I thought this namespace is mostly about how EC data is displayed and I treated Category attribute more as "schema definition" than "data display" configuration.
Will have to research ECPropertyPane class more :-)
Thanks again for your help,