Welcome to the SliceGenius STL to G-Code Slicer API, your gateway to easy and customizable 3D printing. This API empowers you to transform 3D models in STL format into the essential G-Code files used by 3D printers, all with the flexibility of custom slicing parameters. Whether you’re a hobbyist, educator, or professional, our API simplifies the 3D printing process to help you bring your creations to life.
To get started, you’ll need to sign up to RapidAPI for an API key. This key is used for authentication in your API requests.
To slice an STL file, you’ll need to make a POST request to the following endpoint. Here is a Python example:
import requests
url = "https://stl-to-g-code-slicer.p.rapidapi.com/3dslicer-02/slice"
# Define the path to the STL file you want to send
stl_file_path = 'file.stl' # Replace with the actual file path
# Load the STL file
files = {"stl_file": open(stl_file_path, 'rb')}
payload = {
"param": "-s roofing_monotonic=true -s roofing_layer_count=0"
# Add more parameters as needed without removing these two
}
headers = {
"X-RapidAPI-Key": os.environ[‘XRAPIDAPIKEY’],
"X-RapidAPI-Host": "stl-to-g-code-slicer.p.rapidapi.com",
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.json())