Class: ExportOptions

PD.File. ExportOptions

Class representing export options for geometry files.

This class is used to configure the export options for geometry files, such as the format, filename, whether to use opacities, include outlines, swap Y and Z axes, and scale.


new ExportOptions( [config])

Creates a new export options object.

Export options allow the host application some control over the exported geometry, such as the format, filename, whether to use opacities, include outlines, swap Y/Z axes, and set a scale.

Parameters:
Name Type Argument Description
config object <optional>

A configuration object with export options.

Properties of config:
Name Type Argument Description
format string <optional>

The format to export to (e.g., 'glb', 'gltf', 'usdz', 'obj', 'stl', 'ply').

filename string <optional>

The base name of the file to save when the export object is generated.

includeOpacity boolean <optional>

Whether to make all surface and outline meshes opaque when exporting a PD.PolyMesh, defaults to false.

includeOutlines boolean <optional>

Whether to include the outline meshes within each PD.PolyMesh, defaults to false.

swapYZ boolean <optional>

Whether to swap the Y and Z axis during export, defaults to false.

scale number <optional>

The scale multiplier to apply, defaults to 1.

Author:
  • drajmarsh

Methods


copyFrom(data)

Copy properties to this instance from a source object.

Parameters:
Name Type Description
data object

A configuration object with export options.

Properties of data:
Name Type Argument Description
format string <optional>

The format to export to (e.g., 'glb', 'gltf', 'usdz', 'obj', 'stl', 'ply').

filename string <optional>

The base name of the file to save.

includeOpacity boolean <optional>

Whether to respect current PD.PolyMesh transparency values.

includeOutlines boolean <optional>

Whether to include the PD.PolyMesh outline meshes.

swapYZ boolean <optional>

Whether to swap the Y and Z axis during export.

scale number <optional>

The scale multiplier to apply.

Returns:

Returns this options instance to support method chaining.

Type
PD.File.ExportOptions

fromJSON(data)

Safely copy properties from a source object.

See the PD.Base#fromJSON method for more details.

Parameters:
Name Type Description
data object

A configuration object with export options.

Properties of data:
Name Type Argument Description
format string <optional>

The format to export to (e.g., 'glb', 'gltf', 'usdz', 'obj', 'stl', 'ply').

filename string <optional>

The base name of the file to save.

includeOpacity boolean <optional>

Whether to respect current PD.PolyMesh transparency values.

includeOutlines boolean <optional>

Whether to include the PD.PolyMesh outline meshes.

swapYZ boolean <optional>

Whether to swap the Y and Z axis during export.

scale number <optional>

The scale multiplier to apply.

Returns:

Returns this options instance to support method chaining.

Type
PD.File.ExportOptions

toJSON( [data])

Converts export options to a simple POJO for conversion to JSON.

This method is used to copy, store and save export options data, so the returned object must have all the properties required be able to rebuild this instance in its entirety when passed to the class constructor.

Parameters:
Name Type Argument Description
data object <optional>

An optional parent object to append this data to.

Returns:

Returns a Plain Old Javascript Object (POJO).

Type
object