根据CIMSDK官方帮助文档,3.4.1.4条,可以通过配置EC属性下的ECCustomAttributes子节点,另其ExtendedType子节点包含<Standard>27</Standard>子节点来设置EC属性的显示样式时一个可以通过下拉列表获取字体的功能,官方帮助文档示例如下。
<ECProperty propertyName="Origin" typeName="point3d"> <ECCustomAttributes> <ExtendType xmlns="EditorCustomAttributes.01.00"> <Standard>7</Standard> </ExtendType> </ECCustomAttributes> </ECProperty>
但我根据文档的要求对我的EC属性进行了如下设置
<ECProperty propertyName="TextFont" typeName="int" displayLabel="字体"> <ECCustomAttributes> <PropertyPriority xmlns="EditorCustomAttributes.01.00"> <Priority>15700</Priority> </PropertyPriority> <ExtendedType xmlns="EditorCustomAttributes.01.00"> <Standard>27</Standard> </ExtendedType> </ECCustomAttributes> </ECProperty>
可是实际在软件中运行以后,“字体”属性并未出现希望的下拉列表,而是一个什么也没有的输入框,如下图所示。
请问我是哪里设置的有问题?
这个您先在MS上添加类似的代码,看看是否有效果。
试过了,一样没有下拉框,还是基本的输入框,是不是我哪里配置错了?
试试我这个Schema文件
<?xml version="1.0" encoding="utf-8"?> <ECSchema schemaName="MyECSchema" nameSpacePrefix="MyNSPre" version="1.0" description="MyDesc" displayLabel="MyDisLab" xmlns="http://www.bentley.com/schemas/Bentley.ECXML.2.0"> <ECSchemaReference name="EditorCustomAttributes" version="01.03" prefix="beca" /> <ECClass typeName="MyClass" description="MyDesc" displayLabel="MyClassDisLab" isDomainClass="True"> <ECProperty propertyName="PropStr" typeName="string" /> <ECProperty propertyName="PropDou" typeName="double" /> <ECProperty propertyName="PropPt" typeName="point3d" /> <ECProperty propertyName="Font_Name" typeName="int"> <ECCustomAttributes> <ExtendType xmlns="EditorCustomAttributes.01.03"> <Standard>27</Standard> </ExtendType> </ECCustomAttributes> </ECProperty> </ECClass> </ECSchema>
Answer Verified By: 霄男 宿
谢谢您~可以了。我犯了一个愚蠢的错误,是ExtendType而不是ExtendedType,我从一个错误的SCHEMA中拷贝的这句话,实在抱歉。感谢您的耐心解答。
郭老师,我又遇到新的问题,就是我可以用DgnFontManager.GetFontByNumber()方法通过属性中的id获取到字体,但是我如何通过dgnFont反向求得id呢?我没有找到可以用的方法,我只找到了DgnFontNumberMap下面有一个GetFontNumber()方法,但是无法创建DgnFontNumberMap的实例。请问有什么办法吗?
Session.Instance.GetActiveDgnFile().GetDgnFontMap()
非常感谢!