Skip to main content

Geometry Module

import * as sethealth from '@sethealth/core';
sethealth.geometry.[...]

API reference#

geometry.createFromGeometries( geoOrSpace: | Workspace )

Creates a new geometry from an array of geometries, or a workspace.


geometry.createFromVertices( opts: GeometryVerticesOptions )

Will create a `Geometry` from an array of vertices.


geometry.ensureSources( geometries: undefined, opts: EnsureSourcesGeometryOptions, onProgress: ProgressCallback )

`Geometry` in sethealth might or might not have a source. A source is usually a URL from which the geometry can be downloaded and it's required in order to be shared.

This method, when passed an array of `Geometry`, ensures all the geometries in the array have a source. If a geometry does not have a source, it will upload it and store the source, if the geometry already have a source, it will just skip over.


geometry.loadFromFiles( files: ArrayLike, onProgress: undefined )

Loads new `Geometry` from an array of files. Under the hood, it will look at the file extensions as heuristics to determine which files should be loaded. Once the "stl" files are found, it will use `loadFromSource()` under the hood, and return the same results.


geometry.loadFromFilesystem( openFolders: boolean, onStart?: undefined | , onProgress: undefined )

Will open a native UI so the users can import files or folder from their local filesystem. Once the files are loaded, it will use `loadFromFiles()` under the hood, and return the same results.


geometry.loadFromSerialization( geometries: undefined, onProgress: undefined )

Will load a `Geometry` from a previously serialized one.


geometry.loadFromSource( source: GeometrySource | string, onProgress: undefined )

Loads a new `Geometry` from a source. A "source" can be an URL or a File.

Please look at `GeometrySource` interface for further information. Given a source, this method returns geometry. One `Geometry` will only handle one geometry


geometry.serializeGLTF( geometry: Geometry, rotation?: Point )