PLYExporter

An exporter for PLY.

PLY (Polygon or Stanford Triangle Format) is a file format for efficient delivery and loading of simple, static 3D content in a dense format. Both binary and ascii formats are supported. PLY can store vertex positions, colors, normals and uv coordinates. No textures or texture references are saved.

Import

PLYExporter is an add-on, and must be imported explicitly. See Installation / Addons.

import { PLYExporter } from 'three/addons/exporters/PLYExporter.js';

Code Example

// Instantiate an exporter

const exporter = new PLYExporter();

// Parse the input and generate the ply output

const data = exporter.parse( scene, options );

downloadFile( data );

Constructor

PLYExporter()

Creates a new PLYExporter.

Methods

.parse ( input : Object3D, onDone : Function, options : Object ) : Object

input — Object3D

onCompleted — Will be called when the export completes. The argument will be the generated ply ascii or binary ArrayBuffer.

options — Export options

  • excludeAttributes – array. Which properties to explicitly exclude from the exported PLY file. Valid values are ‘color’, ‘normal’, ‘uv’, and ‘index’. If triangle indices are excluded, then a point cloud is exported. Default is an empty array.
  • binary – bool. Export in binary format, returning an ArrayBuffer. Default is false.

Generates ply file data as string or ArrayBuffer (ascii or binary) output from the input object. The data that is returned is the same that is passed into the “onCompleted” function. If the object is composed of multiple children and geometry, they are merged into a single mesh in the file.

Leave a comment

Your email address will not be published. Required fields are marked *