# IO

> Python API functions

### configureFunctionLogger

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

Parameters

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

## Asset paths

### addAssetPaths

Add directory paths to search assets in.

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

Parameters

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

See also:

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

### clearAssetPaths

Clear all asset paths.

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

See also:

* [io.addAssetPaths](./io_functions.md#addassetpaths)
* [io.findInDirectories](./io_functions.md#findindirectories)
* [io.getAssetPaths](./io_functions.md#getassetpaths)
* [io.setAssetPaths](./io_functions.md#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.md#string) | filePath | The (relative) file path to search for. |

Returns

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

See also:

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

### getAssetPaths

Get user defined paths to find assets.

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

Returns

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

See also:

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

### setAssetPaths

Replace paths to find assets.

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

Parameters

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

See also:

* [io.addAssetPaths](./io_functions.md#addassetpaths)
* [io.clearAssetPaths](./io_functions.md#clearassetpaths)
* [io.findInDirectories](./io_functions.md#findindirectories)
* [io.getAssetPaths](./io_functions.md#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.md#part) | part | Part to be auto tessellated. |

See also:

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

### exportScene

Export a file.

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

Parameters

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

See also:

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

### exportSelection

Export the selection to a file.

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

Parameters

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

See also:

* [io.applyAutoTessellate](./io_functions.md#applyautotessellate)
* [io.exportScene](./io_functions.md#exportscene)
* [io.getExportFormats](./io_functions.md#getexportformats)
* [io.getFormatsDescriptions](./io_functions.md#getformatsdescriptions)
* [io.getImportFormats](./io_functions.md#getimportformats)
* [io.importFiles](./io_functions.md#importfiles)
* [io.importPicture](./io_functions.md#importpicture)
* [io.importRemote3mxFile](./io_functions.md#importremote3mxfile)
* [io.importScene](./io_functions.md#importscene)
* [io.listVariants](./io_functions.md#listvariants)
* [io.loadReferencedData](./io_functions.md#loadreferenceddata)
* [io.unloadReferencedData](./io_functions.md#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.md#bool) | forRuntimeOS | Get format for the current OS or for all. |

Returns

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

See also:

* [io.applyAutoTessellate](./io_functions.md#applyautotessellate)
* [io.exportScene](./io_functions.md#exportscene)
* [io.exportSelection](./io_functions.md#exportselection)
* [io.getFormatsDescriptions](./io_functions.md#getformatsdescriptions)
* [io.getImportFormats](./io_functions.md#getimportformats)
* [io.importFiles](./io_functions.md#importfiles)
* [io.importPicture](./io_functions.md#importpicture)
* [io.importRemote3mxFile](./io_functions.md#importremote3mxfile)
* [io.importScene](./io_functions.md#importscene)
* [io.listVariants](./io_functions.md#listvariants)
* [io.loadReferencedData](./io_functions.md#loadreferenceddata)
* [io.unloadReferencedData](./io_functions.md#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.md#bool) | forRuntimeOS | Get format for the current OS or for all. |

Returns

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

See also:

* [io.applyAutoTessellate](./io_functions.md#applyautotessellate)
* [io.exportScene](./io_functions.md#exportscene)
* [io.exportSelection](./io_functions.md#exportselection)
* [io.getExportFormats](./io_functions.md#getexportformats)
* [io.getImportFormats](./io_functions.md#getimportformats)
* [io.importFiles](./io_functions.md#importfiles)
* [io.importPicture](./io_functions.md#importpicture)
* [io.importRemote3mxFile](./io_functions.md#importremote3mxfile)
* [io.importScene](./io_functions.md#importscene)
* [io.listVariants](./io_functions.md#listvariants)
* [io.loadReferencedData](./io_functions.md#loadreferenceddata)
* [io.unloadReferencedData](./io_functions.md#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.md#bool) | forRuntimeOS | If true, gets formats for the current OS. If false, gets for all supported OSes. |

Returns

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

See also:

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

### importFiles

Import files.

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

Parameters

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

Returns

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

See also:

* [io.applyAutoTessellate](./io_functions.md#applyautotessellate)
* [io.exportScene](./io_functions.md#exportscene)
* [io.exportSelection](./io_functions.md#exportselection)
* [io.getExportFormats](./io_functions.md#getexportformats)
* [io.getFormatsDescriptions](./io_functions.md#getformatsdescriptions)
* [io.getImportFormats](./io_functions.md#getimportformats)
* [io.importPicture](./io_functions.md#importpicture)
* [io.importRemote3mxFile](./io_functions.md#importremote3mxfile)
* [io.importScene](./io_functions.md#importscene)
* [io.listVariants](./io_functions.md#listvariants)
* [io.loadReferencedData](./io_functions.md#loadreferenceddata)
* [io.unloadReferencedData](./io_functions.md#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.md#filepath)      | filename | Path of the file to import.               |
| [Occurrence](./scene_types.md#occurrence) | root     | Identifier of the destination occurrence. |

Returns

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

See also:

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

### importRemote3mxFile

Import a remote 3mx file.

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

Parameters

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

Returns

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

See also:

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

### importScene

Import a file.

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

Parameters

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

Returns

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

See also:

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

### listVariants

List all variants if file.

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

Parameters

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

Returns

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

See also:

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

### loadReferencedData

Load partial model.

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

Parameters

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

See also:

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

### unloadReferencedData

Unload partial model.

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

Parameters

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

See also:

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

## ImportCallbacks

### registerIOCallbacks

Register import and export callbacks.

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

Parameters

| Type                                                   | Name           | Description                                          |
| ------------------------------------------------------ | -------------- | ---------------------------------------------------- |
| [String](./core_types.md#string)                       | name           | Callback name.                                       |
| [importFileCallback](./io_types.md#importfilecallback) | importCallback | Callback that import a file.                         |
| [exportFileCallback](./io_types.md#exportfilecallback) | exportCallback | Callback that exports to a file.                     |
| [FileFormatList](./io_types.md#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.md#filepathlist)               | files           | Path of the point cloud files to process.            |
| [OutputDirectoryPath](./core_types.md#outputdirectorypath) | outputDirectory | Output directory.                                    |
| [Double](./core_types.md#double)                           | minVoxSize      | Size of minimum leaves (mm).                         |
| [Boolean](./core_types.md#boolean)                         | useKDTree       | If true, uses a kd\_tree, otherwise, uses an octree. |
| [AABB](./geom_types.md#aabb)                               | aabb            | Global scene aabb.                                   |
| [Double](./core_types.md#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.md#string) | extensionName | The name of the extension. |

Returns

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