Skip to Content

Vorbereitung

Dieses Kapitel beschreibt, wie Sie Ihren eigenen Downloader erstellen. Diese Grundlage ist sehr nützlich, bevor Sie zu herstellerspezifischen und technologiebezogenen Implementierungen übergehen.

Voraussetzung

Es versteht sich von selbst, dass ein grundlegendes Verständnis des Skriptens in Python unerlässlich ist, um eigene Translatoren zu erstellen. In dieser Dokumentation finden Sie ein Kapitel, das in das Python-Scripting in FASTSUITE Edition 2 einführt.


Page

Einführung in das Python-Scripting

Darüber hinaus wird empfohlen, über Erfahrung und Kenntnisse im Umgang mit FASTSUITE Edition 2 zu verfügen, insbesondere mit der OLP-Umgebung und der spezifischen Technologie, für die der Übersetzer erstellt werden soll. In dieser Dokumentation finden Sie mehrere Tutorials, die Sie durch die Benutzeroberfläche und die Funktionalität führen.

Einrichtung

Die folgenden Schritte müssen durchgeführt werden, bevor Sie mit der Erstellung Ihres ersten eigenen Downloaders beginnen können.

1. Einrichtung FASTSUITE Edition 2

Download and install FASTSUITE Edition 2, and get familiar with the application when necessary. Check the documentation for the latest information and tutorials. Then download the translator example, unpack it on your disk, start Edition 2, and configure the example plugin.

Optionally, for development purposes, it is recommended to change the logging level to Info.


FASTSUITE Edition 2 download

FASTSUITE Edition 2 herunterladen


FASTSUITE Edition plugin example

FASTSUITE Edition Plugin-Beispiel


Add a plugin

Plugin hinzufügen

2. Beispielarbeitszelle

Open a sample workcell. Such a sample can be taken from one of the tutorials, or loaded from the standard component and layout library.

After creating a sample workcell, choose the translator. Go to the Controller builder workbench and open the Controller properties dashboard. If you did set up the system correctly, the translator HelloWorld.py should appear in the list.

An output directory must be specified so that the compiler knows where to write the files. The output directory can be defined in the same dashboard as being opened in the previous step. Alternatively it can also be defined in the Workcell configuration dashboard of the Layout builder workbench or the Programs dashboard of the OLP workbench.

If the download fails, please check the Program directory in the Programs dashboard. When a path is written there, it has to be the same as the path in the Output directory.

Speichern Sie die Arbeitszelle nach der Angabe des Translators und des Ausgabeverzeichnisses.


FASTSUITE training course data

FASTSUITE Trainingskursdaten


FASTSUITE standard resource library

FASTSUITE Standard-Ressourcenbibliothek

3. Visual Studio Code für das Debugging konfigurieren

Download and install Microsoft Visual Studio Code, then run it and verify that the Python extension has been installed.

Install the following recommended extensions:

  • Python (Pylance included) — a must-have extension that includes features such as IntelliSense (Pylance), linting, debugging, code navigation, code formatting, refactoring, variable explorer, test explorer, and more.
  • Code Spell Checker — a must-have basic spell checker.
  • autoDocstring - Python Docstring Generator — to quickly generate docstrings for Python functions and classes.
  • Indent-Rainbow — a simple extension to make indentation more readable.
  • Python Indent — corrects the Python indentation.

Open the folder Custom_E2_Plugin from the location where the plugin has been stored.

FASTSUITE Edition 2 comes with an embedded Python version. To get access to the debug information and the Python libraries coming with the installation, it is necessary to set in VS Code the python.exe from the Edition 2 installation path. Click on the Python interpreter at the bottom right corner, next to the language selection mode.

Enter the path manually or browse to the FASTSUITE Edition 2 installation path and select the python.exe.


Microsoft Visual Studio Code download

Microsoft Visual Studio Code Download


VS Marketplace

VS Marketplace

4. Konfigurieren Sie FASTSUITE Edition 2 für das Debugging

Bitte schließen Sie alle geöffneten FASTSUITE E2-Instanzen, bevor Sie die folgenden Schritte ausführen.

To enable the Python debugging, go to the FASTSUITE E2 installation folder and open the cenpyinit.py file in a text editor. At line 9, change the variable enablePythonDebug = False to True. Do not forget to save the change!

Starten Sie FASTSUITE Edition 2 und warten Sie, bis der Debugger bereit ist, sich anzuhängen.

Go to VS Code and press F5 or execute the attaching manually by clicking on the Start Debugging button.

When everything worked well, the status bar at the bottom of the VS Code window turns to green.

Laden Sie Ihr Szenario und drücken Sie die Schaltfläche Download im OLP-Arbeitsbereich. Sie sollten nun in der Lage sein, Ihren Translator-Code zu debuggen.

Was this page helpful?