插入EC属性后,怎么才能不显示ecclass名称,下面是我的代码
var ecSchema = new ECSchema("TestSchema", 1, 1, "zfgk"); var ecClass = new ECClass("TestClass"); var specification = new InstanceLabelSpecification("false").CreatePopulatedCustomAttributeInstance(); ecClass.SetCustomAttribute(specification); ecClass.Add(new ECProperty("TestProperty", ECObjects.StringType)); ecSchema.AddClass(ecClass); var status = DgnECManager.Manager.ImportSchema(ecSchema, ActiveDgnFile, new ImportSchemaOptions()); if (status == SchemaImportStatus.Success) { ECXAttributes.AppendInstance(element, ecClass.CreateInstance()); dgnElementSetTool.DoExitTool(); }
设置ECClass的DisplayLabel为一个空格:
在你的ECSchema定义中,在ECClass下增加如下的InstanceLabelSpecification定义后即可。
<ECCustomAttributes>
<InstanceLabelSpecification xmlns="Bentley_Standard_CustomAttributes.01.02" />
</ECCustomAttributes>
这样属性框里面的显示不就不正确了吗?
这个自定义属性怎么使用代码添加?
InstanceLabelSpecification也是个ECClass,创建一个实例调用SetCustomAttribute添加。