The IronPython was integreted in the PetriPrinter program which allows you to make a model by using the python script language. To write your own script file create a simple plain text file in the Documents\PetriPrinter folder with .py extension and follow basic structure instructions below.

You can use the gCodeAPI.NET documentation to find the necessary funtions for your project.

Structure of Python script

To make sure that the PetriPrinter program can successfully read your python script, it has to contain four parts.

  • Imports: Insert the follow line to the top of your script files.

    • import sys
    • import clr
    • clr.AddReferenceToFileAndPath ('gCodeAPI.dll')
    • from GCodeAPI import *
  • Name function: Create a "Name" function which returns name of your model.
  • Description function: Create a "Description" function which returns description of your model.
  • Code function: Create a "Code" function which returns a special collection, named GCodeCollector. You can add any commands to this collection which implement the IGCode interface.

During the model desinging keep in mind that the origin of XYZ coordinate system is the bottom center of your dish. The PetriPrinter will reposition your model into you the currect dish position.

Simple circle

1. Create a plain text file with with .py extension.

2. Insert the basic file structure and fill Name and Description functions.

3. Define the important parameters.

4. Set the exctruding rate. This is a static constant which helps you calculate the necessary amount of extruded material. It depends on your printer and requested wall thickness. In our setup (Ultimaker Original with 0.4 mm nozzle) this constant value is 0.0405. You may have to try various values before you find the perfect settings.

5. First, you have to define the place of printer nozzle landing. It is practical to select an outside place to prevent the damage of cell culture area. Define a new GLine object 10 millimeters left from the center of dish.

6. Set printer nozzle to the bottom of petri dish.

7. The circle path is defined by using a line (diameter). The start point of the line is the current position of printer head. Send the printer nozzle to the edge of circle.

8. The second point is defined by angle with horizontal axis and length of line (2x radius). Set the angle (in degree) and radius into the getCircleByRadius() function.

9. Embed the circle maker line into a for loop and add a Z distance incrementing line.

10. See the hole singleRing.py file below: