在自己的属性中获取当前对象 - Anylogic

问题描述

如何在自己的属性获取当前选中的对象?

在下面的示例中,我想将当前选择的 StopLine 发送到每次车辆通过时的函数

使用 this 函数只会返回父对象 - main。

我希望有一个简单的函数来返回对象而不必直接输入当前对象。

谢谢,

enter image description here

解决方法

您需要使用“自我”。对于此类问题,灯泡是您最好的朋友。参考以下文章:

https://www.benjamin-schumann.com/blog/2016/2/4/the-magic-lightbulb-and-how-it-can-help-your-anylogic-modelling