In this tutorial we'll walk through getting started using the KITTYCAD API
KittyCAD offers client libraries in Python and other languages, and our "Litterbox" below is our mini in-browser editor for demonstrating with code snippets. Try executing the python STL conversion code below. You should see the 3d-file re-appear on the right-hand side along with logs from the execution.
Now try modifying the code and executing it again. As an example, delete the "#" to the left of
"print(<your-name>, congrats! Your STL conversion was successful):" and replace
<your-name> with your first name.
Then execute. If you came to this tutorial from Account Onboarding Progress than you'll need to modify and execute the code in order for it to count as completing the second task.
You will need to have Python installed on your machine, this will depend on your operating-system, but instructions can be found on the Python website.
Create a new folder where you'd like to setup your test project, and add three text files.
The first will be called
requirements.txt and will have the following inside.
The second will be called
convert.py and will have the following inside
Lastly we'll add a very basic
.obj file called
cube.obj and add the following contents
Then open a PowerShell or Bash terminal depending on your operating-system and navigate to the folder you recently created and run the following:
You should see the following message printed in your terminal:
File conversion id: <your-conversion-id> File conversion status: Completed Saving output to ./output.stl
Note that the
python3 command might differ depending on what version you've got installed.