Python 属性错误:';org.modelio.metamodel.impl.uml.behavior.activityMo';对象没有属性';getOwnedNode';
我正在使用脚本查找Python 属性错误:';org.modelio.metamodel.impl.uml.behavior.activityMo';对象没有属性';getOwnedNode';,python,jython,modelio,Python,Jython,Modelio,我正在使用脚本查找活动图中的所有路径。为此,我使用modelio4.0 我把下面的脚本放在宏中 脚本 ## return first initial node in the selected activity def getInitialPoint(act): for node in act.getOwnedNode(): if isinstance(node, InitialNode): return node ## parcours acti
活动图中的所有路径。为此,我使用modelio4.0
我把下面的脚本放在宏中
脚本
## return first initial node in the selected activity
def getInitialPoint(act):
for node in act.getOwnedNode():
if isinstance(node, InitialNode):
return node
## parcours activity nodes
def getPaths(currentPath, currentNode):
for outgoing in currentNode.getOutgoing():
node = outgoing.getTarget()
if isinstance(node, ActivityFinalNode):
paths.append(currentPath)
return;
elif isinstance(node, DecisionMergeNode):
getPaths(currentPath, node)
else:
getPaths(currentPath + " - " + node.getName(), node)
##Init
init = getInitialPoint(elt)
currentPath = init.getName()
global paths
paths = []
getPaths(currentPath, init)
##Print founded paths
for p in paths:
print p
错误
但当我启动宏时,我面临以下错误:
AttributeError: 'org.modelio.metamodel.impl.diagrams.ActivityDiagra' object has no attribute 'getOwnedNode' in <script> at line number 20
Traceback (most recent call last):
File "<script>", line 20, in <module>
File "<script>", line 3, in getInitialPoint
AttributeError: 'org.modelio.metamodel.impl.diagrams.ActivityDiagra' object has no attribute 'getOwnedNode'
AttributeError:'org.modelio.metamodel.impl.diagrams.ActivityDiagra'对象在第20行没有属性'getOwnedNode'
回溯(最近一次呼叫最后一次):
文件“”,第20行,在
getInitialPoint中第3行的文件“”
AttributeError:'org.modelio.metamodel.impl.diagrams.ActivityDiagra'对象没有属性'getOwnedNode'
你能帮我修一下吗?谢谢。事实上,elt是被选中的元素。
如果从活动元素而不是活动图启动该脚本,则该脚本可以工作
最好的,什么是英语教学?定义在哪里?它是modelio提供的值。此消息显示在控制台中:以下变量已绑定:-会话:打开的会话(IModelingSession)-elt:第一个选定的模型元素或null(元素)-元素:选定的模型元素(集合)-选择:SWT选择(ISelection)使用'session.getModel().getModelRoots()'以获取每个工作片段的根。