Skip to Content

Python libraries

Available Python libraries

A Python library is a collection of related modules. It contains packages of code that can be reused multiple times in different applications. This makes Python programming easier and more convenient for the programmer. Because we don’t need to write the same code again and again for different applications.

All available Python libraries can be found in the FASTSUITE installation folder: ..\E2InstallationPath\Lib\site-packages.

cenpylib

The cenpylib package (CENIT Python Library) was developed by CENIT AG for use with FASTSUITE Edition2 application and is a utility library designed to simplify standard function calls. Also, one of the main functions of cenpylib is to provide

IntelliSense

functionality. Please, see

IntelliSense settings

for needed setup steps.

[Example 1] # Import library from cenpylib import * # Usage: specify the operator's class def ModifyActiveProgram(operator: CENPyOlpProgramModifyOperator): # Result: IntelliSense will provide you with all available functions logging = operator.GetLoggerOperator() program = operator.GetActiveProgram() logging.LogInfo("Program name: "+str(program.GetName())) ... [Example 2] from cenpylib import * def ModifyActiveProgram(Operator: CENPyOlpProgramModifyOperator): logging = Operator.GetLoggerOperator() # Use file utility to access the paths of CENIT and E2 logos fileUtility = FileUtility() logging.LogInfo(f"CENIT logo black path: {fileUtility.CENIT_LOGO_BLACK}") logging.LogInfo(f"CENIT logo green path: {fileUtility.CENIT_LOGO_GREEN}") logging.LogInfo(f"FASTSUITE E2 icon path: {fileUtility.FASTSUITE_E2_ICON}") logging.LogInfo(f"FASTSUITE E2 logo path: {fileUtility.FASTSUITE_E2_LOGO}") [Example 3] from cenpylib import * def ModifyActiveProgram(Operator: CENPyOlpProgramModifyOperator): logging = Operator.GetLoggerOperator() # Use file utility to access the paths of CENIT and E2 logos # ======== create a PDF Report ============= pdf = ReportUtility() pdf.createAutoExecutePDFReport(Operator, "")

tkinter

The tkinter package (“Tk interface”) is the standard Python interface to the Tcl/Tk GUI toolkit. The detailed information can be found here:

Web Portal small
# Import library from tkinter import * from tkinter import ttk # Usage root = Tk() frm = ttk.Frame(root, padding=50) frm.grid() ttk.Label(frm, text="Hello World!").grid(column=0, row=0) ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=0) root.mainloop()

Some examples can be found in the FASTSUITE E2 installation folder:

  • ..\E2Plugin\Technologies\ArcWeldingTechnology\Standard\AuxiliaryCommands\OlpProgram\Connect touch and process points.py

Connect Touch And Process Points

  • ..\E2Plugin\Technologies\LaserCuttingTechnology\Standard\AuxiliaryCommands\OlpProgram\Import inspection data.py

Import Inspection Data

fpdf2

fpdf is a library for simple and fast PDF document generation in Python. It is a fork and the successor of PyFPDF. With the plugin manager comes the possibility to create dictionaries for different languages translation. The dictionary supports the definition of attribute and event names, created in Python. The detailed information can be found here:

Web Portal small

Dependencies of fpdf2 package:

  • Pillow  - is a Python Imaging Library adds image processing capabilities to your Python interpreter

  • d

efusedxml - contains several Python-only workarounds and fixes for denial of service and other vulnerabilities in Python’s XML libraries.

  • svg.path - is a collection of objects that implement the different path commands in SVG, and a parser for SVG path definitions.
# Import library from fpdf import FPDF # Usage pdf = FPDF() pdf.add_page() pdf.set_font('helvetica', size=12) pdf.cell(txt="hello world") pdf.output("hello_world.pdf")
Was this page helpful?