You are currently reviewing an older revision of this page.
imodel仅能识别符合EC Framework的EC属性。那么如何给一个DGN中的元素添加EC属性呢?下面以举例来实现:
【V8i实现方法】:
1. 下载并解压如下文档到D:\
<?xml version="1.0" encoding="utf-8"?> <ECSchema schemaName="TestSchema" nameSpacePrefix="Myself" version="1.0" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.2.0"> <ECSchemaReference name="Bentley_Standard_CustomAttributes" version="01.00" prefix="bsca" /> <ECSchemaReference name="EditorCustomAttributes" version="01.00" prefix="beca" /> <ECCustomAttributes> <SchemaChangeTrackingState xmlns="Bentley_Standard_CustomAttributes.01.00"> <FinalizationHistory /> <TrackingEnabled>True</TrackingEnabled> <SchemaFullNameAtEditingStart>TestSchema.01.00</SchemaFullNameAtEditingStart> </SchemaChangeTrackingState> </ECCustomAttributes> <ECClass typeName="Component" isStruct="True" isDomainClass="True"> <ECCustomAttributes> <PreviousNameArray xmlns="Bentley_Standard_CustomAttributes.01.00"> <PreviousNames> <PreviousName> <OldName /> <SchemaFullNameKey>TestSchema.01.00</SchemaFullNameKey> <IsNewInThisVersion>True</IsNewInThisVersion> </PreviousName> </PreviousNames> <PreviousNameAlreadySaved>True</PreviousNameAlreadySaved> </PreviousNameArray> </ECCustomAttributes> <ECProperty propertyName="Name" typeName="string"> <ECCustomAttributes> <PreviousNameArray xmlns="Bentley_Standard_CustomAttributes.01.00"> <PreviousNames> <PreviousName> <OldName /> <SchemaFullNameKey>TestSchema.01.00</SchemaFullNameKey> <IsNewInThisVersion>True</IsNewInThisVersion> </PreviousName> </PreviousNames> <PreviousNameAlreadySaved>True</PreviousNameAlreadySaved> </PreviousNameArray> <PropertyPriority xmlns="EditorCustomAttributes.01.00"> <Priority>100</Priority> </PropertyPriority> </ECCustomAttributes> </ECProperty> <ECProperty propertyName="Style" typeName="string"> <ECCustomAttributes> <PreviousNameArray xmlns="Bentley_Standard_CustomAttributes.01.00"> <PreviousNames> <PreviousName> <OldName /> <SchemaFullNameKey>TestSchema.01.00</SchemaFullNameKey> <IsNewInThisVersion>True</IsNewInThisVersion> </PreviousName> </PreviousNames> <PreviousNameAlreadySaved>True</PreviousNameAlreadySaved> </PreviousNameArray> <PropertyPriority xmlns="EditorCustomAttributes.01.00"> <Priority>90</Priority> </PropertyPriority> </ECCustomAttributes> </ECProperty> <ECProperty propertyName="Description" typeName="string"> <ECCustomAttributes> <PreviousNameArray xmlns="Bentley_Standard_CustomAttributes.01.00"> <PreviousNames> <PreviousName> <OldName /> <SchemaFullNameKey>TestSchema.01.00</SchemaFullNameKey> <IsNewInThisVersion>True</IsNewInThisVersion> </PreviousName> </PreviousNames> <PreviousNameAlreadySaved>True</PreviousNameAlreadySaved> </PreviousNameArray> <PropertyPriority xmlns="EditorCustomAttributes.01.00"> <Priority>80</Priority> </PropertyPriority> </ECCustomAttributes> </ECProperty> <ECProperty propertyName="Corridor" typeName="string"> <ECCustomAttributes> <PreviousNameArray xmlns="Bentley_Standard_CustomAttributes.01.00"> <PreviousNames> <PreviousName> <OldName /> <SchemaFullNameKey>TestSchema.01.00</SchemaFullNameKey> <IsNewInThisVersion>True</IsNewInThisVersion> </PreviousName> </PreviousNames> <PreviousNameAlreadySaved>True</PreviousNameAlreadySaved> </PreviousNameArray> <PropertyPriority xmlns="EditorCustomAttributes.01.00"> <Priority>70</Priority> </PropertyPriority> </ECCustomAttributes> </ECProperty> </ECClass> </ECSchema>
2. 启动MicroStation V8iSS3或SS4(太早期的版本还不支持i-model功能);
3. 选中其中任一图形元素,然后依次执行如下键入命令:
MDL LOAD Bentley.ECXAttributesAddin.dll ECX Schema Import D:\TestSchema.01.00.ecschema.xml ECX Instance AttachWithStoredSchema TestSchema:Component
4. 用Element Information工具查看这个元素,请将会具有一组新的属性展示出来。
【CE实现方法】:
在MicroStation CONNECT Edition中新增了Item Type功能,它能非常简单地让我们定义这个ECSchema文件并方便地添加Item给图形元素。
具体操作步骤可参考帮助文档。大致是:①通过Drawing工作流下的Contents下的Item Type定义Item Type库(相当于ECSchema和ECClass)
②用Add Item工具给图形元素附加Item。