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!!!
-Christopher Johnson
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.
Answer Verified By: chrisedjohn
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.
http://chrisjohnson.ucoz.com/VBA/MicroStation/GeopakXsSchema.01.00.ecschema.xml
http://chrisjohnson.ucoz.com/VBA/MicroStation/GeopakXsSchemaKeyins.txt
Christopher JohnsonTechnologist/Visualization Specialist
http://www.christopheredwinjohnson.com/
Hi Sergio,
Unknown 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.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Thanks Jan,
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?
Regards,
Sergio
Unknown 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.
bump... I think that we would use Item Types now?
Hi,
I am not quite sure whether it makes sense to continue with 4 years old discussion and not to start a new one.
Anyway, the answer is "yes, use Item Types" ... in fact it's not different information than what was discussed 4 years ago: Item Types in CONNECT Edition are nothing else than EC data. The only difference (and important one ;-) comparing to V8i is that in V8i the only way how to add own property to elements was to use Bentley Class Editor and follow workflow described by Yongan.Fu (so not user friendly option). Item Types in CE are based on predefined EC schema, so Bentley Class Editor is not necessary (simple for users) and the result is standard EC schema and EC data ... of course limited when compared what can be created using Class Editor and/or API).
What maybe confusing is that when another EC schema is used in CE, it's also displayed as Item Types in MicroStation GUI, so there are two different meanings of Item Types: It's a user tool designed to be replacement for old tags, but in GUI Item Types are all EC data attached to an element regardless the schema was created by a user, externally in Class Editor or by an application.
dominic SEAH said:I think that we would use Item Types now?
Yes. For example, AreaAnnotator CONNECT Edition eschews tags in favour of Item Types.
As Jan suggests, it would be best to start a new conversation in the MicroStation Forum (unless you plan to start programming).
Regards, Jon Summers LA Solutions
符老师,按照您的步骤我已经成功自定义属性,但是最后一步用PropertyHandler为属性赋值遇到了“不可用”错误!我调试后发现SetValue方法要求填入的参数为“NewValue”,但是您给的xml文件并没有为属性赋值,在我手动为属性赋值后再次运行以下代码就不会报错“不可用”。测试代码如下
Sub test()
Dim oPH As PropertyHandler
Set oPH = CreatePropertyHandler(ActiveModelReference.GetElementByID(DLongFromLong(32358)))
oPH.SelectByAccessString "mingCheng"
oPH.SetValue "12"
End Sub
学生想请教一下xml文件是否有直接为新属性赋初始值的办法?或者还有PropertyHandler以外的其它方法为属性赋值且无需要求属性有初始值