This has bugged me for a while. I'd really really like to create my own category of properties to associate with elements. Way easier for users to query than tags, and something that Navigator can display in clash results. I've been able to successfully read these properties that other applications (i.e. InRoads) are able to create on their own (lucky ducks), but no success adding my own. I'd like to mimic the custom approach shown below to adding metadata. Any guidance would be greatly appreciated!!!
It's possible IF you're will to use the MicroStation XML API. Not necessarily "quick and easy", but possible....
A "quick and easy" way is using key-ins. The steps are as below:
1. Save attached ECSchema file in the folder d:\ (I created this file for your with application Bentley Class Editor. This app is delivered in MicroStation SDK. I don't include all properties you want in this schema, just a demo).
2. Open your design file in MicroStation, keyin MDL LOAD Bentley.ECXAttributesAddin.dll to load ecxattribute application.
3. Keyin ECX Schema Import d:\TestSchema.01.00.ecschema.xml to import this external schema file into your active design file.
4. Select some elements you want assign properties to them. Keyin ECX Instance AttachWithStoredSchema TestSchema:Component to attach ECInstance to selected elements. Please see the captured pic which is just attached ECInstance to a shape element.
5. Use MVBA's PropertyHandler to assign values to these properties.
Answer Verified By: chrisedjohn
This is a known condition. The property handler needs the value to be initialized. I would look to the ECObjects api that we added for Select Series 3. It is managed code so you will need to write an AddIn to work with the objects.
mark anderson [Bentley]
Visit me at https://communities.bentley.com/communities/other_communities/bentley_innovation/default.aspx
Try adding a default value to your property in the class editor.To do this open the schema in the class editor and then in the properties tab select the custom attributes button.Add 'Calculated ECProperty Specification' custom property to the property and then edit the following values.EC Expression needs to have a value which can be a space.Is Calculated as default value only - set this to True.
All of the properties will have values now so you can edit with the propertyhandler.
Kriller, you rock! This is exactly the piece of the puzzle I was missing that got me the functionality I was looking for. Thank you SO much for taking the time to share with me.
To pay it forward, here's a link to where I've posted my example schema and the associated key-ins to make this work.
Christopher JohnsonTechnologist/Visualization Specialist
Sergio UK said:Can you let me know if there is a way to add a default value to an ECproperty which allows to be read/write, and therefore be modified directly in the ‘Element Information’ box?
It seems like a bug, because Is calculated as default value only is set True in Calculated ECProperty Specification, which by a documentation should ensure the propery is editable after the default value is calculated.
If no Calculated ECProperty Specification is used, the property can be edited without any problem ... but in such case I don't know how to set default value.
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
I made sure Is calculated as default value only is set True but when I attach the EC Schema to my elements, the properties are shown as read-only. Is it possible that this is a known issue/bug?
Sergio UK said:Is it possible that this is a known issue/bug?
Create service ticket or post your question to MicroStation forum as a new topic, so it will become more visible than this quite old discussion.
Dim oPH As PropertyHandler
Set oPH = CreatePropertyHandler(ActiveModelReference.GetElementByID(DLongFromLong(32358)))
because this discussion is more than 5 years old, I recommend to ask in a new post and to don't extend this old one.
You can you this forum and to ask in English or in Chinese forum.
Also, please follow best practices and to specify what product and version you use. To discuss EC data in V8i is very different from CONNECT Edition, where users' ItemTypes based on EC ara available.
Sorry I will pay more attention next time.