简体   繁体   中英

Creating a measurement from existing points using measure.js in the Autodesk Forge Viewer

I am currently writing an extension app for the Autodesk Forge Viewer , and I need to be able to create a measurement from existing points.

To elaborate, I have been able to save the XYZ coordinate data for each point of a measurement to a JSON which is then stored locally.

For example , if you create an angle measurement, it will save the coordinate data for each of the three points needed to make the angle measurement.

The part I am now stuck at is that I am struggling to be able to recreate this measurement when the viewer is reloaded. I can get the coordinate points into measure.js , but there seems to be no easy way to instantiate a new measurement from these points, seemingly because the measurement is created from SnapResults that are returned from click events.

Is there any way I can achieve this functionality? I need the new measurement to appear as it was when it was created, with labels and with editable points, but using only the coordinate points to create it. Any help from the Forge team would be greatly appreciated.

While not exactly supported, There is a modified version of the area measurement tool with source-code and details on how to save and restore measurements.

Blog and video: https://forge.autodesk.com/blog/area-planning-tool-forge-viewer-and-mysql

Live demo: https://wallabyway.github.io/area-markup/ (note: click measurement tool before you start)

source code - GitHub: https://github.com/wallabyway/area-markup

Let me know if this has what you are looking for. 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM