UNPKG

forma-embedded-view-sdk

Version:

The Forma Embedded View SDK is a JavaScript library for creating custom extensions in Autodesk Forma (previously Spacemaker).

31 lines (30 loc) 973 B
/** * Calculate [area metrics](https://help.autodeskforma.com/en/articles/6995661-introduction-to-area-metrics). * * @remarks * Available via {@link index.EmbeddedViewSdk.areaMetrics | EmbeddedViewSdk.areaMetrics}. */ export class AreaMetricsApi { #iframeMessenger; /** @hidden */ constructor(iframeMessenger) { this.#iframeMessenger = iframeMessenger; } /** * Calculate area metrics for the given paths. * If no paths are given, the metrics will be calculated for all elements. * * @returns * Area metrics for the given paths. * * @example * // Calculate area metrics for selected elements * const currentlySelected = await Forma.selection.getSelection() * const areaMetrics = await Forma.areaMetrics.calculate({ * paths: currentlySelected * }) */ async calculate(request) { return await this.#iframeMessenger.sendRequest("area-metrics/get", request); } }