wallabyway / forge-markup-measure-extensions

public 'mirror' version of forge viewer markup and measure extensions
MIT License
10 stars 4 forks source link

Example of save and restore measurements #3

Open wallabyway opened 4 years ago

wallabyway commented 4 years ago

API

Here's the two APIs for save and restore: https://github.com/wallabyway/forge-markup-measure-extensions/blob/325006d4d527496b9cf17b2022cc1e3a87498482/Measure/Measure.js#L268-L281

Example:

1. Save to Database

Create some measurements, then serialize them to a string before you save the string to a database, like this:

ext = NOP_VIEWER.getExtension("Autodesk.Measure")
list = ext.getMeasurementList();
szList = JSON.stringify(list)

2. Restore from Database

sz = string from database
ext.setMeasurements(JSON.parse(sz))
Screen Shot 2020-05-21 at 7 48 47 PM
YouYue123 commented 4 years ago

Is this also persisted in IndexDB or local storage to retrieve it even after page refresh?