Input and output

Splipy supports reading from and writing to a number of different file formats. This is handled through a number of classes in the splipy.io module, each of which have identical interfaces (although not all formats support all functions).

The file objects are intended to be used as context managers, i.e.

with G2('some_file.g2') as f:
    f.write(...)
    objs = f.read()

The available formats are:

  • splipy.io.G2: G2-format (as used by GoTools)
  • splipy.io.SVG: Scalable Vector Graphics
  • splipy.io.STL: Stereolitography format

Common interface

class splipy.io.master.MasterIO(filename)[source]
__init__(filename)[source]

Create an IO object attached to a file.

Parameters:filename (str) – The file to read from or write to
read()[source]

Reads all the objects from the file.

Returns:Objects
Return type:[splipy.SplineObject]
write(obj)[source]

Write one or more objects to the file.

Parameters:obj ([splipy.SplineObject] or splipy.SplineObject) – The object(s) to write