# IO

> Python API functions

### configureFunctionLogger

```python
io.configureFunctionLogger(functionName, enableFunction, enableParameters, enableExecutionTime)
```

Parameters

| Type                            | Name                | Description |
| ------------------------------- | ------------------- | ----------- |
| [String](./core_types#string)   | functionName        |             |
| [Boolean](./core_types#boolean) | enableFunction      |             |
| [Boolean](./core_types#boolean) | enableParameters    |             |
| [Boolean](./core_types#boolean) | enableExecutionTime |             |

## Asset paths

### addAssetPaths

Add directory paths to search assets in.

```python
io.addAssetPaths(path)
```

Parameters

| Type                                  | Name | Description       |
| ------------------------------------- | ---- | ----------------- |
| [StringList](./core_types#stringlist) | path | The paths to add. |

See also:

* [io.clearAssetPaths](./io_functions#clearassetpaths)
* [io.findInDirectories](./io_functions#findindirectories)
* [io.getAssetPaths](./io_functions#getassetpaths)
* [io.setAssetPaths](./io_functions#setassetpaths)

### clearAssetPaths

Clear all asset paths.

```python
io.clearAssetPaths()
```

See also:

* [io.addAssetPaths](./io_functions#addassetpaths)
* [io.findInDirectories](./io_functions#findindirectories)
* [io.getAssetPaths](./io_functions#getassetpaths)
* [io.setAssetPaths](./io_functions#setassetpaths)

### findInDirectories

Find the final path. This will search for the file in asset paths.

```python
io.findInDirectories(filePath) -> core.String
```

Parameters

| Type                          | Name     | Description                             |
| ----------------------------- | -------- | --------------------------------------- |
| [String](./core_types#string) | filePath | The (relative) file path to search for. |

Returns

| Type                          | Name      | Description              |
| ----------------------------- | --------- | ------------------------ |
| [String](./core_types#string) | finalPath | The returned final path. |

See also:

* [io.addAssetPaths](./io_functions#addassetpaths)
* [io.clearAssetPaths](./io_functions#clearassetpaths)
* [io.getAssetPaths](./io_functions#getassetpaths)
* [io.setAssetPaths](./io_functions#setassetpaths)

### getAssetPaths

Get user defined paths to find assets.

```python
io.getAssetPaths() -> core.StringList
```

Returns

| Type                                  | Name       | Description      |
| ------------------------------------- | ---------- | ---------------- |
| [StringList](./core_types#stringlist) | assetPaths | The asset paths. |

See also:

* [io.addAssetPaths](./io_functions#addassetpaths)
* [io.clearAssetPaths](./io_functions#clearassetpaths)
* [io.findInDirectories](./io_functions#findindirectories)
* [io.setAssetPaths](./io_functions#setassetpaths)

### setAssetPaths

Replace paths to find assets.

```python
io.setAssetPaths(assetPaths)
```

Parameters

| Type                                  | Name       | Description      |
| ------------------------------------- | ---------- | ---------------- |
| [StringList](./core_types#stringlist) | assetPaths | The asset paths. |

See also:

* [io.addAssetPaths](./io_functions#addassetpaths)
* [io.clearAssetPaths](./io_functions#clearassetpaths)
* [io.findInDirectories](./io_functions#findindirectories)
* [io.getAssetPaths](./io_functions#getassetpaths)

## Debug

## Import/Export

### applyAutoTessellate

Handle auto tessellate options on given part, need to be complete.

```python
io.applyAutoTessellate(part)
```

Parameters

| Type                       | Name | Description                  |
| -------------------------- | ---- | ---------------------------- |
| [Part](./scene_types#part) | part | Part to be auto tessellated. |

See also:

* [io.exportScene](./io_functions#exportscene)
* [io.exportSelection](./io_functions#exportselection)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importFiles](./io_functions#importfiles)
* [io.importPicture](./io_functions#importpicture)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.importScene](./io_functions#importscene)
* [io.listVariants](./io_functions#listvariants)
* [io.loadReferencedData](./io_functions#loadreferenceddata)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### exportScene

Export a file.

```python
io.exportScene(fileName, root=0)
```

Parameters

| Type                                          | Name     | Description                                  |
| --------------------------------------------- | -------- | -------------------------------------------- |
| [OutputFilePath](./core_types#outputfilepath) | fileName | Path of the file to export.                  |
| [Occurrence](./scene_types#occurrence)        | root     | Identifier of the root occurrence to export. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportSelection](./io_functions#exportselection)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importFiles](./io_functions#importfiles)
* [io.importPicture](./io_functions#importpicture)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.importScene](./io_functions#importscene)
* [io.listVariants](./io_functions#listvariants)
* [io.loadReferencedData](./io_functions#loadreferenceddata)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### exportSelection

Export the selection to a file.

```python
io.exportSelection(fileName, keepIntermediaryNodes=False)
```

Parameters

| Type                                          | Name                  | Description                               |
| --------------------------------------------- | --------------------- | ----------------------------------------- |
| [OutputFilePath](./core_types#outputfilepath) | fileName              | Path of the file to export.               |
| [Boolean](./core_types#boolean)               | keepIntermediaryNodes | If true, intermerdiary hierarchy is kept. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportScene](./io_functions#exportscene)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importFiles](./io_functions#importfiles)
* [io.importPicture](./io_functions#importpicture)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.importScene](./io_functions#importscene)
* [io.listVariants](./io_functions#listvariants)
* [io.loadReferencedData](./io_functions#loadreferenceddata)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### getExportFormats

Give all the format name and their extensions that can be exported in Pixyz.

```python
io.getExportFormats(forRuntimeOS=True) -> core.FormatList
```

Parameters

| Type                      | Name         | Description                               |
| ------------------------- | ------------ | ----------------------------------------- |
| [Bool](./core_types#bool) | forRuntimeOS | Get format for the current OS or for all. |

Returns

| Type                                  | Name    | Description                            |
| ------------------------------------- | ------- | -------------------------------------- |
| [FormatList](./core_types#formatlist) | formats | Formats that can be exported in Pixyz. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportScene](./io_functions#exportscene)
* [io.exportSelection](./io_functions#exportselection)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importFiles](./io_functions#importfiles)
* [io.importPicture](./io_functions#importpicture)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.importScene](./io_functions#importscene)
* [io.listVariants](./io_functions#listvariants)
* [io.loadReferencedData](./io_functions#loadreferenceddata)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### getFormatsDescriptions

Give all the formats description that can be imported/exported in Pixyz.

```python
io.getFormatsDescriptions(forRuntimeOS=True) -> io.FileFormatList
```

Parameters

| Type                      | Name         | Description                               |
| ------------------------- | ------------ | ----------------------------------------- |
| [Bool](./core_types#bool) | forRuntimeOS | Get format for the current OS or for all. |

Returns

| Type                                        | Name    | Description                                     |
| ------------------------------------------- | ------- | ----------------------------------------------- |
| [FileFormatList](./io_types#fileformatlist) | formats | Formats that can be imported/exported in Pixyz. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportScene](./io_functions#exportscene)
* [io.exportSelection](./io_functions#exportselection)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importFiles](./io_functions#importfiles)
* [io.importPicture](./io_functions#importpicture)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.importScene](./io_functions#importscene)
* [io.listVariants](./io_functions#listvariants)
* [io.loadReferencedData](./io_functions#loadreferenceddata)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### getImportFormats

Give all the format name and their extensions that can be imported in Pixyz.

```python
io.getImportFormats(forRuntimeOS=True) -> core.FormatList
```

Parameters

| Type                      | Name         | Description                                                                      |
| ------------------------- | ------------ | -------------------------------------------------------------------------------- |
| [Bool](./core_types#bool) | forRuntimeOS | If true, gets formats for the current OS. If false, gets for all supported OSes. |

Returns

| Type                                  | Name    | Description                            |
| ------------------------------------- | ------- | -------------------------------------- |
| [FormatList](./core_types#formatlist) | formats | Formats that can be imported in Pixyz. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportScene](./io_functions#exportscene)
* [io.exportSelection](./io_functions#exportselection)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.importFiles](./io_functions#importfiles)
* [io.importPicture](./io_functions#importpicture)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.importScene](./io_functions#importscene)
* [io.listVariants](./io_functions#listvariants)
* [io.loadReferencedData](./io_functions#loadreferenceddata)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### importFiles

Import files.

```python
io.importFiles(fileNames, root=0) -> scene.OccurrenceList
```

Parameters

| Type                                   | Name      | Description                               |
| -------------------------------------- | --------- | ----------------------------------------- |
| [FilesList](./io_types#fileslist)      | fileNames | List of files's paths to import.          |
| [Occurrence](./scene_types#occurrence) | root      | Identifier of the destination occurrence. |

Returns

| Type                                           | Name | Description                                 |
| ---------------------------------------------- | ---- | ------------------------------------------- |
| [OccurrenceList](./scene_types#occurrencelist) | dest | The root occurrences of each imported file. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportScene](./io_functions#exportscene)
* [io.exportSelection](./io_functions#exportselection)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importPicture](./io_functions#importpicture)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.importScene](./io_functions#importscene)
* [io.listVariants](./io_functions#listvariants)
* [io.loadReferencedData](./io_functions#loadreferenceddata)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### importPicture

Imports a picture and applies is at as a texture on a 3D plane created in the scene.

```python
io.importPicture(filename, root=0) -> scene.Occurrence
```

Parameters

| Type                                   | Name     | Description                               |
| -------------------------------------- | -------- | ----------------------------------------- |
| [FilePath](./core_types#filepath)      | filename | Path of the file to import.               |
| [Occurrence](./scene_types#occurrence) | root     | Identifier of the destination occurrence. |

Returns

| Type                                   | Name | Description                                                                         |
| -------------------------------------- | ---- | ----------------------------------------------------------------------------------- |
| [Occurrence](./scene_types#occurrence) | dest | The root occurrence if defined, otherwise a new occurrence created by the importer. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportScene](./io_functions#exportscene)
* [io.exportSelection](./io_functions#exportselection)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importFiles](./io_functions#importfiles)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.importScene](./io_functions#importscene)
* [io.listVariants](./io_functions#listvariants)
* [io.loadReferencedData](./io_functions#loadreferenceddata)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### importRemote3mxFile

Import a remote 3mx file.

```python
io.importRemote3mxFile(filePath, origin="", root=0) -> scene.Occurrence
```

Parameters

| Type                                   | Name     | Description                               |
| -------------------------------------- | -------- | ----------------------------------------- |
| [String](./core_types#string)          | filePath | The path of the temp file.                |
| [String](./core_types#string)          | origin   | Remote origin of the file.                |
| [Occurrence](./scene_types#occurrence) | root     | Identifier of the destination occurrence. |

Returns

| Type                                   | Name | Description                                                                         |
| -------------------------------------- | ---- | ----------------------------------------------------------------------------------- |
| [Occurrence](./scene_types#occurrence) | dest | The root occurrence if defined, otherwise a new occurrence created by the importer. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportScene](./io_functions#exportscene)
* [io.exportSelection](./io_functions#exportselection)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importFiles](./io_functions#importfiles)
* [io.importPicture](./io_functions#importpicture)
* [io.importScene](./io_functions#importscene)
* [io.listVariants](./io_functions#listvariants)
* [io.loadReferencedData](./io_functions#loadreferenceddata)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### importScene

Import a file.

```python
io.importScene(fileName, root=0) -> scene.Occurrence
```

Parameters

| Type                                   | Name     | Description                               |
| -------------------------------------- | -------- | ----------------------------------------- |
| [FilePath](./core_types#filepath)      | fileName | Path of the file to import.               |
| [Occurrence](./scene_types#occurrence) | root     | Identifier of the destination occurrence. |

Returns

| Type                                   | Name | Description                                                                         |
| -------------------------------------- | ---- | ----------------------------------------------------------------------------------- |
| [Occurrence](./scene_types#occurrence) | dest | The root occurrence if defined, otherwise a new occurrence created by the importer. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportScene](./io_functions#exportscene)
* [io.exportSelection](./io_functions#exportselection)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importFiles](./io_functions#importfiles)
* [io.importPicture](./io_functions#importpicture)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.listVariants](./io_functions#listvariants)
* [io.loadReferencedData](./io_functions#loadreferenceddata)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### listVariants

List all variants if file.

```python
io.listVariants(fileName) -> io.VariantNameList
```

Parameters

| Type                              | Name     | Description                 |
| --------------------------------- | -------- | --------------------------- |
| [FilePath](./core_types#filepath) | fileName | Path of the file to import. |

Returns

| Type                                          | Name     | Description        |
| --------------------------------------------- | -------- | ------------------ |
| [VariantNameList](./io_types#variantnamelist) | variants | List all variants. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportScene](./io_functions#exportscene)
* [io.exportSelection](./io_functions#exportselection)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importFiles](./io_functions#importfiles)
* [io.importPicture](./io_functions#importpicture)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.importScene](./io_functions#importscene)
* [io.loadReferencedData](./io_functions#loadreferenceddata)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### loadReferencedData

Load partial model.

```python
io.loadReferencedData(component, recursively)
```

Parameters

| Type                                                             | Name        | Description                 |
| ---------------------------------------------------------------- | ----------- | --------------------------- |
| [ReferencedDataComponent](./scene_types#referenceddatacomponent) | component   | The component to load.      |
| [Bool](./core_types#bool)                                        | recursively | Load it recursively or not. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportScene](./io_functions#exportscene)
* [io.exportSelection](./io_functions#exportselection)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importFiles](./io_functions#importfiles)
* [io.importPicture](./io_functions#importpicture)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.importScene](./io_functions#importscene)
* [io.listVariants](./io_functions#listvariants)
* [io.unloadReferencedData](./io_functions#unloadreferenceddata)

### unloadReferencedData

Unload partial model.

```python
io.unloadReferencedData(component)
```

Parameters

| Type                                                             | Name      | Description              |
| ---------------------------------------------------------------- | --------- | ------------------------ |
| [ReferencedDataComponent](./scene_types#referenceddatacomponent) | component | The component to unload. |

See also:

* [io.applyAutoTessellate](./io_functions#applyautotessellate)
* [io.exportScene](./io_functions#exportscene)
* [io.exportSelection](./io_functions#exportselection)
* [io.getExportFormats](./io_functions#getexportformats)
* [io.getFormatsDescriptions](./io_functions#getformatsdescriptions)
* [io.getImportFormats](./io_functions#getimportformats)
* [io.importFiles](./io_functions#importfiles)
* [io.importPicture](./io_functions#importpicture)
* [io.importRemote3mxFile](./io_functions#importremote3mxfile)
* [io.importScene](./io_functions#importscene)
* [io.listVariants](./io_functions#listvariants)
* [io.loadReferencedData](./io_functions#loadreferenceddata)

## ImportCallbacks

### registerIOCallbacks

Register import and export callbacks.

```python
io.registerIOCallbacks(name, importCallback, exportCallback, fileFormats)
```

Parameters

| Type                                                | Name           | Description                                          |
| --------------------------------------------------- | -------------- | ---------------------------------------------------- |
| [String](./core_types#string)                       | name           | Callback name.                                       |
| [importFileCallback](./io_types#importfilecallback) | importCallback | Callback that import a file.                         |
| [exportFileCallback](./io_types#exportfilecallback) | exportCallback | Callback that exports to a file.                     |
| [FileFormatList](./io_types#fileformatlist)         | fileFormats    | Gives the extension and parameters to Import/Export. |

## Point Cloud

### splitPointCloud

```python
io.splitPointCloud(files, outputDirectory, minVoxSize, useKDTree, aabb=None, density=-1)
```

Parameters

| Type                                                    | Name            | Description                                          |
| ------------------------------------------------------- | --------------- | ---------------------------------------------------- |
| [FilePathList](./core_types#filepathlist)               | files           | Path of the point cloud files to process.            |
| [OutputDirectoryPath](./core_types#outputdirectorypath) | outputDirectory | Output directory.                                    |
| [Double](./core_types#double)                           | minVoxSize      | Size of minimum leaves (mm).                         |
| [Boolean](./core_types#boolean)                         | useKDTree       | If true, uses a kd\_tree, otherwise, uses an octree. |
| [AABB](./geom_types#aabb)                               | aabb            | Global scene aabb.                                   |
| [Double](./core_types#double)                           | density         | Point cloud density (-1 to compute).                 |

## Priorities

### getExtensionPriority

Get the priority of an extension from the pixyz importer.

```python
io.getExtensionPriority(extensionName) -> io.PriorityImportLevel
```

Parameters

| Type                          | Name          | Description                |
| ----------------------------- | ------------- | -------------------------- |
| [String](./core_types#string) | extensionName | The name of the extension. |

Returns

| Type                                                  | Name     | Description                             |
| ----------------------------------------------------- | -------- | --------------------------------------- |
| [PriorityImportLevel](./io_types#priorityimportlevel) | priority | The level of priority of the extension. |
