forma-embedded-view-sdk
Version:
The Forma Embedded View SDK is a JavaScript library for creating custom extensions in Autodesk Forma Site Design (previously Spacemaker).
66 lines (65 loc) • 2.05 kB
TypeScript
import type { Transform, Urn } from "forma-elements";
import type { IframeMessenger } from "../iframe-messenger.js";
/**
* Render elements in the 3D scene.
*
* @remarks
* Available via {@link auto.Forma | Forma}.{@link index.EmbeddedViewSdk.experimental | experimental}.{@link index.EmbeddedViewSdk.render | render}.{@link render.RenderApi.element | element}.
*/
export declare class RenderElementApi {
#private;
constructor(iframeMessenger: IframeMessenger);
/**
* Add elements to the scene.
*
* @returns Unique identifier for this render call
*
* @example
* const { id } = await Forma.render.element.add({ elements: [{ urn: <urn> }] }),
*/
add(request: {
/** A list of elements with their transforms */
elements: {
urn: Urn;
transform?: Transform;
}[];
}): Promise<{
id: string;
}>;
/**
* Upsert an element in the scene. If the element does not exist, it will be added.
*
* This method can also be used as an upsert.
*
* @example
* await Forma.render.element.update({ id: "myPreviousAddedGroup", elements: [{ urn: <urn> }] })
*/
update(request: {
/** Id of group to update. Obtained when adding elements using the Forma.render.element.add function */
id: string;
/** A list of elements with their transforms */
elements: {
urn: Urn;
transform?: Transform;
}[];
}): Promise<void>;
/**
* Remove an existing element group from the scene.
*
* @example
* await Forma.render.element.remove({ id: "myPreviousAddedGroup" })
*/
remove(request: {
/** Scene identifier of the Element object to remove. */
id: string;
}): Promise<void>;
/**
* Remove all Elements added by this API from the scene.
*
* Called automatically when the extension is unloaded
*
* @example
* await Forma.render.element.cleanup()
*/
cleanup(): Promise<void>;
}