evCreate API 5.7 Help

SetUnit Function

Changes a unit of measurement (UoM) displayed for 2D length measurements on a given page in an Envision document currently opened in the Canvas Envision Creator app.

SetUnit(page: [[[EvItem|canvas-envision-document-items.html#page-items]]], unit: [[[EvDocUnit|evdocunit-enumeration.html]]]): Promise<void>

Parameters

page: EvItem

A Page item object of a page in the Envision document currently opened in the Canvas Envision Creator app that should display the given UoM for 2D length measurements.

unit: EvDocUnit

A member of the EvDocUnit enumeration, a UoM that should be displayed for 2D length measurements on the given page in the GUI.

Return value

Promise<void>

A Promise that, if fulfilled, resolves to void if the length UoM displayed on the given page in the current Envision document has been successfully changed.

Discussion

For 2D length measurements and calculations, the evCreate API uses the length UoM set globally for the entire API with the ConfigureOptions(opt: EvCreateApiOptions): Promise<EvCreateApiOptions> function.

However, the SetUnit(page: EvItem, unit: EvDocUnit): Promise<void> function can set a length UoM different from the global one for a given page. In such a case:

  • The evCreate API will still use the global UoM for measurements and calculations on the given page.

  • The given page will show the UoM set with the SetUnit(page: EvItem, unit: EvDocUnit): Promise<void> function to the user in the GUI.

To learn the global UoM, use the GetCurrentOptions(): Promise<EvCreateApiOptions> function.

18 March 2025