Skip to main content

system.mes.material.exportAsCsv

Description

No Parameter:

Exports all Materials and Material Classes as raw CSV bytes (UTF-8 encoded). Streams material data from the database and formats it as CSV, including a header row.

With a Parameter:

Exports selected Materials and Material Classes by ids or paths as raw CSV bytes (UTF-8 encoded). Streams material data from the database and formats it as CSV, including a header row.

Syntax

system.mes.material.exportAsCsv()
system.mes.material.exportAsCsv(idsOrPaths)

Parameters

No Parameter:

ParameterTypeNullableDescription
None--This method does not take any parameters.

With a Parameter:

ParameterTypeNullableDescription
idsOrPathsPyListTrueList of material ids or paths to export only.

Returns

A Byte array (Byte[]) containing the raw byte data of the CSV export.

Code Examples

Perspective

csvBytes = system.mes.material.exportAsCsv()
system.perspective.download("materials.csv", csvBytes)

Script Console

csvBytes = system.mes.material.exportAsCsv()
path = system.file.saveFile("materials.csv")
if path is not None:
system.file.writeFile(path, csvBytes)