首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Doors DXL过滤器,

Doors DXL过滤器,
EN

Stack Overflow用户
提问于 2017-10-07 17:20:44
回答 2查看 3.7K关注 0票数 0

我有以下dxl代码片段,我想复制对象ID与过滤器F3是打开的。:我不知道我做错了什么,它给了我所有对象的ID。

代码语言:javascript
复制
string Id
int x=0;
int y=0;
Id = o."SourceID"

Filter f0 = hasNoLinks(linkFilterIncoming, "*")
Filter f1=attribute "_TraceTo" == "System"
Filter f2 = attribute "Object Type" == "requirement" 
Filter f3 = f1&&f2&&f0
addFilter(m,f3,x,y)
print x ":\t" fullName(module(m)) "\n" 
wOutKLHUntraced << Id "\t" fullName(module(m)) "\n"
EN

回答 2

Stack Overflow用户

发布于 2017-10-07 20:34:14

首先,您需要在添加筛选器之后添加语句filtering on,以便应用筛选器。则过滤的对象将是唯一可见的对象。

然后,您在脚本中过早地设置了"Id“。在第4行,"o“被设置为某个对象,我不知道是哪一个,但肯定不是过滤器的结果。相反,应在语句filtering on之后添加语句

代码语言:javascript
复制
Object o = first m // the first object that is now visible
Id = o."SourceID"
票数 1
EN

Stack Overflow用户

发布于 2017-10-13 17:27:52

我的脚本运行良好,但给出了不同的结果:当我在for循环中为大约30个模块运行这个脚本时:我是不是设置了错误的过滤器?

代码语言:javascript
复制
Stream TbdUntraced;
     string s
      string d
      Object o
      string trac
      int numReqs = 0;


      string IdNum
      string untraced


      int x=0;
      int y=0;
      int a =0;


       for o in m do
      {
        ensureInLinkedModulesLoaded(o,S_SATISFIES );
        s = o."Object Type"


        string Id
        string Topic
        Topic = o."_Topic"

          numReqs++;




                Filter f0 = hasNoLinks(linkFilterIncoming, "*")
                Filter f1 = contains(attribute "_TraceTo", "TBD", false)            
                Filter f2 = attribute "Object Type" == "requirement" 
                Filter f3 = attribute "MMS5-Autoliv_Supplier_Status" == "agreed"
                Filter f4 = attribute "MMS5-Autoliv_Supplier_Status" == "partly agreed"
                Filter f7 = f0&&f2&&(f3||f4)&&f1
                addFilter(m,f7,x,y)
                filtering on
                d = o."MMS5-Autoliv_OEM_Status"
                Id = o."SourceID"
                Topic = o."_Topic"              
                print x ":\t" name(module(m)) "\n" 
                TbdUntraced << Id "\t" Topic "\t"name(module(m)) "\n"

      }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46618620

复制
相关文章

相似问题

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