Skip to Content

Préparation

Ce chapitre décrit comment créer votre propre téléchargeur. Cette base est très utile avant de passer aux implémentations spécifiques au fabricant et à la technologie.

Condition préalable

Il va sans dire qu’une compréhension de base du scripting en Python est essentielle pour construire ses propres traducteurs. Dans cette documentation, vous trouverez un chapitre introduisant le script Python dans FASTSUITE Édition 2.


Page

Introduction au scripting Python

De plus, il est recommandé d’avoir une certaine expérience et des connaissances sur le travail avec FASTSUITE Édition 2, en particulier avec l’environnement OLP et la technologie spécifique pour laquelle le traducteur doit être généré. Dans cette documentation, vous trouverez plusieurs tutoriels pour vous guider à travers l’interface utilisateur et les fonctionnalités.

Mise en place

Les étapes suivantes doivent être suivies avant de pouvoir commencer à créer votre propre téléchargeur.

1. Installation FASTSUITE Édition 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 Téléchargement de l’édition 2


FASTSUITE Edition plugin example

FASTSUITE Exemple de plugin d’édition


Add a plugin

Ajouter un plugin

2. Cellule de travail d’exemple

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.

Sauvegardez la cellule de travail après avoir spécifié le traducteur et le répertoire de sortie.


FASTSUITE training course data

FASTSUITE données de formation


FASTSUITE standard resource library

FASTSUITE bibliothèque de ressources standard

3. Configurer le code Visual Studio pour le débogage

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

Téléchargement de Microsoft Visual Studio Code


VS Marketplace

VS Marketplace

4. Configurer FASTSUITE Édition 2 pour le débogage

Veuillez fermer toutes les instances E2 ouvertes FASTSUITE avant d’effectuer les étapes suivantes.

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!

Démarrez FASTSUITE Édition 2 et attendez que le débogueur soit prêt à être attaché.

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.

Chargez votre scénario et appuyez sur le bouton Télécharger dans l’établi OLP. Vous devriez maintenant pouvoir déboguer le code de votre traducteur.

Was this page helpful?