我有以下dxl代码片段,我想复制对象ID与过滤器F3是打开的。:我不知道我做错了什么,它给了我所有对象的ID。
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"发布于 2017-10-07 20:34:14
首先,您需要在添加筛选器之后添加语句filtering on,以便应用筛选器。则过滤的对象将是唯一可见的对象。
然后,您在脚本中过早地设置了"Id“。在第4行,"o“被设置为某个对象,我不知道是哪一个,但肯定不是过滤器的结果。相反,应在语句filtering on之后添加语句
Object o = first m // the first object that is now visible
Id = o."SourceID"发布于 2017-10-13 17:27:52
我的脚本运行良好,但给出了不同的结果:当我在for循环中为大约30个模块运行这个脚本时:我是不是设置了错误的过滤器?
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"
}https://stackoverflow.com/questions/46618620
复制相似问题