Skip to main content

Setup

Initialization and configuration of the Client SDK

All initialization methods are asynchronous and return a promise. Use await or .then to handle the resolved value and ensure proper execution order.

load

Usage

const library = await import('<script_url>');
const sdk = await library.load({ token: '<access_token>' });

Signature

load({ token: access_token });

Parameters

parametertypenote
token
(required)
stringAurora access token
networkLatencyToastThresholdnumberNumber of milliseconds of network latency to allow before showing a warning (default: 2500)

Returns

A promise that resolves when CAD has finished loading and authenticating.

Login Errors

messagedescription
Invalid options passed to login methodThe object passed to login does not match the format listed above or is missing required properties.
JWT token expiredThe token passed to login is expired; you must generate a new token and try again.
Invalid username/password combinationUsername/password login has failed; make sure you have entered the correct credentials.

attach

Specify which DOM node CAD should be loaded into, by passing a DOM node or selector. It will not appear onto the page until a design is loaded.

Note that this element will have its "contain" style prop set to "strict", this creates a new containing block, and therefore must be sized explicitly.

Usage

<div style="height: 100%; width: 100%" id="cad-element"></div>
const library = await import('<script_url>');
const sdk = await library.load({ token: '<access_token>' });

// You can load designs and use other features in the "background"
// before calling sdk.cad.attach to render the CAD canvas:
const design = await sdk.design.load('<design_id>');
await design.runIrradiance();

// This will render the CAD canvas in your application and resolve once it is ready:
await sdk.cad.attach('#cad-element');

Signature

attach(domNodeOrSelector);

Parameters

parametertypenote
domNodeOrSelector
(required)
string or DOMElementa selector or dom element to load the CAD canvas into

Returns

A promise that resolves once the CAD canvas has initialized.

Attach Errors

messagedescription
DOM node or selector must be emptyThe DOM node passed to attach has at least one child. Ensure that the DOM node passed in (or referred to by a selector) is empty when attach is called. Could also indicate that attach is called more than once.
'Invalid DOM node or selector passed to attach method'The DOM node passed to attach was null or undefined, or the selector passed to attach refers to a DOM node that does not exist.