首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在DOORS DXL中显示来自所有模块(打开或关闭)的链接?

如何在DOORS DXL中显示来自所有模块(打开或关闭)的链接?
EN

Stack Overflow用户
提问于 2015-05-11 18:03:44
回答 2查看 5.5K关注 0票数 0

我正在编写一个DXL脚本,它通过多个级别跟踪链接。我注意到,当模块打开时,脚本会正确地遍历这些链接。但是,大约有20个模块需要迭代,我不想打开所有这些模块。如何查看这些链接而不必手动打开链接模块?

下面是我的代码示例:

代码语言:javascript
运行
复制
// Checks to see if the object exists or not.  If not returns a null.  
//  This will be eventually adapted to make sure the object is from a 
//  specific set of modules, but for now we're just checking for ability
//  to retrieve
Object getObject(Link obj_link) {
    ModuleVersion other_ver = null
    ModName_ other_mod = null
    Object other_obj

    other_ver = sourceVersion obj_link
    other_mod = module(other_ver)
    if (null other_mod || isDeleted other_mod) return null

    other_obj = source obj_link
    if (null other_obj) load(other_ver, true)
    other_obj = source obj_link
    if (isDeleted other_obj) return null

    return other_obj
}

// Displays the object from a specific link module if it's found
void showOut(Object o) {
    Link l_obj_link
    string s = null

    Item linkModItem = itemFromID(MODULE_ID)
    string linkModName = fullName(linkModItem)

    for l_obj_link in all(o <- linkModName) do {

        Object test_obj
        display("Test")
        test_obj = getObject(l_obj_link)
        if (null test_obj){
            display("Null Object Found")
        } else {
            s = probeRichAttr_(test_obj, "Object Identifier", false)
            displayRich(s)
        }
    }
}

// Call showOut for the object
showOut(obj)

同样,使用它作为布局DXL脚本,我可以看到对象ID当且仅当链接模块被打开。

EN

Stack Overflow用户

回答已采纳

发布于 2015-05-12 13:39:00

首先,我建议使用Analysis -> Wizard,并确保选择用于All Modules而不是All Open Modules的选项来为您生成所有代码,然后修改该代码以显示您想要的内容,如果它没有给出您所需要的内容。

但是,如果您只想更新现有代码,则需要更改getObject函数,使其包括静默地打开每个模块(要获得模块必须打开的信息,但不需要显示该模块)。

代码语言:javascript
运行
复制
Object getObject(Link obj_link) {
  ModuleVersion other_ver = null
  ModName_ other_mod = null
  Object other_obj

  other_ver = sourceVersion obj_link
  other_mod = module(other_ver)
  Module m = read(fullName(other_ver), false)  // false, tells it to open silently.
  if (null other_mod || isDeleted other_mod) return null

  other_obj = source obj_link
  if (null other_obj) load(other_ver, true)
  other_obj = source obj_link
  if (isDeleted other_obj) return null

  return other_obj
}

这也应该是可行的,但我仍然建议从分析向导开始,因为它会更干净。

票数 2
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30174589

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档