Search code examples
anylogic

How to run Java at design time


Sometimes it costs a lot of time on drawing space markups if the network is complex.

I wonder if there is a way to run Java at design time like Marcos in other software. For example, adding a path manually, and create multiple nodes on the path programmatically, then adjust some of the nodes manually if needed.

I don't find sort of terminal or console to write Java at design mode. Instead, I found agent has Additional class code with Library developer mode enabled. From the document it says typically developers use this code to override things of agents. I thought it can be used to run my Java code on instantized or override functions generated by AnyLogicInternalCodegenAPI. But it seems only allow me to add properties or functions to class that can only used in runtime.


Solution

  • You cannot write code that draws your network for you at design time.

    Either you draw it manually at design time or you write code that draws it for you at the start of the runtime (see https://www.theanylogicmodeler.com/post/dynamically-adding-model-presentations-to-make-navigation-during-editing-faster-in-anylogic ).

    You can also mix'n'match: draw some and expand on it with coded shapes.

    However, you can not write code that displays your network at design time, no