UNPKG

forma-embedded-view-sdk

Version:

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

42 lines (41 loc) 1.7 kB
/** * Interact with Forma's native predictive models for [rapid analysis](https://help.autodeskforma.com/en/articles/6977396-rapid-wind-analysis). * * @remarks * Available via {@link auto.Forma | Forma}.{@link index.EmbeddedViewSdk.prediction | prediction}. */ export class PredictiveAnalysisApi { #iframeMessenger; constructor(iframeMessenger) { this.#iframeMessenger = iframeMessenger; } /** * This function return the wind parameters used by Forma to predict wind conditions. * It includes a wind rose with 8 directions and a surface roughness. */ async getWindParameters() { return await this.#iframeMessenger.sendRequest("prediction/get-wind-parameters"); } /** * Predict wind conditions usings Forma's rapid wind model. * Read more about rapid wind at [Forma Help](https://help.autodeskforma.com/en/articles/6977396-rapid-wind-analysis). * * @returns 2d grid of wind conditions. For wind comfort values are 0-4 where lower is better conditions. * * @example * const windRose = await Forma.prediction.getWindParameters() * // See HeightMaps for more infor on how to create heightMaps * const heightMaps = computeHeightMaps(terrainGeometry, terrainAndBuildingsGeometry) * const prediction = await Forma.prediction.predictWind({ * heightMaps, * windRose, * type: "comfort", * roughness: windRose.roughness, * comfortScale: "lawson_lddc", * }) * // calculate statistics, mix with other grids, etc. */ async predictWind(request) { return await this.#iframeMessenger.sendRequest("prediction/predict-wind", request); } }