Autodesk Forge – Do any IDs persist when translating a new source file with minor changes?
Background
We currently use AutoDesk Forge to display 2D models of floor plans. Users have the ability to upload new floor plans (which uploads to OSS, then translates the file) to replace existing ones, that may include new objects in the room, or slightly different positioning of existing objects. Currently, we grab certain object dbId’s via viewer.getSelection()
to “bind” (using the term loosely here) some external data to the object and perform certain interactions within our web app.
Issue
When uploading a new floor plan with a new object, it shifts dbId’s of objects, and our external binding is then inaccurate.
Question
• Are there any IDs that persist between the uploads/translations?
*We do not maintain control of the .dwg files prior to their upload, so adding attributes on the drawing before it’s translated likely won’t be viable for our particular case – but if that’s the best (or only) approach, I would like to know to propose it as a possible solution to my team.
Example
Let’s say there’s a simple square room with 3 chairs, and it’s rendered and visible in the viewer since it’s been uploaded as room1 (object key). We identify all three chairs by their dbIds and save that, so a user can jump right to the object in question, and we put a label on it. Then someone comes along and adds 2 more chairs, uploads/translates the document again with the same object key. Now, the dbIds are changed and as a result, the label and dbId of the first chair is ‘bound’ to one of the new chairs. Question is, is there something other than dbId that persists between the different renderings? Or, is there something that I haven’t considered that would be a better approach of keeping the binding accurate between uploads?
Contingency Plan
If there’s not an ID of some sort that persists, I’m considering storing the coordinates of the object we want to bind to, and later find the closest object to those x/y/z coords. Is that a possibility, to find an object close to or overlapping xyz?
Read more here: Source link