getProperties 的性能问题

performance issue with getProperties

我是新手所以我希望我做对了。

我对编写 DXL 并不陌生,但目前在从 Layout dxl 列调用 getProperties 时遇到性能问题,该列应该根据链接模块的 Enum 类型的模块属性值显示传出链接。 该代码基本上可以工作,但需要很长时间才能完成。注释掉 getProperties 调用使其尽可能快。 是的,调用完全按照 DXL Ref 手册中所示编写。

直接调用属性,使用模块对象和点运算符也不起作用,因为它总是 returns 枚举默认值而不是实际值。

欢迎提出任何想法...

EDIT 在下面添加了示例代码

// couple of declarations snipped
string cond = "Enum selection here" // this is modified from actual code, to show the idea
string linkModName = "*"
ModuleProperties mp
for l in all(o->linkModName) do 
{
    otherVersion = targetVersion l
    otherMod = module(otherVersion)
    if (null otherMod || isDeleted otherMod) continue
    othero = target l
    if (null othero) 
    {
        load(otherVersion,false)
    }
    getProperties(otherVersion,  mp)
    sTemp = mp.myAttr
    if (sTemp == cond) continue 

// further code snipped
}

我不是 100% 确定,但我认为 is/was 在某些 DOORS 版本中模块属性存在性能问题。

您可能想尝试以下方法,即直接从加载的模块中获取属性

[...]
othero = target l
Module m
if (null othero) 
{
    m = load(otherVersion,false)
} else {
    m = module othero
}
sTemp = m.myAttr
[...]

注意,我没有测试这个片段。