How to send a ruby script for execution to already open KLayout Editor Instance

edited December 2017 in Ruby Scripting
Hi everyone, I am pretty new here. My question is as follows:

I pretty much figured out how to execute ruby scripts by means of using the KLayout Editor exe in commandline mode.
As I would like to use the KLayout Editor for user-sporadic design-clipping from a larger design file, I was wondering, if there is some way to keep the KLayout-Editor open in the background and send some script execution requests to this already open instance of the KLayout-Editor (keeping the design-file loaded). Currently I am stuck with having to always re-open the KLayout Editor including the large design-file whenever the user in my little test application picks a locations from a list.

Has somebody dealt with such a problem before? I would greatly appreciate some feedback. Kind Regards!

Comments

  • edited November -1

    Hi,

    the solution you look for is generally known as interprocess communication. There are different approaches, but the most portable one which even works across networks are sockets. In this scheme, KLayout runs a script which listens to a TCP/IP port. By connecting to this port with a client application you can basically make this script execute code within the KLayout instance with the layout file loaded.

    A good starting point is the Snapshot Server Example: http://www.klayout.de/examples/qtrubyserver.html. In this example, the client is a web browser and the TCP/IP protocol is HTTP.

    Matthias

Sign In or Register to comment.