Getting Started

Your first py2g sketch in 5 minutes

What You'll Learn

In this guide, you'll create your first 3D printing design using Python and FullControl. By the end, you'll have a working sketch that generates G-code for a simple geometric shape.

Step 1: Create a New Sketch

Start by creating a new sketch:

  1. Click the "Create New Sketch" button in the header
  2. You'll be taken to the editor interface
  3. The editor comes pre-loaded with a basic template

Step 2: Understanding the Template

The default template includes the basic structure for a FullControl design:

import fullcontrol as fc

# Design parameters
layer_height = 0.2
line_width = 0.4

# Create your design here
steps = []

# Example: Simple square
steps.extend(fc.rectangleXY(start_point=fc.Point(x=0, y=0, z=layer_height), 
                           x_size=20, y_size=20))

# Generate and return the design
steps.extend(fc.travel_to(fc.Point(x=0, y=0, z=layer_height*2)))
gcode = fc.transform(steps, 'gcode')

Step 3: Run Your Code

To see your design in action:

  1. Click the Run Code button
  2. Watch as your Python code executes in the browser
  3. The generated G-code will appear in the G-code panel
  4. A 3D visualization will show your toolpath

Step 4: Experiment and Modify

Try modifying the code to see how it affects the output:

  • Change the x_size and y_size parameters
  • Adjust the layer_height
  • Add multiple layers by repeating the rectangle at different Z heights

💡 Tip

The visualization updates automatically when you run the code. Use this to quickly iterate on your designs.

Step 5: Save and Share

Once you're happy with your design:

  1. Give your sketch a meaningful title
  2. Add a description explaining what it does
  3. Save your sketch (requires signing in)
  4. Optionally, make it public to share with the community

What's Next?

Congratulations! You've created your first py2g sketch. Here's what to explore next:

Common Issues

Code not running?

Make sure your code doesn't have syntax errors. The error will be displayed in the console panel if there are issues.

No visualization appearing?

Ensure your code generates valid G-code output. The visualization requires movement commands to display properly.