Document: | MDUROSETTACNCCNCAPICLIENTCORE | ||
---|---|---|---|
Description: | RosettaCNC CNC API Client Core plugin for Python | ||
Link: | http://wiki.rosettacnc.com/en/software/rosettacncapiclientcore | ||
Release documento | Descrizione | Note | Data |
01 | First release | / | 20/04/2021 |
The RosettaCNC Control Software has an API Server inside which makes it possible, for an external user program, to perform many actions:
With the API Server features, anyone will be able to create a “custom” Control Software User Interface for the CNC.
The external user program will only have to implement an API Client to be able to access all the functions which will then be described in detail.
In this document, we will describe how to use the cnc-api-client-core Python plugin library to obtain that.
The implementation of the API Client for Python is implemented in the cnc-api-client-core package and made available on the PyPi site.
Packages are currently available for Python 3.9/3.10/3.11 in Win64 architecture.
To install and check the package open a CMD console and follow the below instructions:
> pip install cnc-api-client-core Collecting cnc-api-client-core Using cached cnc_api_client_core-1.0.1-cp39-cp39-win_amd64.whl (104 kB) Installing collected packages: cnc-api-client-core Successfully installed cnc-api-client-core-1.0.1 > python Python 3.9.12 (tags/v3.9.12:b28265d, Mar 23 2022, 23:52:46) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import cnc_api_client_core as cnc >>> dir(cnc) ['ANALYSIS_MT', 'ANALYSIS_RF', 'ANALYSIS_RT', 'ANALYSIS_RV', 'ANALYSIS_RZ', 'APIAnalogInputs', 'APIAnalogOutputs'...]
connect(host: str, port: int) -> bool:
Opens the connection with the specified API server host/port.
Argument Name | Description |
---|---|
host | The server host address to connect to (eg.'192.168.0.220'). |
port | The server host port to connect to (valid range 0..65535). |
return | True if the connection with the API server has been established. |
close()-> bool:
Closes the current connection with the API server.