From 09fff446eb730b9f26dc9fa21408efd14d8d831e Mon Sep 17 00:00:00 2001 From: lf94 Date: Tue, 9 Jan 2024 16:09:33 -0500 Subject: [PATCH] Use the new inline file feature for code blocks --- content/tutorials/onboarding.mdx | 120 +++---------------------------- 1 file changed, 11 insertions(+), 109 deletions(-) diff --git a/content/tutorials/onboarding.mdx b/content/tutorials/onboarding.mdx index 0a4334f..72ef6d3 100644 --- a/content/tutorials/onboarding.mdx +++ b/content/tutorials/onboarding.mdx @@ -1,32 +1,23 @@ --- title: 'Advanced Onboarding' excerpt: In this tutorial we'll walk through getting started with the KITTYCAD API -langs: ['py'] -tags: [] --- In this tutorial we'll walk through getting started using the KITTYCAD API -### The Litterbox +### Getting started 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. -{/* __PRE-FETCH__: tutorials/getting_started/getting_started */} - - +```py data-file="public/litterbox_assets/tutorials/getting_started/getting_started.py" +``` Now try modifying the code and executing it again. As an example, delete the "#" to the left of `"print(, congrats! Your STL conversion was successful):"` and replace `` with your first name. -, congrats! Your STL conversion was successful):`, - }, - ]} -/> +```py + # Try adding your name by changing the text to + print(, congrats! Your STL conversion was successful):`, +``` Then execute. If you came to this tutorial from [Account Onboarding Progress](/account?tab=onboarding_progress) than you'll need to modify and execute the code in order for it to count as completing the second task. @@ -40,101 +31,12 @@ Create a new folder where you'd like to setup your test project. We will create our first file, `convert.py` and will have the following inside: - +```py data-file="public/litterbox_assets/tutorials/beginner_tutorial/convert.py" +``` Lastly we'll add a very basic `.obj` file called `cube.obj` and add the following contents: -```obj -# Blender 3.1.0 -# www.blender.org -o Cube -v 1.000000 1.000000 -1.000000 -v 1.000000 -1.000000 -1.000000 -v 1.000000 1.000000 1.000000 -v 1.000000 -1.000000 1.000000 -v -1.000000 1.000000 -1.000000 -v -1.000000 -1.000000 -1.000000 -v -1.000000 1.000000 1.000000 -v -1.000000 -1.000000 1.000000 -vn -0.0000 1.0000 -0.0000 -vn -0.0000 -0.0000 1.0000 -vn -1.0000 -0.0000 -0.0000 -vn -0.0000 -1.0000 -0.0000 -vn 1.0000 -0.0000 -0.0000 -vn -0.0000 -0.0000 -1.0000 -vt 0.625000 0.500000 -vt 0.375000 0.500000 -vt 0.625000 0.750000 -vt 0.375000 0.750000 -vt 0.875000 0.500000 -vt 0.625000 0.250000 -vt 0.125000 0.500000 -vt 0.375000 0.250000 -vt 0.875000 0.750000 -vt 0.625000 1.000000 -vt 0.625000 0.000000 -vt 0.375000 1.000000 -vt 0.375000 0.000000 -vt 0.125000 0.750000 -s 0 +```obj data-file="public/litterbox_assets/tutorials/beginner_tutorial/cube.obj" ``` Then open a PowerShell or Bash terminal depending on your operating-system and navigate to the folder you recently created and run the following (replacing `` with your API token): @@ -150,7 +52,7 @@ python3 convert.py You should see the following message printed in your terminal: -``` +```txt Saving output to ./output.stl ```